From 486a9496defc2955c8c57382c6e7b66805aeebab Mon Sep 17 00:00:00 2001 From: Jane Wagner Date: Sun, 23 Aug 2009 15:58:55 -0400 Subject: [PATCH] Bug 3098, Bug 3108, Bug 3545 -- Make MARC21 XSLT obey sysprefs in OPAC MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The MARC21slim2OPACDetail.xsl and MARC21slim2OPACResults.xsl XSLT stylesheets do not obey any of the OPAC sysprefs, OPACURLOpenInNewWindow, URLLinkText, or a new one added for Bug 3545, DisplayOPACiconsXSLT. Modified C4/XSLT.pm based on code written by Fréric Demians (thanks!) to pass the values of the sysprefs to the .xsl files. Modified the .xsl files to implement them. If the respective sysprefs are set, the OPAC results and display pages will/will not display the format/material type/audience icons, will/will not open URLs in new browser windows, and will/will not use the text entered in URLLinkText as generic link text when there is no value in the 856 subfield y, 3, or z. (Note that if subfields y, 3, or z do contain text, the first match is what will be displayed.) Signed-off-by: Galen Charlton --- C4/XSLT.pm | 9 +++ admin/systempreferences.pl | 1 + .../data/mysql/en/mandatory/sysprefs.sql | 3 +- .../unimarc_standard_systemprefs.sql | 1 + .../mandatory/system_preferences_optimal.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 +++ .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 70 ++++++++++++++----- .../prog/en/xslt/MARC21slim2OPACResults.xsl | 47 ++++++++++--- 8 files changed, 113 insertions(+), 27 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 76e7ea7bfb..f230c2cba1 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -125,6 +125,15 @@ sub XSLTParse4Display { my $itemsxml = buildKohaItemsNamespace($biblionumber); my $xmlrecord = $record->as_xml(); $xmlrecord =~ s/\<\/record\>/$itemsxml\<\/record\>/; + my $sysxml = "\n"; + foreach my $syspref ( qw/OPACURLOpenInNewWindow DisplayOPACiconsXSLT URLLinkText/ ) { + $sysxml .= "" . + C4::Context->preference( $syspref ) . + "\n"; + } + $sysxml .= "\n"; + $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/; + my $parser = XML::LibXML->new(); # don't die when you find &, >, etc $parser->recover_silently(1); diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 95c4b8aa08..fdaaee764d 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -320,6 +320,7 @@ $tabsysprefs{OPACDisplayRequestPriority} = "OPAC"; $tabsysprefs{OPACAllowHoldDateInFuture} = "OPAC"; $tabsysprefs{OPACPatronDetails} = "OPAC"; $tabsysprefs{OPACFinesTab} = "OPAC"; +$tabsysprefs{DisplayOPACiconsXSLT} = "OPAC"; # OPAC $tabsysprefs{SearchMyLibraryFirst} = "OPAC"; diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index ab88869c9f..06fe04c681 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -258,4 +258,5 @@ INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanatio INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'If this is switched on, patron''s cardnumber will be shown instead of their name on the holds and catalog screens', 'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACSearchForTitleIn','
  • Other Libraries (WorldCat)
  • \n
  • Other Databases (Google Scholar)
  • \n
  • Online Stores (Bookfinder.com)
  • ','Enter the HTML that will appear in the \'Search for this title in\' box on the detail page in the OPAC. Enter {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the URL. Leave blank to disable \'More Searches\' menu.','70|10','Textarea'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACPatronDetails','1','If OFF the patron details tab in the OPAC is disabled.','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFinesTab','1','If OFF the patron fines tab in the OPAC is disabled.','','YesNo'); \ No newline at end of file +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFinesTab','1','If OFF the patron fines tab in the OPAC is disabled.','','YesNo'); +INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo'); diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql index 9c6886aa8f..2a53a23f8e 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -258,3 +258,4 @@ INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanatio INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'ReturnToShelvingCart', '0', '', 'Si défini, quand un exemplaire est renvoyé son code sera modifié pour CART.' 'YesNo'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ('DisplayClearScreenButton', '0', '', 'Cette option ajoute un bouton à la page de circulation pour effacer l\'écran', 'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'Active l''affichage du numéro des adhérents à la place de leur nom dans les pages de réservation et du catalogue.', 'YesNo'); +INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'Si activé, affiche le format, le type de public et les icônes de type en XSLT (MARC21)).', 'YesNo'); diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql index da8b9062a7..61318c0ca5 100644 --- a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql +++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql @@ -237,3 +237,4 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MergeAuthoritiesOnUpdate', '1', 'if ON, Updating authorities will automatically updates biblios',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowNotForLoanOverride', '0', 'if ON, enables the librarian to choose when they want to check out a notForLoan regular item',NULL,'YesNo'); +INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 6d648dd144..f0e5bfa77d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2644,6 +2644,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { print "Upgrade to $DBversion done (Added primary keys to language tables)\n"; } +$DBversion = '3.01.00.042'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo')"); + SetVersion ($DBversion); + print "Upgrade to $DBversion done (added DisplayOPACiconsXSLT sysprefs)\n"; +} + + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index fe108e8603..351bd50b96 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -16,6 +16,9 @@ + + + @@ -157,13 +160,14 @@ Card View (ISBD) - + Type: /opac-tmpl/prog/famfamfam/.png + @@ -395,23 +399,53 @@ Online Resources: - - - - - y3z - - - - Click here to access online - - - - - - | - - + + + + + + y3z + + + + + + + + + Click here to access online + + + + + + + + + + + + y3z + + + + + + + + + Click here to access online + + + + + + + + + | + + diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl index 6b1b823abd..84f47146ad 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -18,6 +18,9 @@ + + + @@ -483,6 +486,7 @@ + Type: @@ -819,6 +823,7 @@ + @@ -860,7 +865,6 @@ - @@ -868,9 +872,29 @@ - - - + + + + + + y3z + + + + + + + + + Click here to access online + + + + + + + + @@ -878,19 +902,26 @@ - Click here to access online + + + + + + Click here to access online + + + - + | - - + No copies available -- 2.39.5