Lines 34-39
use Koha::ItemTypes;
Link Here
|
34 |
use Koha::XSLT::Base; |
34 |
use Koha::XSLT::Base; |
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::Base->new( { do_not_return_source => 1 } ); |
55 |
$engine=Koha::XSLT::Base->new( { do_not_return_source => 1 } ); |
53 |
} |
56 |
} |
Lines 190-202
sub get_xslt_sysprefs {
Link Here
|
190 |
} |
193 |
} |
191 |
|
194 |
|
192 |
sub XSLTParse4Display { |
195 |
sub XSLTParse4Display { |
193 |
my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables ) = @_; |
196 |
my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang , $opac) = @_; |
194 |
|
197 |
|
195 |
$sysxml ||= C4::Context->preference($xslsyspref); |
198 |
$sysxml ||= C4::Context->preference($xslsyspref); |
196 |
$xslfilename ||= C4::Context->preference($xslsyspref); |
199 |
$xslfilename ||= C4::Context->preference($xslsyspref); |
197 |
$lang ||= C4::Languages::getlanguage(); |
200 |
$lang ||= C4::Languages::getlanguage(); |
198 |
|
201 |
|
199 |
if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) { |
202 |
if ($xslsyspref eq "XSLTCustomExport") { |
|
|
203 |
my $dir; |
204 |
if ($opac) { |
205 |
$dir = C4::Context->config('opachtdocs') . |
206 |
'/' . C4::Context->preference("opacthemes") . |
207 |
'/' . C4::Languages::getlanguage() . |
208 |
'/xslt/biblioexport'; |
209 |
} else { |
210 |
$dir = C4::Context->config('intrahtdocs') . |
211 |
'/' . C4::Context->preference("template") . |
212 |
'/' . C4::Languages::getlanguage() . |
213 |
'/xslt/biblioexport'; |
214 |
} |
215 |
$xslfilename = $dir . "/" . $xslfilename; |
216 |
} elsif( $xslfilename =~ /^\s*"?default"?\s*$/i ) { |
200 |
my $htdocs; |
217 |
my $htdocs; |
201 |
my $theme; |
218 |
my $theme; |
202 |
my $xslfile; |
219 |
my $xslfile; |
Lines 387-392
sub engine {
Link Here
|
387 |
return $engine; |
404 |
return $engine; |
388 |
} |
405 |
} |
389 |
|
406 |
|
|
|
407 |
=head2 CustomXSLTExportList |
408 |
|
409 |
Returns list of file for custom xslt conversion |
410 |
|
411 |
=cut |
412 |
|
413 |
sub CustomXSLTExportList { |
414 |
my $opac = shift; # opac (1) vs intranet (0) |
415 |
my @tabFiles; |
416 |
|
417 |
my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') . |
418 |
'/' . C4::Context->preference( $opac ? "opacthemes" : "template") . |
419 |
'/' . C4::Languages::getlanguage() . |
420 |
'/xslt/biblioexport'; |
421 |
my @files = <$dir/*.xsl>; |
422 |
foreach my $file (@files) { |
423 |
if ( -f "$file" ) { |
424 |
(my $text = $file) =~ s/.*\///g; |
425 |
|
426 |
## Get title of the option |
427 |
my $dom = XML::LibXML->load_xml( location => $file ); |
428 |
my $node = $dom->documentElement(); |
429 |
my $title = $node->{"title"}; |
430 |
($title = $text) =~ s/\.xsl// unless defined $title; |
431 |
|
432 |
# Get output format |
433 |
# There should only be one xsl:output node, so taking the first one only is OK |
434 |
$node = @{$node->findnodes("xsl:output")}[0]; |
435 |
my $outputformat = $node->{"method"} if $node; |
436 |
$outputformat = "txt" if ($outputformat eq "" || $outputformat eq "text"); |
437 |
|
438 |
my %row = ( |
439 |
value => $text, |
440 |
filename => $title, |
441 |
format => $outputformat, |
442 |
); |
443 |
|
444 |
push @tabFiles, \%row; |
445 |
} |
446 |
} |
447 |
return \@tabFiles; |
448 |
} |
449 |
|
450 |
|
390 |
1; |
451 |
1; |
391 |
|
452 |
|
392 |
__END__ |
453 |
__END__ |