Lines 34-39
use Koha::ItemTypes;
Link Here
|
34 |
use Koha::XSLT_Handler; |
34 |
use Koha::XSLT_Handler; |
35 |
use Koha::Libraries; |
35 |
use Koha::Libraries; |
36 |
|
36 |
|
|
|
37 |
use XML::LibXML; |
38 |
|
37 |
use Encode; |
39 |
use Encode; |
38 |
|
40 |
|
39 |
use vars qw(@ISA @EXPORT); |
41 |
use vars qw(@ISA @EXPORT); |
Lines 48-53
BEGIN {
Link Here
|
48 |
@ISA = qw(Exporter); |
50 |
@ISA = qw(Exporter); |
49 |
@EXPORT = qw( |
51 |
@EXPORT = qw( |
50 |
&XSLTParse4Display |
52 |
&XSLTParse4Display |
|
|
53 |
&CustomXSLTExportList |
51 |
); |
54 |
); |
52 |
$engine=Koha::XSLT_Handler->new( { do_not_return_source => 1 } ); |
55 |
$engine=Koha::XSLT_Handler->new( { do_not_return_source => 1 } ); |
53 |
} |
56 |
} |
Lines 188-200
sub get_xslt_sysprefs {
Link Here
|
188 |
} |
191 |
} |
189 |
|
192 |
|
190 |
sub XSLTParse4Display { |
193 |
sub XSLTParse4Display { |
191 |
my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang ) = @_; |
194 |
my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang , $opac) = @_; |
192 |
|
195 |
|
193 |
$sysxml ||= C4::Context->preference($xslsyspref); |
196 |
$sysxml ||= C4::Context->preference($xslsyspref); |
194 |
$xslfilename ||= C4::Context->preference($xslsyspref); |
197 |
$xslfilename ||= C4::Context->preference($xslsyspref); |
195 |
$lang ||= C4::Languages::getlanguage(); |
198 |
$lang ||= C4::Languages::getlanguage(); |
196 |
|
199 |
|
197 |
if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) { |
200 |
if ($xslsyspref eq "XSLTCustomExport") { |
|
|
201 |
my $dir; |
202 |
if ($opac) { |
203 |
$dir = C4::Context->config('opachtdocs') . |
204 |
'/' . C4::Context->preference("opacthemes") . |
205 |
'/' . C4::Languages::getlanguage() . |
206 |
'/xslt/biblioexport'; |
207 |
} else { |
208 |
$dir = C4::Context->config('intrahtdocs') . |
209 |
'/' . C4::Context->preference("template") . |
210 |
'/' . C4::Languages::getlanguage() . |
211 |
'/xslt/biblioexport'; |
212 |
} |
213 |
$xslfilename = $dir . "/" . $xslfilename; |
214 |
} elsif( $xslfilename =~ /^\s*"?default"?\s*$/i ) { |
198 |
my $htdocs; |
215 |
my $htdocs; |
199 |
my $theme; |
216 |
my $theme; |
200 |
my $xslfile; |
217 |
my $xslfile; |
Lines 352-357
sub engine {
Link Here
|
352 |
return $engine; |
369 |
return $engine; |
353 |
} |
370 |
} |
354 |
|
371 |
|
|
|
372 |
=head2 CustomXSLTExportList |
373 |
|
374 |
Returns list of file for custom xslt conversion |
375 |
|
376 |
=cut |
377 |
|
378 |
sub CustomXSLTExportList { |
379 |
my $opac = shift; # opac (1) vs intranet (0) |
380 |
my @tabFiles; |
381 |
|
382 |
my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') . |
383 |
'/' . C4::Context->preference( $opac ? "opacthemes" : "template") . |
384 |
'/' . C4::Languages::getlanguage() . |
385 |
'/xslt/biblioexport'; |
386 |
my @files = <$dir/*.xsl>; |
387 |
foreach my $file (@files) { |
388 |
if ( -f "$file" ) { |
389 |
(my $text = $file) =~ s/.*\///g; |
390 |
|
391 |
## Get title of the option |
392 |
my $dom = XML::LibXML->load_xml( location => $file ); |
393 |
my $node = $dom->documentElement(); |
394 |
my $title = $node->{"title"}; |
395 |
($title = $text) =~ s/\.xsl// unless defined $title; |
396 |
|
397 |
# Get output format |
398 |
# There should only be one xsl:output node, so taking the first one only is OK |
399 |
$node = @{$node->findnodes("xsl:output")}[0]; |
400 |
my $outputformat = $node->{"method"} if $node; |
401 |
$outputformat = "txt" if ($outputformat eq "" || $outputformat eq "text"); |
402 |
|
403 |
my %row = ( |
404 |
value => $text, |
405 |
filename => $title, |
406 |
format => $outputformat, |
407 |
); |
408 |
|
409 |
push @tabFiles, \%row; |
410 |
} |
411 |
} |
412 |
return \@tabFiles; |
413 |
} |
414 |
|
415 |
|
355 |
1; |
416 |
1; |
356 |
|
417 |
|
357 |
__END__ |
418 |
__END__ |