Bugzilla – Attachment 3345 Details for
Bug 5888
opac-detail subject/author links improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch from BibLibre
0001-Bug-5888-opac-detail.pl-adding-of-search-rebound-on-.patch (text/plain), 17.60 KB, created by
Julian Maurice
on 2011-03-17 15:42:26 UTC
(
hide
)
Description:
Patch from BibLibre
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2011-03-17 15:42:26 UTC
Size:
17.60 KB
patch
obsolete
>From dca93d5fc463963355832dba0401875f579494e9 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Mon, 12 Apr 2010 14:02:43 +0200 >Subject: [PATCH] Bug 5888: opac-detail.pl: adding of search rebound on author and subject > >BibLibre bug #2990 >--- > admin/systempreferences.pl | 3 +- > installer/data/mysql/en/mandatory/sysprefs.sql | 2 + > installer/data/mysql/updatedatabase.pl | 11 ++ > .../prog/en/modules/admin/preferences/opac.pref | 6 + > koha-tmpl/opac-tmpl/prog/en/css/opac.css | 30 ++++ > .../opac-tmpl/prog/en/modules/opac-detail.tmpl | 139 ++++++++++++++++++-- > opac/opac-detail.pl | 33 +++++ > 7 files changed, 214 insertions(+), 10 deletions(-) > >diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl >index b33c7ec..32e2d19 100755 >--- a/admin/systempreferences.pl >+++ b/admin/systempreferences.pl >@@ -379,7 +379,8 @@ $tabsysprefs{OPACItemHolds} = "OPAC"; > $tabsysprefs{OPACGroupResults} = "OPAC"; > $tabsysprefs{XSLTDetailsDisplay} = "OPAC"; > $tabsysprefs{XSLTResultsDisplay} = "OPAC"; >-$tabsysprefs{OPACShowCheckoutName} = "OPAC"; >+$tabsysprefs{OPACShowCheckoutName} = "OPAC"; >+$tabsysprefs{OPACSearchReboundBy} = "OPAC"; > > # Serials > $tabsysprefs{RoutingListAddReserves} = "Serials"; >diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql >index 6d382c7..174f2cc 100644 >--- a/installer/data/mysql/en/mandatory/sysprefs.sql >+++ b/installer/data/mysql/en/mandatory/sysprefs.sql >@@ -292,3 +292,5 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match complete subfields.','0','YesNo'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for subject tracings instead of heading strings.','0','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( 'OPACSearchReboundBy', 'term', 'term|authority', 'determines if the rebound search use authority number or term.', 'Choice' ); >+ >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 66e9828..80d166b 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4090,6 +4090,17 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = 'XXX'; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do(q{ >+ INSERT INTO systempreferences (variable,value,explanation,options,type) >+ VALUES ('OPACSearchReboundBy', 'term', 'determines if the search rebound use authority number or term.','term|authority','Choice'); >+}); >+ print "Upgrade to $DBversion done. (Add a new system preference OPACSearchReboundBy)\n"; >+ SetVersion ($DBversion); >+} >+ >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($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 3014e63..ececdd4 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 >@@ -225,6 +225,12 @@ OPAC: > yes: Allow > no: "Don't allow" > - patrons to place holds on items from the OPAC. >+ - >+ - Do search rebound on >+ - pref: OPACSearchReboundBy >+ choices: >+ authority: Authority >+ term: Term > Policy: > - > - pref: singleBranchMode >diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css >index 83b54ea..bdbd98e 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css >+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css >@@ -1956,6 +1956,36 @@ a.p1:active { > div.ft { > clear : both; > } >+ >+.authorSearch { >+ position: absolute; >+ display: none; >+ z-index: 2; >+ background-color: white; >+ border: 1px solid black; >+ padding: 4px; >+} >+.authorSearch li { >+ list-style-type: none; >+} >+.authorSearch ul { >+ padding-left: 0px; >+} >+.subjectSearch { >+ position: absolute; >+ display: none; >+ z-index: 2; >+ background-color: white; >+ border: 1px solid black; >+ padding: 4px; >+} >+.subjectSearch li { >+ list-style-type: none; >+} >+.subjectSearch ul { >+ padding-left: 0px; >+} >+ > #basket td ul li { > font-size:90%; > list-style:disc outside url("../../images/item-bullet.gif"); >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl >index 468e90f..2d67a83 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl >@@ -44,6 +44,95 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > > //]]> > </script> >+<script type="text/JavaScript" language="JavaScript"> >+ function showAuthors(element, value){ >+ check("#authorsList", value); >+ makeAuthorRequest(); >+ var left = element.offsetLeft || 0; >+ var top = element.offsetTop || 0; >+ $('.authorSearch').css('display', 'block'); >+ $('.authorSearch').css('left', left); >+ $('.authorSearch').css('top', top + 15); >+ } >+ >+ function hideMenu(elem) { >+ $(elem).css('display', 'none'); >+ } >+ >+ function check(elem, value) { >+ $(elem).find("li").each(function (){ >+ if ($(this).find("input").val() == value) { $(this).find("input").attr("checked", "true"); } >+ else { $(this).find("input").attr("checked", ""); } >+ }); >+ } >+ >+ function checkAll(elem) { >+ var check = ""; >+ if ($(elem).find("li:first").find("input").attr("checked")){ check = true; } >+ $(elem).find("li").not(":first").each(function (){ >+ $(this).find("input").attr("checked", check); >+ }); >+ elem == "#authorsList" ? makeAuthorRequest() : makeSubjectRequest(); >+ } >+ >+ function makeAuthorRequest(){ >+ var request = "/cgi-bin/koha/opac-search.pl?q="; >+ var alreadyFound = false; >+ $("#authorsList").find("li").each(function (){ >+ if ($(this).find("input").attr("checked") && $(this).find("input").attr("name") == "checkbox") { >+ value = $(this).find("input").val(); >+ if (alreadyFound){ request += " and " + value; } >+ else { >+ request += value; >+ alreadyFound = true; >+ } >+ } >+ }); >+ if (alreadyFound) { >+ $("#validAuthorSearch").attr("href", request); >+ }else { >+ $("#validAuthorSearch").removeAttr("href"); >+ } >+ >+ } >+ //Subjects >+ function showSubjects(element, value, code){ >+ $("#subjectsList").find("li").each(function (){ >+ $(this).find("input").attr("checked", ""); >+ }); >+ $("#subjectsList").find("li").each(function (){ >+ if ($(this).find("input").val() == value && $(this).find("input").attr("code") == code) { >+ $(this).find("input").attr("checked", "true"); >+ var elem = this; >+ while ($(elem).prev("li").children().attr("id") == "checkbox") { >+ $(elem).prev("li").find("input").attr("checked", "true"); >+ elem = $(elem).prev("li"); >+ } >+ } >+ }); >+ makeSubjectRequest(); >+ var left = element.offsetLeft || 0; >+ var top = element.offsetTop || 0; >+ $('.subjectSearch').css('display', 'block'); >+ $('.subjectSearch').css('left', left); >+ $('.subjectSearch').css('top', top + 15); >+ } >+ function makeSubjectRequest() { >+ var request = "/cgi-bin/koha/opac-search.pl?q="; >+ var alreadyFound = false; >+ $("#subjectsList").find("li").each(function (){ >+ if ($(this).find("input").attr("checked") && $(this).find("input").attr("name") == "checkbox") { >+ value = $(this).find("input").val(); >+ if (alreadyFound){ request += " and " + value; } >+ else { >+ request += value; >+ alreadyFound = true; >+ } >+ } >+ }); >+ alreadyFound ? $("#validSubjectSearch").attr("href", request) : $("#validSubjectSearch").removeAttr("href"); >+ } >+</script> > <!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="loggedinusername" --><!-- TMPL_IF NAME="TagsEnabled" --><style type="text/css"> > #addtagl { display: none; } > </style><!-- /TMPL_IF --><!-- /TMPL_IF --><!-- /TMPL_IF --> >@@ -101,12 +190,26 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > </span> > > <!-- TMPL_IF name="MARCAUTHORS" --> >- <span class="results_summary"><span class="label">Authors:</span> >- <!-- TMPL_LOOP NAME="MARCAUTHORS" --> >- <!-- TMPL_LOOP NAME="MARCAUTHOR_SUBFIELDS_LOOP" --><!-- TMPL_VAR NAME="separator" --><a title="‡<!-- TMPL_VAR NAME=code --> <!-- TMPL_VAR NAME=value -->" href="/cgi-bin/koha/opac-search.pl?q=<!-- TMPL_LOOP NAME=link_loop --><!-- TMPL_VAR NAME=operator ESCAPE="URL" --><!-- TMPL_VAR NAME='limit' ESCAPE="URL" -->:<!-- TMPL_VAR NAME=link ESCAPE="URL" --><!-- /TMPL_LOOP -->"><!-- TMPL_VAR NAME="value" --></a><!-- /TMPL_LOOP --> >- <!-- TMPL_UNLESS NAME="__last__" -->| >-<!-- /TMPL_UNLESS --> >+ <span class="results_summary"> >+ <span class="label">Authors:</span> >+ <div class="authorSearch"> >+ <span><b>Select the item(s) to search :</b></span> >+ <ul id="authorsList"> >+ <li><input type="checkbox" onchange="checkAll('#authorsList')"> <b>all</b></li> >+ <!-- TMPL_LOOP NAME="bouncemarcauthorsarray" --> >+ <li><input type="checkbox" name="checkbox" onclick="makeAuthorRequest()" value="<!-- TMPL_IF name="searchbyauthority" --><!-- TMPL_IF name="authoritylink" -->an:<!-- TMPL_VAR name="authoritylink" --><!-- TMPL_ELSE -->au,wrdl:<!-- TMPL_LOOP name="term" --><!-- TMPL_VAR name="value" --><!-- TMPL_UNLESS NAME="__last__" -->+<!-- /TMPL_UNLESS --><!-- /TMPL_LOOP --><!-- /TMPL_IF --><!-- TMPL_ELSE -->au,wrdl:<!-- TMPL_LOOP name="term" --><!-- TMPL_VAR name="value" --><!-- TMPL_UNLESS NAME="__last__" -->+<!-- /TMPL_UNLESS --><!-- /TMPL_LOOP --><!-- /TMPL_IF -->"><!-- TMPL_LOOP name="term" --> <!-- TMPL_VAR name="value" --> <!-- /TMPL_LOOP --></li> >+ <!-- /TMPL_LOOP --> >+ </ul> >+ <a href="#" onclick="hideMenu('.authorSearch');">Cancel</a> | <a id="validAuthorSearch"href="#">Search</a> >+ </div> >+ <!-- TMPL_LOOP NAME="bouncemarcauthorsarray" --> >+ <a href="<!-- TMPL_IF name="authoritylink" -->/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<!-- TMPL_VAR name="authoritylink" --><!-- TMPL_ELSE --><!-- /TMPL_IF -->" > >+ <img height="15" src="/opac-tmpl/prog/images/filefind.png"> >+ </a> >+ <a href="#" onclick="showAuthors(this, '<!-- TMPL_IF name="searchbyauthority" --><!-- TMPL_IF name="authoritylink" -->an:<!-- TMPL_VAR name="authoritylink" --><!-- TMPL_ELSE -->au,wrdl:<!-- TMPL_LOOP name="term" --><!-- TMPL_VAR name="value" --><!-- TMPL_UNLESS NAME="__last__" -->+<!-- /TMPL_UNLESS --><!-- /TMPL_LOOP --><!-- /TMPL_IF --><!-- TMPL_ELSE -->au,wrdl:<!-- TMPL_LOOP name="term" --><!-- TMPL_VAR name="value" --><!-- TMPL_UNLESS NAME="__last__" -->+<!-- /TMPL_UNLESS --><!-- /TMPL_LOOP --><!-- /TMPL_IF -->')"><!-- TMPL_LOOP name="term" --><!-- TMPL_VAR name="value" --> <!-- /TMPL_LOOP --></a> | > <!-- /TMPL_LOOP --> >+ <!-- /TMPL_UNLESS --> >+ <!-- /TMPL_LOOP --> > </span> > <!-- /TMPL_IF --> > >@@ -160,12 +263,30 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > <!-- /TMPL_IF --> > > <!-- TMPL_IF NAME="MARCSUBJCTS" --> >- <span class="results_summary"><span class="label">Subject(s):</span> >+ <span class="results_summary"><span class="label">Subject(s):</span> >+ <div class="subjectSearch" > >+ <span><b>Select the item(s) to search :</b></span> >+ <ul id="subjectsList"> >+ <li><input id="all" type="checkbox" onchange="checkAll('#subjectsList')"> <b>all</b></li> >+ <!-- TMPL_LOOP NAME="MARCSUBJCTS" --> >+ <!-- TMPL_LOOP NAME="MARCSUBJECT_SUBFIELDS_LOOP" --> >+ <li><input type="checkbox" onclick="makeSubjectRequest()" name="checkbox" id="checkbox" code="<!-- TMPL_VAR name="value" -->" value="<!-- TMPL_IF name="searchbyauthority" -->an:<!-- TMPL_LOOP name="link_loop" --><!-- TMPL_VAR name="link" --><!-- /TMPL_LOOP --><!-- TMPL_ELSE -->su,wrdl:<!-- TMPL_VAR name="value" --><!-- /TMPL_IF -->"> <!-- TMPL_VAR name="value" --></li> >+ <!-- /TMPL_LOOP --> >+ <li><hr id="trait"></li> >+ <!-- /TMPL_LOOP --> >+ </ul> >+ <a href="#" onclick="hideMenu('.subjectSearch')">Cancel</a> | <a id="validSubjectSearch"href="#">Search</a> >+ </div> > <!-- TMPL_LOOP NAME="MARCSUBJCTS" --> > <!-- TMPL_LOOP NAME="MARCSUBJECT_SUBFIELDS_LOOP" --> >- <!-- TMPL_VAR NAME="separator" --><a title="$<!-- TMPL_VAR NAME="code" --> <!-- TMPL_VAR NAME="value" -->" href="/cgi-bin/koha/opac-search.pl?q=<!-- TMPL_LOOP NAME="link_loop" --><!-- TMPL_VAR NAME="operator" ESCAPE="URL" --><!-- TMPL_VAR NAME="limit" ESCAPE="URL" -->:<!-- TMPL_VAR NAME="link" ESCAPE="URL" --><!-- /TMPL_LOOP -->"><!-- TMPL_VAR NAME="value" --></a><!-- /TMPL_LOOP --> >- <!-- TMPL_IF NAME="__LAST__" --><!-- TMPL_ELSE -->|<!-- /TMPL_IF --> >- <!-- /TMPL_LOOP --></span> >+ <!-- TMPL_VAR NAME="separator" --> >+ <span> >+ <a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<!-- TMPL_LOOP NAME="link_loop" --><!-- TMPL_VAR NAME="link" ESCAPE="URL" --><!-- /TMPL_LOOP -->"><img height="15" src="/opac-tmpl/prog/images/filefind.png"></a> >+ </span> >+ <a href="#" onclick="showSubjects(this, '<!-- TMPL_IF name="searchbyauthority" -->an:<!-- TMPL_LOOP name="link_loop" --><!-- TMPL_VAR name="link" --><!-- /TMPL_LOOP --><!-- TMPL_ELSE -->su,wrdl:<!-- TMPL_VAR name="value" --><!-- /TMPL_IF -->', '<!-- TMPL_VAR name="value" -->')"><!-- TMPL_VAR NAME="value" --></a><!-- /TMPL_LOOP --> >+ <!-- TMPL_IF NAME="__LAST__" --><!-- TMPL_ELSE -->|<!-- /TMPL_IF --> >+ <!-- /TMPL_LOOP --> >+ </span> > <!-- TMPL_ELSE --> > <!-- TMPL_IF name="subjects" --><span class="results_summary"><span class="label">Subject(s):</span> <!-- TMPL_LOOP name="subjects" --><a href="/cgi-bin/koha/opac-search.pl?q=su:<!-- TMPL_VAR NAME="subject" escape="URL" -->"><!-- TMPL_VAR NAME="subject" --></a> | <!-- /TMPL_LOOP --></span><!-- /TMPL_IF --> > <!-- /TMPL_IF --> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 93edc15..60d2f77 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -205,6 +205,38 @@ my $marcseriesarray = GetMarcSeries ($record,$marcflavour); > my $marcurlsarray = GetMarcUrls ($record,$marcflavour); > my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber)); > >+#search rebound parameter >+my $searchByauthority = 0; >+if ( C4::Context->preference("OPACSearchReboundBy") eq "authority" ) { >+ $searchByauthority = 1; >+} >+ >+#search rebound on author >+my @reboundmarcauthorsarray; >+foreach my $author (@$marcauthorsarray) { >+ my ( $a, $b, $authoritylink, @term ); >+ foreach my $subfield ( @{ $author->{'MARCAUTHOR_SUBFIELDS_LOOP'} } ) { >+ if ( $subfield->{'code'} eq "a" && @{ $subfield->{'link_loop'} }[0]->{"limit"} eq "an" ) { >+ $authoritylink = @{ $subfield->{'link_loop'} }[0]->{"link"}; >+ } >+ unless ( $subfield->{'code'} eq "3" || $subfield->{'code'} eq "4" ) { push( @term, { value => $subfield->{'value'} } ); } >+ } >+ push( >+ @reboundmarcauthorsarray, >+ { term => \@term, >+ authoritylink => $authoritylink, >+ searchbyauthority => $searchByauthority, >+ } >+ ); >+} >+ >+#search rebound on subject >+foreach my $subject (@$marcsubjctsarray) { >+ foreach my $subfield ( @{ $subject->{'MARCSUBJECT_SUBFIELDS_LOOP'} } ) { >+ $subfield->{'searchbyauthority'} = $searchByauthority; >+ } >+} >+ > $template->param( > MARCNOTES => $marcnotesarray, > MARCSUBJCTS => $marcsubjctsarray, >@@ -220,6 +252,7 @@ my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($bib > itemdata_itemnotes => $itemfields{itemnotes}, > authorised_value_images => $biblio_authorised_value_images, > subtitle => $subtitle, >+ bouncemarcauthorsarray => \@reboundmarcauthorsarray, > ); > > foreach ( keys %{$dat} ) { >-- >1.7.4.1 >
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 5888
:
3345
|
9738
|
9855
|
9856
|
11586
|
11592
|
12308
|
12343
|
12344
|
13631
|
13632
|
13973
|
13974
|
14140
|
14141
|
15230
|
15231
|
15341
|
15342
|
15343
|
15344
|
15345
|
15346
|
15347
|
15348