Bugzilla – Attachment 34586 Details for
Bug 13364
Add a call number browser to add item page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Create a link to the last advanced search in search result page (OPAC)
PASSED-QA-Create-a-link-to-the-last-advanced-searc.patch (text/plain), 14.73 KB, created by
Kyle M Hall (khall)
on 2014-12-19 17:06:46 UTC
(
hide
)
Description:
[PASSED QA] Create a link to the last advanced search in search result page (OPAC)
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-12-19 17:06:46 UTC
Size:
14.73 KB
patch
obsolete
>From cd52be587959478b0d6c173b5822ece36d953025 Mon Sep 17 00:00:00 2001 >From: simith <simith@inlibro.com> >Date: Fri, 21 Nov 2014 15:17:57 -0500 >Subject: [PATCH] [PASSED QA] Create a link to the last advanced search in search result page (OPAC) > >http://bugs.koha-community.org/show_bug.cgi?id=13307 > >Followed test plan, works as expected (together with other patches) >Signed-off-by: Marc Veron <veron@veron.ch> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >http://bugs.koha-community.org/show_bug.cgi?id=13364 >--- > .../bootstrap/en/includes/opac-bottom.inc | 15 +++++ > .../bootstrap/en/modules/opac-advsearch.tt | 62 ++++++++++++++++++-- > .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 13 ++++- > .../lib/jquery/plugins/jquery.cookie.min.js | 2 + > .../lib/jquery/plugins/jquery.deserialize.min.js | 8 +++ > opac/opac-search.pl | 21 +++++++ > 6 files changed, 114 insertions(+), 7 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.cookie.min.js > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.deserialize.min.js > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index f4c35c2..372ab18 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -235,6 +235,21 @@ $.widget.bridge('uitooltip', $.ui.tooltip); > > </script> > [% END # / IF persona %] >+ >+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script> >+<script type="text/javascript"> >+$(document).ready(function() { >+ if($('#searchsubmit').length) { >+ $(document).on("click", '#searchsubmit', function(e) { >+ jQuery.removeCookie("form_serialized", { path: '/'}); >+ jQuery.removeCookie("form_serialized_itype", { path: '/'}); >+ jQuery.removeCookie("form_serialized_limits", { path: '/'}); >+ jQuery.removeCookie("num_paragraph", { path: '/'}); >+ jQuery.removeCookie("search_path_code", { path: '/'}); >+ }); >+ } >+}); >+</script> > [% PROCESS jsinclude %] > > [% IF ( opacuserjs ) %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >index 12dd94f..49d3198 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >@@ -248,7 +248,7 @@ > <div class="span3"> > <fieldset> > <legend>Audience</legend> >- <select name="limit" class="subtype"> >+ <select id="subtype_audience" name="limit" class="subtype"> > <option value="" selected="selected" class="menuheader">Any audience</option> > <option value="aud:a">Preschool</option> > <option value="aud:b">Primary</option> >@@ -265,7 +265,7 @@ > <div class="span3"> > <fieldset> > <legend>Content</legend> >- <select name="limit" class="subtype"> >+ <select id="subtype_content" name="limit" class="subtype"> > <option value="" selected="selected" class="menuheader">Any content</option> > <option value="fic:1">Fiction</option> > <option value="fic:0">Non fiction</option> >@@ -279,7 +279,7 @@ > <div class="span3"> > <fieldset> > <legend>Format</legend> >- <select name="limit" class="subtype"> >+ <select id="subtype_format" name="limit" class="subtype"> > <option value="" selected="selected" class="menuheader">Any format</option> > <option value="l-format:ta">Regular print</option> > <option value="l-format:tb">Large print</option> >@@ -298,7 +298,7 @@ > <div class="span3"> > <fieldset> > <legend>Additional content types for books/printed materials</legend> >- <select name="limit" class="subtype"> >+ <select id="subtype_additional" name="limit" class="subtype"> > <option value="">Any</option> > <option value="ctype:a">Abstracts/summaries</option> > <option value="ctype:b">Bibliographies</option> >@@ -372,10 +372,60 @@ > [% END %] > > [% BLOCK jsinclude %] >+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.deserialize.min.js"></script> >+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script> > <script type="text/javascript">//<![CDATA[ >- $(document).ready(function() { >- $('#advsearches').tabs(); >+$(document).ready(function() { >+ $('#advsearches').tabs(); >+ jQuery.cookie.json = true; >+ //$('#advsearches > ul').tabs(); >+ >+ [% IF ( ReturnToSearch ) %] >+ if (form_serialized = jQuery.cookie("form_serialized")) { >+ $('#advsearch form').deserialize(form_serialized); >+ } >+ if (form_serialized_limits = jQuery.cookie("form_serialized_limits")) { >+ $('#language-limit') .val(form_serialized_limits[0]); >+ $('#branchloop') .val(form_serialized_limits[1]); >+ $('#subtype_audience') .val(form_serialized_limits[2]); >+ $('#subtype_content') .val(form_serialized_limits[3]); >+ $('#subtype_format') .val(form_serialized_limits[4]); >+ $('#subtype_additional') .val(form_serialized_limits[5]); >+ $('#locloop') .val(form_serialized_limits[6]); >+ } >+ [% ELSE %] >+ //Clear all form cookies >+ jQuery.removeCookie("form_serialized", { path: '/'}); >+ jQuery.removeCookie("form_serialized_itype", { path: '/'}); >+ jQuery.removeCookie("form_serialized_limits", { path: '/'}); >+ jQuery.removeCookie("num_paragraph", { path: '/'}); >+ jQuery.removeCookie("search_path_code", { path: '/'}); >+ [% END %] >+ $('#advsearch form').submit(function() { >+ form_serialized = $(this).serialize(); >+ jQuery.cookie("form_serialized", form_serialized,{ path: '/'}); >+ form_serialized_limits = [ >+ $('#language-limit').val(), $('#branchloop').val(), >+ $('#subtype_audience').val(), $('#subtype_content').val(), >+ $('#subtype_format').val(), $('#subtype_additional').val(), >+ $('#locloop').val() >+ ]; >+ jQuery.cookie("form_serialized_limits", form_serialized_limits,{ path: '/'}); >+ [% IF ( expanded_options ) %] >+ var numPar = $("#booleansearch fieldset p").size(); >+ if (numPar > [% search_boxes_count %]){ >+ jQuery.cookie("num_paragraph", numPar,{ path: '/'}); >+ }else{ >+ jQuery.cookie("num_paragraph", null,{ path: '/'}); >+ } >+ jQuery.cookie("search_path_code", 'exs',{ path: '/'}); >+ [% ELSE %] >+ jQuery.cookie("search_path_code", 'ads',{ path: '/'}); >+ jQuery.cookie("num_paragraph", null,{ path: '/'}); >+ [% END %] > }); >+ >+}); > /* This function allows to display a new field to search. > */ > $(document).on("click", '.ButtonPlus', function(e) { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index 72a3a89..16d6319 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -46,6 +46,11 @@ > You did not specify any search criteria. > [% END %] > </p> >+ [% IF ( ReturnPath ) %] >+ <div class="returntosearch"> >+ <p><a href="[% ReturnPath %]">Return to the last advanced search</a></p> >+ </div> >+ [% END %] > [% IF ( OPACNoResultsFound ) %] > <div id="noresultsfound"> > [% OPACNoResultsFound %] >@@ -102,7 +107,13 @@ > [% END %] > </ul> > [% END # / IF koha_spsuggest%] >- >+ [% IF ( total ) %] >+ [% IF ( ReturnPath ) %] >+ <div class="returntosearch"> >+ <p><a href="[% ReturnPath %]">Return to the last advanced search</a></p> >+ </div> >+ [% END %] >+ [% END %] > [% IF ( query_error ) %] > <div class="dialog alert"> > <h4>Error:</h4> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.cookie.min.js b/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.cookie.min.js >new file mode 100644 >index 0000000..36d6b65 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.cookie.min.js >@@ -0,0 +1,2 @@ >+/*! jquery.cookie v1.4.1 | MIT */ >+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.deserialize.min.js b/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.deserialize.min.js >new file mode 100644 >index 0000000..7054ea4 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.deserialize.min.js >@@ -0,0 +1,8 @@ >+/** >+ * @author Kyle Florence <kyle[dot]florence[at]gmail[dot]com> >+ * @website https://github.com/kflorence/jquery-deserialize/ >+ * @version 1.2.1 >+ * >+ * Dual licensed under the MIT and GPLv2 licenses. >+ */ >+(function(i,b){var f=Array.prototype.push,a=/^(?:radio|checkbox)$/i,e=/\+/g,d=/^(?:option|select-one|select-multiple)$/i,g=/^(?:button|color|date|datetime|datetime-local|email|hidden|month|number|password|range|reset|search|submit|tel|text|textarea|time|url|week)$/i;function c(j){return j.map(function(){return this.elements?i.makeArray(this.elements):this}).filter(":input").get()}function h(j){var k,l={};i.each(j,function(n,m){k=l[m.name];l[m.name]=k===b?m:(i.isArray(k)?k.concat(m):[k,m])});return l}i.fn.deserialize=function(A,l){var y,n,q=c(this),t=[];if(!A||!q.length){return this}if(i.isArray(A)){t=A}else{if(i.isPlainObject(A)){var B,w;for(B in A){i.isArray(w=A[B])?f.apply(t,i.map(w,function(j){return{name:B,value:j}})):f.call(t,{name:B,value:w})}}else{if(typeof A==="string"){var v;A=A.split("&");for(y=0,n=A.length;y<n;y++){v=A[y].split("=");f.call(t,{name:decodeURIComponent(v[0]),value:decodeURIComponent(v[1].replace(e,"%20"))})}}}}if(!(n=t.length)){return this}var u,k,x,z,C,o,m,w,p=i.noop,s=i.noop,r={};l=l||{};q=h(q);if(i.isFunction(l)){s=l}else{p=i.isFunction(l.change)?l.change:p;s=i.isFunction(l.complete)?l.complete:s}for(y=0;y<n;y++){u=t[y];C=u.name;w=u.value;if(!(k=q[C])){continue}m=(z=k.length)?k[0]:k;m=(m.type||m.nodeName).toLowerCase();o=null;if(g.test(m)){if(z){x=r[C];k=k[r[C]=(x==b)?0:++x]}p.call(k,(k.value=w))}else{if(a.test(m)){o="checked"}else{if(d.test(m)){o="selected"}}}if(o){if(!z){k=[k];z=1}for(x=0;x<z;x++){u=k[x];if(u.value==w){p.call(u,(u[o]=true)&&w)}}}}s.call(this);return this}})(jQuery); >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 692d70b..348ccfa 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -184,6 +184,21 @@ if (C4::Context->preference('TagsEnabled')) { > > # load the branches > >+if ($cgi->param("returntosearch")) { >+ $template->param('ReturnToSearch' => 1); >+} >+if ($cgi->cookie("search_path_code")) { >+ my $pathcode = $cgi->cookie("search_path_code"); >+ given ($pathcode) >+ { >+ when ('"ads"') { $template->param('ReturnPath' => '/cgi-bin/koha/opac-search.pl?returntosearch=1'); } >+ when ('"exs"') { >+ $template->param('ReturnPath' => '/cgi-bin/koha/opac-search.pl?expanded_options=1&returntosearch=1'); >+ } >+ default {warn "ReturnPath swith error";} >+ } >+} >+ > my $branches = GetBranches(); # used later in *getRecords, probably should be internalized by those functions after caching in C4::Branch is established > $template->param( > searchdomainloop => GetBranchCategories('searchdomain'), >@@ -281,6 +296,12 @@ if ( $template_type && $template_type eq 'advsearch' ) { > # box should only appear on the last, etc. > my @search_boxes_array; > my $search_boxes_count = 3; # begin whith 3 boxes >+ $template->param( search_boxes_count => $search_boxes_count ); >+ >+ if ($cgi->cookie("num_paragraph")){ >+ $search_boxes_count = $cgi->cookie("num_paragraph"); >+ } >+ > for (my $i=1;$i<=$search_boxes_count;$i++) { > # if it's the first one, don't display boolean option, but show scan indexes > if ($i==1) { >-- >1.7.2.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 13364
:
34041
|
34108
|
34109
|
34476
|
34540
|
34541
|
34542
|
34543
|
34586
|
34587
|
34588
|
34589
|
35067
|
35549
|
36194
|
36235
|
36249
|
36431
|
36596
|
36597
|
36598
|
36599
|
36600
|
36601
|
36723
|
36782
|
37192
|
37193
|
37194
|
37195
|
38010
|
38011
|
38018
|
38019
|
38894