Bug 9403: Material type icons not showing for XSLT default view in intranet
authorKatrin Fischer <katrin.fischer@bsz-bw.de>
Thu, 17 Jan 2013 16:49:08 +0000 (17:49 +0100)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 21 Mar 2013 16:00:38 +0000 (12:00 -0400)
Implements the material type icons shown in the MARC21 XSLT result list
of the OPAC for the intrant result list.

Also adds the system preference DisplayIconsXSLT as an intranet analogue
for the OPAC system preference DisplayOPACiconsXSLT and corrects the
descriptions of both preferences in the syspref editor.

To test:
0) Run database update to add new system preference
1) Activate default XSLTResultsDisplay
2) Check the new system preference DisplayIconsXSLT shows up correctly
  and is activated by default. Compare descriptions between DisplayIconsXSLT
  and DisplayOPACiconsXSLT.
3) Check the intranet result list for icons showing up after 'Type:' and
  before the corresponding description. Detail pages should be showing
  the 'Type:' as before.
4) Turn off DisplayIconsXSLT.
5) Check the line containing 'Type:', format and audience information is now
  hidden from the result list.
6) Check that the 'Type:'line is also hidden from the detail page.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
17 files changed:
C4/XSLT.pm
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book_link.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book_open.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/computer_link.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/film.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/map.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/music.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/newspaper.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/report_disk.png [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/sound.png [new file with mode: 0644]

index 76a424b..139ddd2 100644 (file)
@@ -188,7 +188,7 @@ sub XSLTParse4Display {
                               UseAuthoritiesForTracings TraceSubjectSubdivisions
                               Display856uAsImage OPACDisplay856uAsImage 
                               UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
-                              singleBranchMode OPACItemLocation
+                              singleBranchMode OPACItemLocation DisplayIconsXSLT
                               AlternateHoldingsField AlternateHoldingsSeparator
                               TrackClicks / )
     {
index 24ed0b1..2408425 100644 (file)
@@ -272,7 +272,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACMySummaryHTML','','Enter the HTML that will appear in a column on the \'my summary\' and \'my reading history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','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');
-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');
+INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages in the OPAC.', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'If ON, displays patron image when a patron uses web-based self-checkout', '', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnableOpacSearchHistory', '1', 'Enable or disable opac search history', 'YesNo','');
@@ -420,3 +420,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UNIMARCAuthorsFacetsSeparator',', ', 'UNIMARC authors facets separator', NULL, 'short');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','1','Enable or disable the ability to use Koha Plugins.','','YesNo');
 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('TimeFormat','24hr','12hr|24hr','Defines the global time format for visual output.','Choice');
+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('DisplayIconsXSLT', '1', '', 'If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages.', 'YesNo');
index 8ce6a00..950cb17 100755 (executable)
@@ -6556,6 +6556,12 @@ if ( CheckVersion($DBversion) ) {
     print "Upgrade to $DBversion done (Bug 9827 - Remove 'insecure' system preference)\n";
     SetVersion($DBversion);
 }
+$DBversion = "3.11.00.XXX";
+if ( CheckVersion($DBversion) ) {
+   $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('DisplayIconsXSLT', '1', '', 'If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages.', 'YesNo');");
+   print "Upgrade to $DBversion done (Bug 9403: Add DisplayIconsXSLT)\n";
+   SetVersion ($DBversion);
+}
 
 $DBversion = "3.11.00.104";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
index c7b0414..10bdac5 100644 (file)
@@ -66,12 +66,11 @@ OPAC:
               class: file
             - '<br />Options:<ul><li><a href="#" class="set_syspref" data-syspref="OPACXSLTDetailsDisplay" data-value="">Leave empty</a> for "no xslt"</li><li>enter "<a href="#" class="set_syspref" data-syspref="OPACXSLTDetailsDisplay" data-value="default">default</a>" for the default one</li><li>put a path to define a xslt file</li><li>put an URL for an external specific stylesheet.</li></ul>{langcode} will be replaced with current interface language'
         -
-            - On pages displayed with XSLT stylesheets on the OPAC,
             - pref: DisplayOPACiconsXSLT
               choices:
-                  yes: show
-                  no: "don't show"
-            - icons for itemtype and authorized values.
+                  yes: Show
+                  no: "Don't show"
+            - the format, audience, and material type icons in XSLT MARC21 results and detail pages in the OPAC.
         -
             - pref: COinSinOPACResults
               choices:
index d9fc21a..9754a47 100644 (file)
@@ -65,6 +65,12 @@ Staff Client:
             - pref: XSLTDetailsDisplay
               class: file
             - '<br />Options:<ul><li><a href="#" class="set_syspref" data-syspref="XSLTDetailsDisplay" data-value="">Leave empty</a> for "no xslt"</li><li>enter "<a href="#" class="set_syspref" data-syspref="XSLTDetailsDisplay" data-value="default">default</a>" for the default one</li><li>put a path to define a xslt file</li><li>put an URL for an external specific stylesheet.</li></ul>{langcode} will be replaced with current interface language'
+        -
+            - pref: DisplayIconsXSLT
+              choices:
+                  yes: Show
+                  no: "Don't show"
+            - the format, audience, and material type icons in XSLT MARC21 results and detail pages in the staff client.
         -
             - Use the Yahoo UI libraries
             - pref: yuipath
index 1ce9d00..aeaa797 100644 (file)
@@ -25,6 +25,7 @@
         <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
         <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
+        <xsl:variable name="DisplayIconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayIconsXSLT']"/>
         <xsl:variable name="TracingQuotesLeft">
            <xsl:choose>
              <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
         <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
         <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
 
-   <xsl:if test="$materialTypeCode!=''">
+    <xsl:if test="$DisplayIconsXSLT!='0' and $materialTypeCode!=''">
         <span class="results_summary type"><span class="label">Type: </span>
         <xsl:element name="img"><xsl:attribute name="src">/intranet-tmpl/prog/img/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt"></xsl:attribute></xsl:element>
         <xsl:text> </xsl:text>
         <xsl:value-of select="$materialTypeLabel"/>
         </span>
-   </xsl:if>
+    </xsl:if>
+
 
         <!--Series: Alternate Graphic Representation (MARC 880) -->
         <xsl:if test="$display880">
index ca517cd..eb24665 100644 (file)
@@ -26,6 +26,7 @@
         <xsl:variable name="AlternateHoldingsSubfields" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 4)"/>
         <xsl:variable name="AlternateHoldingsSeparator" select="marc:sysprefs/marc:syspref[@name='AlternateHoldingsSeparator']"/>
         <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
+        <xsl:variable name="DisplayIconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayIconsXSLT']"/>
         <xsl:variable name="leader" select="marc:leader"/>
         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
         </xsl:for-each>
     </xsl:if>
 
+<xsl:if test="$DisplayIconsXSLT!='0'">
     <span class="results_summary">
     <xsl:if test="$typeOf008!=''">
         <span class="label">Type: </span>
             <xsl:choose>
-                <xsl:when test="$leader19='a'"> Set</xsl:when>
+                <xsl:when test="$leader19='a'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/book_link.png" alt="book" title="book" class="materialtype"/> Set</xsl:when>
                 <xsl:when test="$leader6='a'">
                     <xsl:choose>
-                        <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'"> Book</xsl:when>
-                        <xsl:when test="$leader7='i' or $leader7='s'"> Continuing Resource</xsl:when>
-                        <xsl:when test="$leader7='a' or $leader7='b'"> Article</xsl:when>
+                        <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/book.png" alt="book" title="book" class="materialtype"/> Book</xsl:when>
+                        <xsl:when test="$leader7='i' or $leader7='s'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/newspaper.png" alt="serial" title="serial" class="materialtype"/> Continuing Resource</xsl:when>
+                        <xsl:when test="$leader7='a' or $leader7='b'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/book_open.png" alt="article" title="article" class="materialtype"/> Article</xsl:when>
                     </xsl:choose>
                 </xsl:when>
-                <xsl:when test="$leader6='t'"> Book</xsl:when>
-               <xsl:when test="$leader6='o'"> Kit</xsl:when>
-               <xsl:when test="$leader6='p'"> Mixed Materials</xsl:when>
-                <xsl:when test="$leader6='m'"> Computer File</xsl:when>
-                <xsl:when test="$leader6='e' or $leader6='f'"> Map</xsl:when>
-                <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'"> Visual Material</xsl:when>
-                <xsl:when test="$leader6='c' or $leader6='d'"> Score</xsl:when>
-                <xsl:when test="$leader6='i'"> Sound</xsl:when>
-                <xsl:when test="$leader6='j'"> Music</xsl:when>
+                <xsl:when test="$leader6='t'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/book.png" alt="book" title="book" class="materialtype"/> Book</xsl:when>
+                <xsl:when test="$leader6='o'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/report_disk.png" alt="kit" title="kit" class="materialtype"/> Kit</xsl:when>
+                <xsl:when test="$leader6='p'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/report_disk.png" alt="mixed materials" title="mixed materials" class="materialtype"/>Mixed Materials</xsl:when>
+                <xsl:when test="$leader6='m'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/computer_link.png" alt="computer file" title="computer file" class="materialtype"/> Computer File</xsl:when>
+                <xsl:when test="$leader6='e' or $leader6='f'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/map.png" alt="map" title="map" class="materialtype"/> Map</xsl:when>
+                <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/film.png" alt="visual material" title="visual material" class="materialtype"/> Visual Material</xsl:when>
+                <xsl:when test="$leader6='c' or $leader6='d'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/music.png" alt="score" title="score" class="materialtype"/> Score</xsl:when>
+                <xsl:when test="$leader6='i'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/sound.png" alt="sound" title="sound" class="materialtype"/> Sound</xsl:when>
+                <xsl:when test="$leader6='j'"><img src="/intranet-tmpl/prog/img/famfamfam/silk/sound.png" alt="music" title="music" class="materialtype"/> Music</xsl:when>
             </xsl:choose>
     </xsl:if>
+
     <xsl:if test="string-length(normalize-space($physicalDescription))">
         <span class="label">; Format: </span><xsl:copy-of select="$physicalDescription"></xsl:copy-of>
     </xsl:if>
     </xsl:if>
 <xsl:text> </xsl:text> <!-- added blank space to fix font display problem, see Bug 3671 -->
        </span>
+</xsl:if> <!-- DisplayIconsXSLT -->
 
     <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
     <xsl:if test="$display880">
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book.png
new file mode 100644 (file)
index 0000000..b0f4dd7
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book_link.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book_link.png
new file mode 100644 (file)
index 0000000..dd0820e
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book_link.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book_open.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book_open.png
new file mode 100644 (file)
index 0000000..7d863f9
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/book_open.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/computer_link.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/computer_link.png
new file mode 100644 (file)
index 0000000..3859db2
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/computer_link.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/film.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/film.png
new file mode 100644 (file)
index 0000000..b0ce7bb
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/film.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/map.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/map.png
new file mode 100644 (file)
index 0000000..f90ef25
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/map.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/music.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/music.png
new file mode 100644 (file)
index 0000000..a8b3ede
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/music.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/newspaper.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/newspaper.png
new file mode 100644 (file)
index 0000000..6a2ecce
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/newspaper.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/report_disk.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/report_disk.png
new file mode 100644 (file)
index 0000000..1c856cd
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/report_disk.png differ
diff --git a/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/sound.png b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/sound.png
new file mode 100644 (file)
index 0000000..6056d23
Binary files /dev/null and b/koha-tmpl/intranet-tmpl/prog/img/famfamfam/silk/sound.png differ