View | Details | Raw Unified | Return to bug 13307
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+15 lines)
Lines 235-240 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
235
235
236
    </script>
236
    </script>
237
[% END #  / IF persona %]
237
[% END #  / IF persona %]
238
239
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
240
<script type="text/javascript">
241
$(document).ready(function() {
242
    if($('#searchsubmit').length) {
243
        $(document).on("click", '#searchsubmit', function(e) {
244
            jQuery.removeCookie("form_serialized", { path: '/'});
245
            jQuery.removeCookie("form_serialized_itype", { path: '/'});
246
            jQuery.removeCookie("form_serialized_limits", { path: '/'});
247
            jQuery.removeCookie("num_paragraph", { path: '/'});
248
            jQuery.removeCookie("search_path_code", { path: '/'});
249
        });
250
    }
251
});
252
</script>
238
[% PROCESS jsinclude %]
253
[% PROCESS jsinclude %]
239
254
240
[% IF ( opacuserjs ) %]
255
[% IF ( opacuserjs ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt (-6 / +56 lines)
Lines 248-254 Link Here
248
                                    <div class="span3">
248
                                    <div class="span3">
249
                                        <fieldset>
249
                                        <fieldset>
250
                                            <legend>Audience</legend>
250
                                            <legend>Audience</legend>
251
                                            <select name="limit" class="subtype">
251
                                            <select id="subtype_audience" name="limit" class="subtype">
252
                                            <option value="" selected="selected" class="menuheader">Any audience</option>
252
                                            <option value="" selected="selected" class="menuheader">Any audience</option>
253
                                                <option value="aud:a">Preschool</option>
253
                                                <option value="aud:a">Preschool</option>
254
                                                <option value="aud:b">Primary</option>
254
                                                <option value="aud:b">Primary</option>
Lines 265-271 Link Here
265
                                    <div class="span3">
265
                                    <div class="span3">
266
                                        <fieldset>
266
                                        <fieldset>
267
                                            <legend>Content</legend>
267
                                            <legend>Content</legend>
268
                                            <select name="limit" class="subtype">
268
                                            <select id="subtype_content"  name="limit" class="subtype">
269
                                                <option value="" selected="selected" class="menuheader">Any content</option>
269
                                                <option value="" selected="selected" class="menuheader">Any content</option>
270
                                                <option value="fic:1">Fiction</option>
270
                                                <option value="fic:1">Fiction</option>
271
                                                <option value="fic:0">Non fiction</option>
271
                                                <option value="fic:0">Non fiction</option>
Lines 279-285 Link Here
279
                                    <div class="span3">
279
                                    <div class="span3">
280
                                        <fieldset>
280
                                        <fieldset>
281
                                            <legend>Format</legend>
281
                                            <legend>Format</legend>
282
                                            <select name="limit" class="subtype">
282
                                            <select id="subtype_format" name="limit" class="subtype">
283
                                                <option value="" selected="selected" class="menuheader">Any format</option>
283
                                                <option value="" selected="selected" class="menuheader">Any format</option>
284
                                                <option value="l-format:ta">Regular print</option>
284
                                                <option value="l-format:ta">Regular print</option>
285
                                                <option value="l-format:tb">Large print</option>
285
                                                <option value="l-format:tb">Large print</option>
Lines 298-304 Link Here
298
                                    <div class="span3">
298
                                    <div class="span3">
299
                                        <fieldset>
299
                                        <fieldset>
300
                                            <legend>Additional content types for books/printed materials</legend>
300
                                            <legend>Additional content types for books/printed materials</legend>
301
                                            <select name="limit" class="subtype">
301
                                            <select id="subtype_additional" name="limit" class="subtype">
302
                                                <option value="">Any</option>
302
                                                <option value="">Any</option>
303
                                                <option value="ctype:a">Abstracts/summaries</option>
303
                                                <option value="ctype:a">Abstracts/summaries</option>
304
                                                <option value="ctype:b">Bibliographies</option>
304
                                                <option value="ctype:b">Bibliographies</option>
Lines 372-381 Link Here
372
[% END %]
372
[% END %]
373
373
374
[% BLOCK jsinclude %]
374
[% BLOCK jsinclude %]
375
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.deserialize.min.js"></script>
376
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
375
<script type="text/javascript">//<![CDATA[
377
<script type="text/javascript">//<![CDATA[
376
    $(document).ready(function() {
378
$(document).ready(function() {
377
        $('#advsearches').tabs();
379
    $('#advsearches').tabs();
380
    jQuery.cookie.json = true;
381
    //$('#advsearches > ul').tabs();
382
383
    [% IF ( ReturnToSearch ) %]
384
        if (form_serialized = jQuery.cookie("form_serialized")) {
385
            $('#advsearch form').deserialize(form_serialized);
386
        }
387
        if (form_serialized_limits = jQuery.cookie("form_serialized_limits")) {
388
            $('#language-limit')     .val(form_serialized_limits[0]);
389
            $('#branchloop')         .val(form_serialized_limits[1]);
390
            $('#subtype_audience')   .val(form_serialized_limits[2]);
391
            $('#subtype_content')    .val(form_serialized_limits[3]);
392
            $('#subtype_format')     .val(form_serialized_limits[4]);
393
            $('#subtype_additional') .val(form_serialized_limits[5]);
394
            $('#locloop')            .val(form_serialized_limits[6]);
395
        }
396
    [% ELSE %]
397
        //Clear all form cookies
398
        jQuery.removeCookie("form_serialized", { path: '/'});
399
        jQuery.removeCookie("form_serialized_itype", { path: '/'});
400
        jQuery.removeCookie("form_serialized_limits", { path: '/'});
401
        jQuery.removeCookie("num_paragraph", { path: '/'});
402
        jQuery.removeCookie("search_path_code", { path: '/'});
403
    [% END %]
404
    $('#advsearch form').submit(function() {
405
        form_serialized = $(this).serialize();
406
        jQuery.cookie("form_serialized", form_serialized,{ path: '/'});
407
        form_serialized_limits = [
408
            $('#language-limit').val(),   $('#branchloop').val(),
409
            $('#subtype_audience').val(), $('#subtype_content').val(),
410
            $('#subtype_format').val(),   $('#subtype_additional').val(),
411
            $('#locloop').val()
412
        ];
413
        jQuery.cookie("form_serialized_limits", form_serialized_limits,{ path: '/'});
414
        [% IF ( expanded_options ) %]
415
        var numPar = $("#booleansearch fieldset p").size();
416
        if (numPar > [% search_boxes_count %]){
417
            jQuery.cookie("num_paragraph", numPar,{ path: '/'});
418
        }else{
419
            jQuery.cookie("num_paragraph", null,{ path: '/'});
420
        }
421
        jQuery.cookie("search_path_code", 'exs',{ path: '/'});
422
        [% ELSE %]
423
        jQuery.cookie("search_path_code", 'ads',{ path: '/'});
424
        jQuery.cookie("num_paragraph", null,{ path: '/'});
425
        [% END %]
378
    });
426
    });
427
428
});
379
    /* This function allows to display a new field to search.
429
    /* This function allows to display a new field to search.
380
    */
430
    */
381
    $(document).on("click", '.ButtonPlus', function(e) {
431
    $(document).on("click", '.ButtonPlus', function(e) {
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-1 / +12 lines)
Lines 46-51 Link Here
46
                                You did not specify any search criteria.
46
                                You did not specify any search criteria.
47
                            [% END %]
47
                            [% END %]
48
                        </p>
48
                        </p>
49
                        [% IF ( ReturnPath ) %]
50
                           <div class="returntosearch">
51
                                <p><a href="[% ReturnPath %]">Return to the last advanced search</a></p>
52
                            </div>
53
                        [% END %]
49
                        [% IF ( OPACNoResultsFound ) %]
54
                        [% IF ( OPACNoResultsFound ) %]
50
                            <div id="noresultsfound">
55
                            <div id="noresultsfound">
51
                                [% OPACNoResultsFound %]
56
                                [% OPACNoResultsFound %]
Lines 102-108 Link Here
102
                            [% END %]
107
                            [% END %]
103
                        </ul>
108
                        </ul>
104
                    [% END # / IF koha_spsuggest%]
109
                    [% END # / IF koha_spsuggest%]
105
110
                    [% IF ( total ) %]
111
                        [% IF ( ReturnPath ) %]
112
                            <div class="returntosearch">
113
                                <p><a href="[% ReturnPath %]">Return to the last advanced search</a></p>
114
                            </div>
115
                        [% END %]
116
                    [% END %]
106
                    [% IF ( query_error ) %]
117
                    [% IF ( query_error ) %]
107
                        <div class="dialog alert">
118
                        <div class="dialog alert">
108
                            <h4>Error:</h4>
119
                            <h4>Error:</h4>
(-)a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.cookie.min.js (+2 lines)
Line 0 Link Here
1
/*! jquery.cookie v1.4.1 | MIT */
2
!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))}});
(-)a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.deserialize.min.js (+8 lines)
Line 0 Link Here
1
/**
2
 * @author Kyle Florence <kyle[dot]florence[at]gmail[dot]com>
3
 * @website https://github.com/kflorence/jquery-deserialize/
4
 * @version 1.2.1
5
 *
6
 * Dual licensed under the MIT and GPLv2 licenses.
7
 */
8
(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);
(-)a/opac/opac-search.pl (-1 / +21 lines)
Lines 184-189 if (C4::Context->preference('TagsEnabled')) { Link Here
184
184
185
# load the branches
185
# load the branches
186
186
187
if ($cgi->param("returntosearch")) {
188
    $template->param('ReturnToSearch' => 1);
189
}
190
if ($cgi->cookie("search_path_code")) {
191
    my $pathcode = $cgi->cookie("search_path_code");
192
    given ($pathcode)
193
    {
194
        when ('"ads"') { $template->param('ReturnPath' => '/cgi-bin/koha/opac-search.pl?returntosearch=1'); }
195
        when ('"exs"') {
196
            $template->param('ReturnPath' => '/cgi-bin/koha/opac-search.pl?expanded_options=1&returntosearch=1');
197
        }
198
        default {warn "ReturnPath swith error";}
199
    }
200
}
201
187
my $branches = GetBranches();   # used later in *getRecords, probably should be internalized by those functions after caching in C4::Branch is established
202
my $branches = GetBranches();   # used later in *getRecords, probably should be internalized by those functions after caching in C4::Branch is established
188
$template->param(
203
$template->param(
189
    searchdomainloop => GetBranchCategories('searchdomain'),
204
    searchdomainloop => GetBranchCategories('searchdomain'),
Lines 281-286 if ( $template_type && $template_type eq 'advsearch' ) { Link Here
281
    # box should only appear on the last, etc.
296
    # box should only appear on the last, etc.
282
    my @search_boxes_array;
297
    my @search_boxes_array;
283
    my $search_boxes_count = 3; # begin whith 3 boxes
298
    my $search_boxes_count = 3; # begin whith 3 boxes
299
    $template->param( search_boxes_count => $search_boxes_count );
300
301
    if ($cgi->cookie("num_paragraph")){
302
        $search_boxes_count = $cgi->cookie("num_paragraph");
303
    }
304
284
    for (my $i=1;$i<=$search_boxes_count;$i++) {
305
    for (my $i=1;$i<=$search_boxes_count;$i++) {
285
        # if it's the first one, don't display boolean option, but show scan indexes
306
        # if it's the first one, don't display boolean option, but show scan indexes
286
        if ($i==1) {
307
        if ($i==1) {
287
- 

Return to bug 13307