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