my ( $searchdesc, $hits, $results_per_page, $offset, $scan, @marcresults ) = @_;
my $dbh = C4::Context->dbh;
my @newresults;
-
#Build branchnames hash
#find branchname
#get branch information.....
}
# XSLT processing of some stuff
+ # FIXME : This needs some work in order to be more flexible : Can not use a result list for intranet different from OPAC
if (C4::Context->preference("XSLTResultsDisplay") && !$scan) {
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display(
- $oldbiblio->{biblionumber}, $marcrecord, 'Results' );
+ $oldbiblio->{biblionumber}, $marcrecord, C4::Context->preference("XSLTResultsDisplay") );
}
# last check for norequest : if itemtype is notforloan, it can't be reserved either, whatever the items
use Encode;
use XML::LibXML;
use XML::LibXSLT;
+use LWP::Simple;
use strict;
@ISA = qw(Exporter);
@EXPORT = qw(
&XSLTParse4Display
+ &GetURI
);
}
=head1 FUNCTIONS
+=head1 GetURI
+
+=head2 GetURI file and returns the xslt as a string
+
+=cut
+
+sub GetURI {
+ my ($uri) = @_;
+ my $string;
+ $string = get $uri ;
+ return $string;
+}
+
=head1 transformMARCXML4XSLT
=head2 replaces codes with authorized values in a MARC::Record object
my $stylesheet;
sub XSLTParse4Display {
- my ( $biblionumber, $orig_record, $xsl_suffix ) = @_;
+ my ( $biblionumber, $orig_record, $xslfilename ) = @_;
# grab the XML, run it through our stylesheet, push it out to the browser
my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
#return $record->as_formatted();
# don't die when you find &, >, etc
$parser->recover_silently(1);
my $source = $parser->parse_string($xmlrecord);
- unless ( $stylesheet ) {
+ unless ( $stylesheet->{$xslfilename} ) {
my $xslt = XML::LibXSLT->new();
- my $xslfile = C4::Context->config('opachtdocs') .
- "/prog/en/xslt/" .
- C4::Context->preference('marcflavour') .
- "slim2OPAC$xsl_suffix.xsl";
- my $style_doc = $parser->parse_file($xslfile);
- $stylesheet = $xslt->parse_stylesheet($style_doc);
+ my $style_doc;
+ if ($xslfilename=~/http:/){
+ my $xsltstring=GetURI($xslfilename);
+ $style_doc = $parser->parse_string($xsltstring);
+ }
+ else {
+ use Cwd;
+ warn getcwd;
+ $style_doc = $parser->parse_file($xslfilename);
+ }
+ $stylesheet->{$xslfilename} = $xslt->parse_stylesheet($style_doc);
}
- my $results = $stylesheet->transform($source);
- my $newxmlrecord = $stylesheet->output_string($results);
+ my $results = $stylesheet->{$xslfilename}->transform($source);
+ my $newxmlrecord = $stylesheet->{$xslfilename}->output_string($results);
return $newxmlrecord;
}
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OPACShelfBrowser','1','','Enable/disable Shelf Browser on item details page. WARNING: this feature is very resource consuming on collections with large numbers of items.','YesNo');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
-('XSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on OPAC WARNING: MARC21 Only','YesNo'),
-('XSLTResultsDisplay','0','','Enable XSL stylesheet control over results page display on OPAC WARNING: MARC21 Only','YesNo');
+('XSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on OPAC exemple : ../koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl','Textarea'),
+('XSLTResultsDisplay','0','','Enable XSL stylesheet control over results page display on OPAC exemple : ../koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl','Textarea');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
('TagsShowOnList', '6','','Nombre de tags à afficher sur la page de résultat, 0 désactivant l''affichage.','Integer');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OPACShelfBrowser','1','','Active le parcours des rayonnages sur la page de détail','YesNo');
-INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('XSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on OPAC WARNING: MARC21 Only','YesNo');
-INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('XSLTResultsDisplay','0','','Permet l''utilisation de Feuilles de style XSLT pour l''affichage des listes de résultat (MARC21)','YesNo');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('XSLTDetailsDisplay','0','','Permet l''utilisation de feuilles de style XSLT pour l''affichage détaillé de notice exemple : ../koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl','Textarea');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('XSLTResultsDisplay','0','','Permet l''utilisation de Feuilles de style XSLT pour l''affichage des listes de résultat exemple : ../koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl','Textarea');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Détermine quel index utiliser lors des recherches par type de document','Choice');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Permet la réservation d''exemplaires non disponibles', 'YesNo');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Permet les réservations sur des exemplaires endommagés', 'YesNo');
SetVersion ($DBversion);
}
+$DBversion = "3.00.06.003";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("UPDATE systempreferences set value='../koha-tmpl/opac-tmpl/prog/en/xslt/".C4::Context->preference('marcflavour')."slim2OPACDetail.xsl' where variable='XSLTDetailsDisplay' AND value=1;");
+ $dbh->do("UPDATE systempreferences set value='../koha-tmpl/opac-tmpl/prog/en/xslt/".C4::Context->preference('marcflavour')."slim2OPACResults.xsl' where variable='XSLTResultsDisplay' AND value=1;");
+ print "Upgrade to $DBversion done (Improve XSLT)\n";
+ SetVersion ($DBversion);
+}
+
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
use strict;
sub kohaversion {
- our $VERSION = '3.00.05.003';
+ our $VERSION = '3.00.06.003';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
# XSLT processing of some stuff
if (C4::Context->preference("XSLTDetailsDisplay") ) {
$template->param(
- 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail') );
+ 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, C4::Context->preference("XSLTDetailsDisplay")) );
}
# change back when ive fixed request.pl