Bugzilla – Attachment 9738 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]
opac-detail subject/author links improvements
0001-Bug-5888-opac-detail-subject-author-links-improvemen.patch (text/plain), 13.39 KB, created by
Julian Maurice
on 2012-05-23 09:32:39 UTC
(
hide
)
Description:
opac-detail subject/author links improvements
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2012-05-23 09:32:39 UTC
Size:
13.39 KB
patch
obsolete
>From 3d2fe7875b7c9f1d675d1859c4486001b0b1bd1d Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 23 May 2012 11:00:17 +0200 >Subject: [PATCH] Bug 5888: opac-detail subject/author links improvements > >When the user clicks on a subject or an author, the list of subjects (authors) >is displayed and the user can choose more than 1 subject (author) to search on >--- > C4/Biblio.pm | 12 +- > koha-tmpl/opac-tmpl/prog/en/css/opac.css | 30 ++++ > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 182 ++++++++++++++++++-- > 3 files changed, 212 insertions(+), 12 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 5508cbe..a3b866d 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1660,6 +1660,7 @@ sub GetMarcSubjects { > > # if there is an authority link, build the link with an= subfield9 > my $found9 = 0; >+ my $authoritylink; > for my $subject_subfield (@subfields) { > > # don't load unimarc subfields 3,4,5 >@@ -1677,6 +1678,7 @@ sub GetMarcSubjects { > } > if ( $code eq 9 ) { > $found9 = 1; >+ $authoritylink = $linkvalue; > @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } ); > } > if ( not $found9 ) { >@@ -1693,7 +1695,10 @@ sub GetMarcSubjects { > $counter++; > } > >- push @marcsubjects, { MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop }; >+ push @marcsubjects, { >+ MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop, >+ authoritylink => $authoritylink, >+ }; > > } > return \@marcsubjects; >@@ -1776,7 +1781,10 @@ sub GetMarcAuthors { > unless ( $authors_subfield->[0] eq '9' || $authors_subfield->[0] eq '0'); > $count_auth++; > } >- push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop }; >+ push @marcauthors, { >+ MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop, >+ authoritylink => $subfield9, >+ }; > } > return \@marcauthors; > } >diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css >index 0cc7f2d..aec3d7e 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css >+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css >@@ -2135,6 +2135,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.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >index cc59fb2..7b47838 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -269,6 +269,98 @@ 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", false); >+ } >+ }); >+ } >+ >+ function checkAll(checkbox, elem) { >+ var check = $(checkbox).attr('checked') ? true : false; >+ $(elem).find("li").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){ >+ check("#subjectsList", value); >+ 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> >+ > [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]<style type="text/css"> > #addtagl { display: none; } > </style>[% END %][% END %][% END %] >@@ -336,12 +428,48 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > </span> > > [% IF ( MARCAUTHORS ) %] >- <span class="results_summary"><span class="label">Authors:</span> >+ <span class="results_summary"> >+ <span class="label">Authors:</span> >+ <div class="authorSearch" id="authorSearch"> >+ <span><b>Select the item(s) to search :</b></span> >+ <ul id="authorsList"> >+ <li><input type="checkbox" onchange="checkAll(this, '#authorsList')"> <b>all</b></li> >+ <li><hr /></li> > [% FOREACH MARCAUTHOR IN MARCAUTHORS %] >- [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %]<a title="â¡[% MARCAUTHOR_SUBFIELDS_LOO.code %] [% MARCAUTHOR_SUBFIELDS_LOO.value %]" href="/cgi-bin/koha/opac-search.pl?q=[% FOREACH link_loo IN MARCAUTHOR_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit |url %]:[% link_loo.link |url %][% END %]">[% MARCAUTHOR_SUBFIELDS_LOO.value %]</a>[% END %] >- [% UNLESS ( loop.last ) %]| >-[% END %] >+ <li> >+ [% IF (MARCAUTHOR.authoritylink) %] >+ <input type="checkbox" name="checkbox" >+ onclick="makeAuthorRequest()" >+ value="an:[% MARCAUTHOR.authoritylink %]" /> >+ [% ELSE %] >+ <input type="checkbox" name="checkbox" >+ onclick="makeAuthorRequest()" >+ value="au,wrdl:[% FOREACH SUBFIELD IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% SUBFIELD.value |url %][% UNLESS (loop.last) %]+[% END %][% END %]" /> >+ [% END %] >+ >+ [% FOREACH SUBFIELD IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %] >+ [% SUBFIELD.value %] >+ [% END %] >+ </li> > [% END %] >+ </ul> >+ <hr /> >+ <a href="#" onclick="hideMenu('.authorSearch'); return false">Cancel</a> >+ | >+ <a id="validAuthorSearch">Search</a> >+ </div> >+ [% FOREACH MARCAUTHOR IN MARCAUTHORS %] >+ [% FOREACH SUBFIELD IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %] >+ <a title="â¡[% SUBFIELD.code %] [% SUBFIELD.value %]" >+ onclick="showAuthors(this, '[% FOREACH link IN SUBFIELD.link_loop %][% link.operator |url %][% link.limit |url %]:[% link.link |url %][% END %]'); return false;" >+ href="/cgi-bin/koha/opac-search.pl?q=[% FOREACH link IN SUBFIELD.link_loop %][% link.operator |url %][% link.limit |url %]:[% link.link |url %][% END %]">[% SUBFIELD.value %]</a> >+ [% UNLESS (loop.last) %][% SUBFIELD.separator %][% END %] >+ [% END %] >+ [% IF (MARCAUTHOR.authoritylink) %] >+ <a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% MARCAUTHOR.authoritylink %]"><img style="vertical-align:middle" height="15" width="15" src="/opac-tmpl/prog/images/filefind.png"></a> >+ [% END %] >+ [% UNLESS ( loop.last ) %]|[% END %] >+ [% END %] > </span> > [% END %] > >@@ -395,12 +523,46 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > [% END %] > > [% IF ( MARCSUBJCTS ) %] >- <span class="results_summary"><span class="label">Subject(s):</span> >- [% FOREACH MARCSUBJCT IN MARCSUBJCTS %] >- [% FOREACH MARCSUBJECT_SUBFIELDS_LOO IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %] >- [% MARCSUBJECT_SUBFIELDS_LOO.separator %]<a title="$[% MARCSUBJECT_SUBFIELDS_LOO.code %] [% MARCSUBJECT_SUBFIELDS_LOO.value %]" href="/cgi-bin/koha/opac-search.pl?q=[% FOREACH link_loo IN MARCSUBJECT_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit |url %]:[% link_loo.link |url %][% END %]">[% MARCSUBJECT_SUBFIELDS_LOO.value %]</a>[% END %] >- [% IF ( loop.last ) %][% ELSE %]|[% END %] >- [% END %]</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(this, '#subjectsList')" /> >+ <b>all</b> >+ </li> >+ <li><hr /></li> >+ [% FOREACH MARCSUBJCT IN MARCSUBJCTS %] >+ [% FOREACH SUBFIELD IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %] >+ <li> >+ <input type="checkbox" onclick="makeSubjectRequest()" >+ name="checkbox" id="checkbox" >+ code="[% SUBFIELD.value |url %]" >+ value="[% IF (searchbyauthority) %]an:[% FOREACH link IN SUBFIELD.link_loop %][% link.link |url %][% END %][% ELSE %]su,wrdl:[% SUBFIELD.value |url %][% END %]" /> >+ [% SUBFIELD.value %] >+ </li> >+ [% END %] >+ <li><hr /></li> >+ [% END %] >+ </ul> >+ <a href="#" >+ onclick="hideMenu('.subjectSearch'); return false">Cancel</a> >+ | >+ <a id="validSubjectSearch">Search</a> >+ </div> >+ [% FOREACH MARCSUBJCT IN MARCSUBJCTS %] >+ [% FOREACH SUBFIELD IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %] >+ [% SUBFIELD.separator %] >+ <a title="$[% SUBFIELD.code %] [% SUBFIELD.value %]" href="/cgi-bin/koha/opac-search.pl?q=[% FOREACH link_loo IN SUBFIELD.link_loop %][% link_loo.operator |url %][% link_loo.limit |url %]:[% link_loo.link |url %][% END %]" onclick="showSubjects(this, '[% IF (searchbyauthority) %]an:[% FOREACH link IN SUBFIELD.link_loop %][% link.link |url %][% END %][% ELSE %]su,wrdl:[% SUBFIELD.value |url %][% END %]'); return false;">[% SUBFIELD.value %]</a> >+ [% END %] >+ [% IF (MARCSUBJCT.authoritylink) %] >+ <a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% MARCSUBJCT.subjectlink %]"><img style="vertical-align:middle" height="15" width="15" src="/opac-tmpl/prog/images/filefind.png" /></a> >+ [% END %] >+ [% UNLESS ( loop.last ) %] | [% END %] >+ [% END %] >+ </span> > [% ELSE %] > [% IF ( subjects ) %]<span class="results_summary"><span class="label">Subject(s):</span> [% FOREACH subject IN subjects %]<a href="/cgi-bin/koha/opac-search.pl?q=su:[% subject.subject |url %]">[% subject.subject %]</a> | [% END %]</span>[% END %] > [% END %] >-- >1.7.10 >
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