Bugzilla – Attachment 12614 Details for
Bug 8732
Add a system preference to allow users to choose to display an icon based on the Koha bibliographic level itemtype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8732: Allowing biblio level itemtypes to display instead of MARC ones
Bug-8732-Allowing-biblio-level-itemtypes-to-displa.patch (text/plain), 18.78 KB, created by
Chris Cormack
on 2012-09-30 21:59:27 UTC
(
hide
)
Description:
Bug 8732: Allowing biblio level itemtypes to display instead of MARC ones
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-09-30 21:59:27 UTC
Size:
18.78 KB
patch
obsolete
>From c9bcef02a0315c41b476d4f92c126ddd45dc6015 Mon Sep 17 00:00:00 2001 >From: Chris Cormack <chrisc@catalyst.net.nz> >Date: Mon, 1 Oct 2012 10:58:06 +1300 >Subject: [PATCH] Bug 8732: Allowing biblio level itemtypes to display instead > of MARC ones > >If you switch BiblioItemtypeImage to Koha, you will see the Koha >itemtypes, if it is Control you will get the ones generated from >the MARC control fields. > >Squashed commit of the following: > >commit a36d5fdbfc484639ae7939f14e0363fda79b9323 >Author: Chris Cormack <chrisc@catalyst.net.nz> >Date: Mon Oct 1 10:56:47 2012 +1300 > > WR96747, Bug 8732 Finishing staff side > >commit feff903c77ffc0fcec9459ecffab6c2ee5b1349d >Author: Chris Cormack <chrisc@catalyst.net.nz> >Date: Mon Oct 1 09:47:07 2012 +1300 > > Bug 8732 : Now working for staff side too > >commit 641be286401cf1be54fddb3cc58a53566d80dcca >Author: Chris Cormack <chrisc@catalyst.net.nz> >Date: Mon Oct 1 09:10:27 2012 +1300 > > Bug 8732 - generalising syspref > > Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> > >commit c4ce95c12a773d84e6f8d0b05664649e170799d8 >Author: Chris Cormack <chrisc@catalyst.net.nz> >Date: Wed Sep 12 09:19:31 2012 +1200 > > Bug 8732 : Showing the images on the OPAC detail page > >commit 105acad0f76628536840577fa96fb0839f9f3e2f >Author: Chris Cormack <chrisc@catalyst.net.nz> >Date: Thu Sep 6 14:19:37 2012 +1200 > > Bug 8732 : Allowing biblio level itemtypes to display instead of MARC ones > > If you switch OpacResultsItemtypeImage to Koha, you will see the Koha > itemtypes, if it is Control you will get the ones generated from the > MARC control fields. >--- > C4/XSLT.pm | 2 +- > catalogue/detail.pl | 4 ++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 +++++ > .../prog/en/modules/admin/preferences/opac.pref | 2 +- > .../en/modules/admin/preferences/searching.pref | 7 +++++ > .../prog/en/modules/catalogue/detail.tt | 28 +++++++++++++++++--- > .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 5 ++-- > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 18 ++++++++++--- > .../opac-tmpl/prog/en/modules/opac-results.tt | 2 +- > .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 3 +++ > .../prog/en/xslt/MARC21slim2OPACResults.xsl | 5 ++++ > opac/opac-detail.pl | 1 + > opac/opac-search.pl | 2 ++ > 14 files changed, 74 insertions(+), 13 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index d17b828..3ad2428 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -188,7 +188,7 @@ sub XSLTParse4Display { > UseAuthoritiesForTracings TraceSubjectSubdivisions > Display856uAsImage OPACDisplay856uAsImage > UseControlNumber IntranetBiblioDefaultView BiblioDefaultView >- singleBranchMode >+ singleBranchMode BiblioItemtypeImage > AlternateHoldingsField AlternateHoldingsSeparator / ) > { > my $sp = C4::Context->preference( $syspref ); >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 7126257..30fc71e 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -364,7 +364,6 @@ if (C4::Context->preference('OPACBaseURL')){ > } > > # Displaying tags >- > my $tag_quantity; > if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) { > $template->param( >@@ -375,4 +374,7 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref > 'sort'=>'-weight', limit=>$tag_quantity})); > } > >+$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); >+ >+ > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index ae2c4ee..a60b3fa 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -384,3 +384,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('AuthDisplayHierarchy','0','Display authority hierarchies','','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidyoumean',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); > INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BiblioItemtypeImage','Control','Control which itemtype info displays for biblio level itemtypes','Control|Koha','Choice'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index b8b4047..6cb2971 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5988,6 +5988,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BiblioItemtypeImage', 'Control','Control what biblio level itemtype image displays','Control|Koha','Choice')"); >+ print "Upgrade to $DBversion done (Add new BiblioItemtypeImage to system preferences)"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index e645785..f1df808 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -520,4 +520,4 @@ OPAC: > choices: > yes: Use > no: "Don't use" >- - "the item collection code when finding items for the shelf browser." >+ - "the item collection code when finding items for the shelf browser." >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index 3128ad6..010059b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -185,3 +185,10 @@ Searching: > - pref: FacetLabelTruncationLength > class: integer > - characters, in OPAC/staff interface. >+ - >+ - "Display " >+ - pref: BiblioItemtypeImage >+ choices: >+ Control: "Itemtype information from the MARC control fields" >+ Koha: "Itemtype information from the Koha biblio level itemtype" >+ >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 22f7908..426b0ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -115,10 +115,22 @@ function verify_images() { > [% END %] > </span> > [% END %] >+ [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] >+ <span class="results_summary itemtype">Itemtype: >+ [% IF ( description ) %] >+ [% description %] >+ [% ELSE %] >+ [% itemtype %] >+ [% END %] >+ </span> >+ [% END %] > [% IF ( holdcount ) %]<span class="results_summary"><span class="label">Holds:</span> <span class="holdcount"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber %]">[% holdcount %]</a></span></span>[% ELSE %][% END %] > > [% IF ( AmazonCoverImages ) %]</div><div class="yui-u" id="bookcoverimg"> >- <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /></a>[% END %] >+ <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="" /></a> >+ [% END %] >+ >+ > [% ELSE %] > > <h3>[% title |html %]</h3> >@@ -247,9 +259,19 @@ function verify_images() { > [% END %] > </ul></li> > [% END %] >- [% IF ( holdcount ) %]<li><strong>Holds:</strong> <span class="holdcount"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber %]">[% holdcount %]</a></span></li>[% ELSE %][% END %] >+ [% IF ( holdcount ) %]<li><strong>Holds:</strong> <span class="holdcount"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber %]">[% holdcount %]</a></span></li>[% ELSE %][% END %] >+ [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] >+ <li><strong>Itemtype: </strong> >+ [% IF ( description ) %] >+ [% description %] >+ [% ELSE %] >+ [% itemtype %] >+ [% END %] >+ </li> >+ [% END %] > </ul> >- [% END %] >+ [% END %] >+ > > </div> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index 2e1754b..8ec7e0d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -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="BiblioItemtypeImage" select="marc:sysprefs/marc:syspref[@name='BiblioItemtypeImage']"/> > <xsl:variable name="TracingQuotesLeft"> > <xsl:choose> > <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when> >@@ -141,7 +142,7 @@ > <!-- Author Statement --> > <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="$BiblioItemtypeImage='Control'"> > <xsl:if test="$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> >@@ -149,7 +150,7 @@ > <xsl:value-of select="$materialTypeLabel"/> > </span> > </xsl:if> >- >+ </xsl:if> > <!--Series: Alternate Graphic Representation (MARC 880) --> > <xsl:if test="$display880"> > <xsl:call-template name="m880Select"> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >index f740488..4949585 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -347,15 +347,15 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > <h1 class="title">[% title |html %][% IF ( subtitle ) %] <span class="subtitle">[% FOREACH subtitl IN subtitle %][% subtitl.subfield |html %] [% END %]</span>[% END %]</h1> > [% IF ( author ) %]<h5 class="author">by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% author |url %]">[% author |html %]</a></h5>[% END %] > >- <span class="results_summary">[% UNLESS ( item_level_itypes ) %] >- [ >+ <span class="results_summary"> >+ [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] > [% IF ( description ) %] > [% description %] > [% ELSE %] > [% itemtype %] > [% END %] >- ] [% END %] >- [% IF ( unititle ) %], [% unititle %][% END %] >+ [% END %] >+ [% IF ( unititle ) %], [% unititle %][% END %] > </span> > > [% IF ( MARCAUTHORS ) %] >@@ -479,6 +479,16 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > [% END %] > [% END %] > >+ [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] >+ <div class="results_summary">Itemtype: >+ [% IF ( description ) %] >+ [% description %] >+ [% ELSE %] >+ [% itemtype %] >+ [% END %] >+ </div> >+ [% END %] >+ > <!-- This puts the LTFL reviews in, and if TabbedView is not set, puts the remaining content above the Tabs instead of in them --> > [% IF ( LibraryThingForLibrariesID ) %] > [% UNLESS ( LibraryThingForLibrariesTabbedView ) %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >index c76f162..07939af 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >@@ -427,7 +427,7 @@ $(document).ready(function(){ > [% IF ( RequestOnOpac ) %][% UNLESS ( SEARCH_RESULT.norequests ) %][% IF ( opacuserlogin ) %]<input type="checkbox" id="bib[% SEARCH_RESULT.biblionumber %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber %]" /> <label for="bib[% SEARCH_RESULT.biblionumber %]"></label>[% END %][% END %][% END %][% END %][% END %]</td> > <td class="select selectcol">[% UNLESS suppress_result_number %][% SEARCH_RESULT.result_number %].[% END %]</td> > >- [% UNLESS ( item_level_itypes ) %] >+ [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] > [% UNLESS ( noItemTypeImages ) %] > > <td class="itypecol"> >diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl >index 7917c0b..d242500 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl >@@ -26,6 +26,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='OPACDisplay856uAsImage']"/> >+ <xsl:variable name="BiblioItemtypeImage" select="marc:sysprefs/marc:syspref[@name='BiblioItemtypeImage']"/> > <xsl:variable name="TracingQuotesLeft"> > <xsl:choose> > <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when> >@@ -149,12 +150,14 @@ > </xsl:choose> > > <xsl:if test="$DisplayOPACiconsXSLT!='0'"> >+ <xsl:if test="$BiblioItemtypeImage='Control'"> > <xsl:if test="$materialTypeCode!=''"> > <span class="results_summary type"><span class="label">Type: </span> > <xsl:element name="img"><xsl:attribute name="src">/opac-tmpl/lib/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt">materialTypeLabel</xsl:attribute><xsl:attribute name="class">materialtype</xsl:attribute></xsl:element> > <xsl:value-of select="$materialTypeLabel"/> > </span> > </xsl:if> >+ </xsl:if> > </xsl:if> > > <!--Series: Alternate Graphic Representation (MARC 880) --> >diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >index 4f0acd3..01f460e 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >@@ -28,6 +28,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="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/> >+ <xsl:variable name="BiblioItemtypeImage" select="marc:sysprefs/marc:syspref[@name='BiblioItemtypeImage']"/> > <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)"/> >@@ -530,6 +531,9 @@ > > <xsl:if test="$DisplayOPACiconsXSLT!='0'"> > <span class="results_summary"> >+ >+ <xsl:if test="$BiblioItemtypeImage='Control'"> >+ > <xsl:if test="$typeOf008!=''"> > <span class="label">Type: </span> > <xsl:choose> >@@ -870,6 +874,7 @@ > </xsl:when> > </xsl:choose> > </xsl:if> >+ </xsl:if> > <xsl:text> </xsl:text> <!-- added blank space to fix font display problem, see Bug 3671 --> > </span> > </xsl:if> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index cdb4a5a..d22da7d 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -964,6 +964,7 @@ my $defaulttab = > @serialcollections > 0 > ? 'serialcollection' : 'subscription'; > $template->param('defaulttab' => $defaulttab); >+$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); > > if (C4::Context->preference('OPACLocalCoverImages') == 1) { > my @images = ListImagesForBiblio($biblionumber); >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index bcdf671..4544fa7 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -3,6 +3,7 @@ > # Copyright 2008 Garry Collum and the Koha Development team > # Copyright 2010 BibLibre > # Copyright 2011 KohaAloha, NZ >+# Copyright 2012 Catalyst IT, NZ > # > # This file is part of Koha. > # >@@ -824,6 +825,7 @@ if (C4::Context->preference('GoogleIndicTransliteration')) { > } > > $template->{VARS}->{DidYouMean} = C4::Context->preference('OPACdidyoumean') =~ m/enable/; >+$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); > > $template->param( borrowernumber => $borrowernumber); > output_with_http_headers $cgi, $cookie, $template->output, $content_type; >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8732
:
12029
|
12047
|
12614
|
12722
|
12870
|
16453
|
16454
|
21820
|
21821
|
53470
|
53471
|
91885
|
92383
|
103488
|
103548
|
106831
|
106836
|
106848
|
106948
|
107705
|
107706
|
107707
|
107709
|
108322
|
108441
|
108764
|
108765
|
108766
|
108767
|
108768
|
108769
|
108770