Lines 409-414
sub engine {
Link Here
|
409 |
return $engine; |
409 |
return $engine; |
410 |
} |
410 |
} |
411 |
|
411 |
|
|
|
412 |
=head2 CustomXSLTExportList |
413 |
|
414 |
Returns list of file for custom xslt conversion |
415 |
|
416 |
=cut |
417 |
|
418 |
sub CustomXSLTExportList { |
419 |
my $opac = shift; # opac (1) vs intranet (0) |
420 |
return [] if $opac && C4::Context->preference('OpacExportOptions') !~ /custom/; |
421 |
|
422 |
my @tabFiles; |
423 |
|
424 |
my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') . |
425 |
'/' . C4::Context->preference( $opac ? "opacthemes" : "template") . |
426 |
'/' . C4::Languages::getlanguage() . |
427 |
'/xslt/biblioexport'; |
428 |
my @files = glob qq("$dir/*.xsl"); |
429 |
foreach my $file (@files) { |
430 |
if ( -f "$file" ) { |
431 |
(my $text = $file) =~ s/.*\///g; |
432 |
|
433 |
## Get title of the option |
434 |
my $dom; |
435 |
eval { $dom = XML::LibXML->load_xml( location => $file ); }; |
436 |
next unless $dom; |
437 |
|
438 |
my $node = $dom->documentElement(); |
439 |
my $title = $node->{"title"}; |
440 |
($title = $text) =~ s/\.xsl// unless defined $title; |
441 |
|
442 |
# Get output format |
443 |
# There should only be one xsl:output node, so taking the first one only is OK |
444 |
$node = @{$node->findnodes("xsl:output")}[0]; |
445 |
my $outputformat= ""; |
446 |
$outputformat = $node->{"method"} if $node; |
447 |
$outputformat = "txt" if ($outputformat eq "" || $outputformat eq "text"); |
448 |
|
449 |
my %row = ( |
450 |
value => $text, |
451 |
filename => $title, |
452 |
format => $outputformat, |
453 |
); |
454 |
|
455 |
push @tabFiles, \%row; |
456 |
} |
457 |
} |
458 |
return \@tabFiles; |
459 |
} |
412 |
1; |
460 |
1; |
413 |
|
461 |
|
414 |
__END__ |
462 |
__END__ |