Adding XSLTreultsFilename and XSLTDetailFilename

Thos two system preferences enables the librarian to choose an xslt different from the one provided in Koha
This commit is contained in:
Henri-Damien LAURENT 2010-05-15 01:28:46 +02:00
parent 0da6477377
commit 758bfba1ee
7 changed files with 35 additions and 8 deletions

View File

@ -1676,7 +1676,7 @@ sub searchResults {
# XSLT processing of some stuff
if (C4::Context->preference("XSLTResultsDisplay") && !$scan) {
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display(
$oldbiblio->{biblionumber}, $marcrecord, C4::Context->preference("XSLTResultsDisplay") );
$oldbiblio->{biblionumber}, $marcrecord, 'Results' );
}
# last check for norequest : if itemtype is notforloan, it can't be reserved either, whatever the items

View File

@ -133,7 +133,8 @@ sub getAuthorisedValues4MARCSubfields {
my $stylesheet;
sub XSLTParse4Display {
my ( $biblionumber, $orig_record, $xslfilename ) = @_;
my ( $biblionumber, $orig_record, $type ) = @_;
my $xslfilename=C4::Context->preference("XSLT$type"."Filename")||_buildfilename($type);
# grab the XML, run it through our stylesheet, push it out to the browser
my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
#return $record->as_formatted();
@ -174,6 +175,15 @@ sub XSLTParse4Display {
return $newxmlrecord;
}
sub _buildfilename{
my $type=shift;
return C4::Context->config('opachtdocs') .
"/prog/en/xslt/" .
C4::Context->preference('marcflavour') .
"slim2OPAC$type.xsl";
}
sub buildKohaItemsNamespace {
my ($biblionumber) = @_;
my @items = C4::Items::GetItemsInfo($biblionumber);

View File

@ -204,8 +204,11 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
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 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');
('XSLTDetailsDisplay','0','','Enable XSL stylesheet control over details page display on OPAC','YesNo'),
('XSLTResultsDisplay','0','','Enable XSL stylesheet control over results page display on OPAC','YesNo');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
('XSLTDetailFilename','','','Enable XSL stylesheet control over details page display on OPAC exemple : ../koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl','Textarea'),
('XSLTResultsFilename','','','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');

View File

@ -206,8 +206,11 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
('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','','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
('XSLTDetailsDisplay','0','','Active l''affichage détaillé OPAC par la feuille de style XSL stylesheet','YesNo'),
('XSLTResultsDisplay','0','','Active l''affichage liste de résultat OPAC par la feuille de style XSLT','YesNo');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('XSLTDetailFilename','','','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('XSLTResultsFilename','','','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');

View File

@ -757,6 +757,17 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
$DBversion = "3.00.06.010";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("INSERT systempreferences set value='../koha-tmpl/opac-tmpl/prog/en/xslt/".C4::Context->preference('marcflavour')."slim2OPACDetails.xsl',type='Free', variable='XSLTDetailsFilename' ;");
$dbh->do("INSERT systempreferences set value='../koha-tmpl/opac-tmpl/prog/en/xslt/".C4::Context->preference('marcflavour')."slim2OPACResults.xsl',type='Free', variable='XSLTResultsFilename' ;");
$dbh->do("UPDATE systempreferences set value=(LENGTH(value)>0),type='YesNo' where variable='XSLTDetailsDisplay';");
$dbh->do("UPDATE systempreferences set value=(LENGTH(value)>0),type='YesNo' where variable='XSLTResultsDisplay';");
print "Upgrade to $DBversion done (Improvements to XSLT Support)\n";
SetVersion ($DBversion);
}
=item DropAllForeignKeys($table)

View File

@ -10,7 +10,7 @@
use strict;
sub kohaversion {
our $VERSION = '3.00.06.009';
our $VERSION = '3.00.06.010';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install

View File

@ -71,7 +71,7 @@ $template->param( biblionumber => $biblionumber );
# XSLT processing of some stuff
if (C4::Context->preference("XSLTDetailsDisplay") ) {
$template->param(
'XSLTBloc' => XSLTParse4Display($biblionumber, $record, C4::Context->preference("XSLTDetailsDisplay")) );
'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail') );
}
# change back when ive fixed request.pl