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

(-)a/.htaccess (-9 lines)
Lines 1-9 Link Here
1
# .htaccess
2
3
ErrorDocument 400 /cgi-bin/koha/errors/400.pl
4
ErrorDocument 401 /cgi-bin/koha/errors/401.pl
5
ErrorDocument 403 /cgi-bin/koha/errors/403.pl
6
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
7
ErrorDocument 500 /cgi-bin/koha/errors/500.pl
8
9
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (+12 lines)
Lines 316-318 Link Here
316
            </div>
316
            </div>
317
        </form> <!-- /#auth -->
317
        </form> <!-- /#auth -->
318
    </div>  <!-- /#modalAuth  -->
318
    </div>  <!-- /#modalAuth  -->
319
320
<script type="text/javascript">
321
document.getElementById("searchsubmit").onclick=function(){
322
    var exp = new Date();
323
    exp.setTime(exp.getTime()-1);
324
    document.cookie = "form_serialized=null; path=/; expires=" + exp.toGMTString();
325
    document.cookie = "form_serialized_itype=null; path=/; expires=" + exp.toGMTString();
326
    document.cookie = "form_serialized_limits=null; path=/; expires=" + exp.toGMTString();
327
    document.cookie = "num_paragraph=null; path=/; expires=" + exp.toGMTString();
328
    document.cookie = "search_path_code=null; path=/; expires=" + exp.toGMTString();
329
};
330
</script>
(-)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.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.cookie("form_serialized", null,{ path: '/'});
399
        jQuery.cookie("form_serialized_itype", null,{ path: '/'});
400
        jQuery.cookie("form_serialized_limits", null,{ path: '/'});
401
        jQuery.cookie("num_paragraph", null,{ path: '/'});
402
        jQuery.cookie("search_path_code", null,{ 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 (+72 lines)
Line 0 Link Here
1
/*!
2
 * jQuery Cookie Plugin v1.3
3
 * https://github.com/carhartl/jquery-cookie
4
 *
5
 * Copyright 2011, Klaus Hartl
6
 * Dual licensed under the MIT or GPL Version 2 licenses.
7
 * http://www.opensource.org/licenses/mit-license.php
8
 * http://www.opensource.org/licenses/GPL-2.0
9
 */
10
(function ($, document, undefined) {
11
12
	var pluses = /\+/g;
13
14
	function raw(s) {
15
		return s;
16
	}
17
18
	function decoded(s) {
19
		return decodeURIComponent(s.replace(pluses, ' '));
20
	}
21
22
	var config = $.cookie = function (key, value, options) {
23
24
		// write
25
		if (value !== undefined) {
26
			options = $.extend({}, config.defaults, options);
27
28
			if (value === null) {
29
				options.expires = -1;
30
			}
31
32
			if (typeof options.expires === 'number') {
33
				var days = options.expires, t = options.expires = new Date();
34
				t.setDate(t.getDate() + days);
35
			}
36
37
			value = config.json ? JSON.stringify(value) : String(value);
38
39
			return (document.cookie = [
40
				encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
41
				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
42
				options.path    ? '; path=' + options.path : '',
43
				options.domain  ? '; domain=' + options.domain : '',
44
				options.secure  ? '; secure' : ''
45
			].join(''));
46
		}
47
48
		// read
49
		var decode = config.raw ? raw : decoded;
50
		var cookies = document.cookie.split('; ');
51
		for (var i = 0, l = cookies.length; i < l; i++) {
52
			var parts = cookies[i].split('=');
53
			if (decode(parts.shift()) === key) {
54
				var cookie = decode(parts.join('='));
55
				return config.json ? JSON.parse(cookie) : cookie;
56
			}
57
		}
58
59
		return null;
60
	};
61
62
	config.defaults = {};
63
64
	$.removeCookie = function (key, options) {
65
		if ($.cookie(key) !== null) {
66
			$.cookie(key, null, options);
67
			return true;
68
		}
69
		return false;
70
	};
71
72
})(jQuery, document);
(-)a/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.deserialize.js (+134 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( jQuery, undefined ) {
9
10
var push = Array.prototype.push,
11
    rcheck = /^(?:radio|checkbox)$/i,
12
    rplus = /\+/g,
13
    rselect = /^(?:option|select-multiple)$/i,
14
    rvalue = /^(?:button|select-one|color|date|datetime|datetime-local|email|hidden|month|number|password|range|reset|search|submit|tel|text|textarea|time|url|week)$/i;
15
16
function getElements( elements ) {
17
    return elements.map(function() {
18
            return this.elements ? jQuery.makeArray( this.elements ) : this;
19
        }).filter( ":input:not(:disabled)" ).get();
20
}
21
22
function getElementsByName( elements ) {
23
    var current,
24
        elementsByName = {};
25
26
    jQuery.each( elements, function( i, element ) {
27
        current = elementsByName[ element.name ];
28
        elementsByName[ element.name ] = current === undefined ? element :
29
            ( jQuery.isArray( current ) ? current.concat( element ) : [ current, element ] );
30
    });
31
32
    return elementsByName;
33
}
34
35
jQuery.fn.deserialize = function( data, options ) {
36
    var i, length,
37
        elements = getElements( this ),
38
        normalized = [];
39
40
    if ( !data || !elements.length ) {
41
        return this;
42
    }
43
44
    if ( jQuery.isArray( data ) ) {
45
        normalized = data;
46
47
    } else if ( typeof data === "string" ) {
48
        var parts;
49
50
        data = data.split( "&" );
51
52
        for ( i = 0, length = data.length; i < length; i++ ) {
53
            parts =  data[ i ].split( "=" );
54
            push.call( normalized, {
55
                name: decodeURIComponent( parts[ 0 ] ),
56
                value: decodeURIComponent( parts[ 1 ].replace( rplus, "%20" ) )
57
            });
58
        }
59
    }
60
61
    if ( !( length = normalized.length ) ) {
62
        return this;
63
    }
64
65
    var current, element, j, len, name, property, type, value,
66
        change = function() {},
67
        complete = function() {},
68
        names = {};
69
70
    options = options || {};
71
    elements = getElementsByName( elements );
72
73
    // Backwards compatible with old arguments: data, callback
74
    if ( jQuery.isFunction( options ) ) {
75
        complete = options;
76
77
    } else {
78
        change = jQuery.isFunction( options.change ) ? options.change : change;
79
        complete = jQuery.isFunction( options.complete ) ? options.complete : complete;
80
    }
81
82
    for ( i = 0; i < length; i++ ) {
83
        current = normalized[ i ];
84
85
        name = current.name;
86
        value = current.value;
87
88
        if ( !( element = elements[ name ] ) ) {
89
            continue;
90
        }
91
92
        type = ( len = element.length ) ? element[ 0 ] : element;
93
        type = ( type.type || type.nodeName ).toLowerCase();
94
        property = null;
95
96
        if ( rvalue.test( type ) ) {
97
            if ( len ) {
98
                j = names[ name ];
99
                element = element[ names[ name ] = ( j == undefined ) ? 0 : ++j ];
100
            }
101
102
            if (element) {
103
                change.call( element, ( element.value = value ) );
104
            }
105
106
        } else if ( rcheck.test( type ) ) {
107
            property = "checked";
108
109
        } else if ( rselect.test( type ) ) {
110
            property = "selected";
111
        }
112
113
        if ( property ) {
114
            if ( !len ) {
115
                element = [ element ];
116
                len = 1;
117
            }
118
119
            for ( j = 0; j < len; j++ ) {
120
                current = element[ j ];
121
122
                if ( current.value == value ) {
123
                    change.call( current, ( current[ property ] = true ) && value );
124
                }
125
            }
126
        }
127
    }
128
129
    complete.call( this );
130
131
    return this;
132
};
133
134
})( 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