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

(-)a/koha-tmpl/opac-tmpl/prog/en/css/opac.css (+75 lines)
Lines 2014-2016 div.ft { Link Here
2014
#opac-isbddetail #isbdcontents { margin-top: 2em; }
2014
#opac-isbddetail #isbdcontents { margin-top: 2em; }
2015
2015
2016
div.bibmessage { background-color : #ffffb0; border-radius : 5px; padding : 3px; margin : 2px; }
2016
div.bibmessage { background-color : #ffffb0; border-radius : 5px; padding : 3px; margin : 2px; }
2017
2018
2019
/* pagination */
2020
.pagination {
2021
	padding-top:10px;
2022
	float:left;
2023
	width:100%;
2024
}
2025
2026
/* nav */
2027
.nav {
2028
	float:left
2029
}
2030
.nav ul {}
2031
.nav li {
2032
	list-style:none;
2033
	float:left;
2034
	padding:4px;
2035
	color:#999;
2036
}
2037
2038
.nav li a {
2039
	text-decoration:none!important;
2040
}
2041
2042
.nav li a:hover {
2043
	text-decoration:underline;
2044
}
2045
2046
.nav li ul {
2047
	float:left;
2048
}
2049
2050
.back {
2051
	float:right;
2052
}
2053
2054
.back input{
2055
	background:none!important;
2056
	color:#999!important;
2057
}
2058
#a_listResults{
2059
    float:left;
2060
}
2061
#listResults{
2062
    line-height: 0.7em;
2063
}
2064
.pagination_list {
2065
	float:bottom
2066
}
2067
.pagination_list ul {
2068
    margin-left: 150px;
2069
    padding-top: 40px;
2070
    width: 350px;
2071
}
2072
.pagination_list li {
2073
	list-style:none;
2074
	float:bottom;
2075
	padding:4px;
2076
	color:#999;
2077
    border-bottom : 1px solid #DDDDDD;
2078
}
2079
.pagination_list li.highlight {
2080
   background-color : #F3F3F3;
2081
   border-top : 1px solid #DDDDDD;
2082
   border-bottom : 1px solid #DDDDDD;
2083
}
2084
.pagination_list span.li_pag_index {
2085
   color : #999;
2086
   text-align: left;
2087
   font-size: 15px;
2088
   font-weight : bold;
2089
   padding-right: 10px;
2090
}
2091
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc (-1 lines)
Lines 2-8 Link Here
2
[% IF ( facets_loop ) %]
2
[% IF ( facets_loop ) %]
3
<div id="search-facets">
3
<div id="search-facets">
4
<h4>Refine your search</h4>
4
<h4>Refine your search</h4>
5
[% query_cgi %]
6
<ul>
5
<ul>
7
	<li>Availability<ul><li>[% IF ( available ) %]Showing only <strong>available</strong> items. <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi_not_availablity %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]">Show all items</a>[% ELSE %]Limit to <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;limit=available">currently available items.</a>[% END %]</li></ul>
6
	<li>Availability<ul><li>[% IF ( available ) %]Showing only <strong>available</strong> items. <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi_not_availablity %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]">Show all items</a>[% ELSE %]Limit to <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;limit=available">currently available items.</a>[% END %]</li></ul>
8
	[% IF ( related ) %] <li>(related searches: [% FOREACH relate IN related %][% relate.related_search %][% END %])</li>[% END %]
7
	[% IF ( related ) %] <li>(related searches: [% FOREACH relate IN related %][% relate.related_search %][% END %])</li>[% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+92 lines)
Lines 3-8 Link Here
3
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
3
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
4
<script type="text/JavaScript" language="JavaScript">
4
<script type="text/JavaScript" language="JavaScript">
5
//<![CDATA[
5
//<![CDATA[
6
    [% IF ( busc ) %]
7
        var arrPagination = new Array();
8
        var pag_index_ini = 0;
9
        [% IF ( listResults ) %]
10
            [% FOREACH listResult IN listResults %]
11
                if (!pag_index_ini) pag_index_ini = [% listResult.index %];
12
                arrPagination[[% listResult.index %]] = {url:"[% listResult.url %]", title:"[% listResult.title|html %]", author:"[% listResult.author|html %]", biblionumber:[% listResult.biblionumber %]};
13
           [% END %]
14
        [% END %]
15
    [% END %]
16
17
6
     $(document).ready(function() { 
18
     $(document).ready(function() { 
7
        $('#bibliodescriptions > ul').tabs();
19
        $('#bibliodescriptions > ul').tabs();
8
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]$("#tagform").hide();
20
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]$("#tagform").hide();
Lines 24-32 Link Here
24
        });[% IF ( GoogleJackets ) %]
36
        });[% IF ( GoogleJackets ) %]
25
        KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);[% END %][% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]
37
        KOHA.Google.GetCoverFromIsbn([% covernewwindow %]);[% END %][% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]
26
        $(".tagbutton").click(KOHA.Tags.add_tag_button);[% END %][% END %][% END %]
38
        $(".tagbutton").click(KOHA.Tags.add_tag_button);[% END %][% END %][% END %]
39
        $("#a_listResults").click(function() {
40
            var ul_in = $(this).next("ul");
41
            var div_pag_list = $(".pagination_list");
42
            if (ul_in.css("display") == 'none') {
43
                ul_in.show();
44
                $(this).attr('title','Hide pagination list');
45
                div_pag_list.show();
46
                renderPagination(pag_index_ini, arrPagination.length - 1, $("#ul_pagination_list"), false);
47
            } else {
48
                ul_in.hide();
49
                $(this).attr('title','Show pagination list');
50
                div_pag_list.hide();
51
            }
52
        });
53
        $(".a_pag").mouseover(function() {
54
            var id = $(this).attr("id");
55
            renderPagination(parseInt(id.substr("a_pag_".length), 10), arrPagination.length - 1, $("#ul_pagination_list"), true);
56
        });
27
57
28
});
58
});
29
59
60
61
function renderPagination(index, total, ul, highlIndex)
62
{
63
    for (var i = pag_index_ini; i <= total; i++) {
64
        if (arrPagination[i] == undefined || arrPagination[i].url == "") continue;
65
        $("#li_pag_" + i).remove();
66
    }
67
    var j = 0;
68
    for (i = index; i <= total; i++) {
69
        if (arrPagination[i] == undefined || arrPagination[i].url == "") continue;
70
        var li = $("<li id='li_pag_" + i + "' " + ((j % 2 == 0)?"class='highlight'":"")  + " title='Go to detail' />");
71
        var html = "<span class='li_pag_index'>" + i + "</span><a href='" + arrPagination[i].url + "'>" + arrPagination[i].title + "</a>";
72
        if (arrPagination[i].author) html += "<br /> by " + arrPagination[i].author;
73
        li.html(html);
74
        if (highlIndex && i == index) li.css("backgroundColor", "#DDDDDD");
75
        ul.append(li);
76
        j++;
77
    }
78
    for (i = pag_index_ini; i < index; i++) {
79
        if (arrPagination[i] == undefined || arrPagination[i].url == "") continue;
80
        $("#li_pag_" + i).remove();
81
        var li = $("<li id='li_pag_" + i + "' " + ((j % 2 == 0)?"class='highlight'":"")  + " title='Go to detail' />");
82
        var html = "<span class='li_pag_index'>" + i + "</span><a href='" + arrPagination[i].url + "'>" + arrPagination[i].title + "</a>";
83
        if (arrPagination[i].author) html += "<br /> by " + arrPagination[i].author;
84
        li.html(html);
85
        ul.append(li);
86
        j++;
87
    }
88
}//renderPagination
89
90
30
YAHOO.util.Event.onContentReady("furtherm", function () {
91
YAHOO.util.Event.onContentReady("furtherm", function () {
31
    $("#furtherm").css("display","block").css("visibility","hidden");
92
    $("#furtherm").css("display","block").css("visibility","hidden");
32
	$("#furthersearches").parent().show();
93
	$("#furthersearches").parent().show();
Lines 787-792 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
787
[% END %]
848
[% END %]
788
[% END %]
849
[% END %]
789
850
851
<div class="pagination">
852
[% IF ( busc ) %]
853
<div class="nav">
854
    <ul>
855
        <li class="first">[% IF ( previous ) %]<a href="[% previous %]" title="See: [% IF ( previousTitle ) %][% previousTitle |html %][% ELSE %]previous biblio[% END %]">&laquo; previous</a>[% ELSE %]previous[% END %]</li>
856
        <li class="last">[% IF ( next ) %]<a href="[% next %]" title="See: [% IF ( nextTitle ) %][% nextTitle |html %][% ELSE %]next biblio[% END %]">next &raquo;</a>[% ELSE %]next[% END %]</li>
857
        [% IF ( listResults ) %]
858
            <li><a href="#" id="a_listResults" title="Show pagination list">...</a><ul id="listResults" style="display:none">
859
            [% FOREACH listResult IN listResults %]
860
            <li>[% IF ( listResult.url ) %]<a href="[% listResult.url %]" title="See biblio &quot;[% listResult.title|html %]&quot; [% IF ( listResult.author ) %] by &quot;[% listResult.author|html %]&quot;[% END %] with biblionumber [% listResult.biblionumber %]" class="a_pag" id="a_pag_[% listResult.index %]">[% listResult.index %]</a>[% ELSE %][% listResult.index %][% END %]</li>
861
            [% END %]
862
            </ul></li>
863
        [% END %]
864
    </ul>
865
</div>
866
<div class="back">
867
    <span class="btn boton_gris"><input style="font-weight:normal !important;" type="button" value="&laquo; back to results" onclick="window.location.href = 'opac-search.pl?[% busc %]'" /></span>
868
</div>
869
[% IF ( listResults ) %]
870
<div class="pagination_list" style="display:none">
871
    <ul id="ul_pagination_list">
872
    </ul>
873
</div>
874
[% END %]
875
[% ELSE %]
876
<div class="back">
877
    <span class="btn boton_gris"><input style="font-weight:normal !important;" type="button" value="&laquo; back" onclick="history.back(-1);" /></span>
878
</div>
879
[% END %]
880
</div>
881
790
</div>
882
</div>
791
</div>
883
</div>
792
</div>
884
</div>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (-2 / +2 lines)
Lines 413-419 $(document).ready(function(){ Link Here
413
				[% IF ( SEARCH_RESULT.BiblioDefaultViewmarc ) %]<a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]" title="View details for this title">
413
				[% IF ( SEARCH_RESULT.BiblioDefaultViewmarc ) %]<a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]" title="View details for this title">
414
                                [% ELSE %]
414
                                [% ELSE %]
415
                                [% IF ( SEARCH_RESULT.BiblioDefaultViewisbd ) %]<a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]" title="View details for this title">
415
                                [% IF ( SEARCH_RESULT.BiblioDefaultViewisbd ) %]<a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]" title="View details for this title">
416
                                [% ELSE %]<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]" title="View details for this title">
416
                                [% ELSE %]<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %][% pasarParams |url %]" title="View details for this title">
417
                                [% END %]
417
                                [% END %]
418
                                [% END %]
418
                                [% END %]
419
								[% IF ( SEARCH_RESULT.title ) %][% SEARCH_RESULT.title |html %][% ELSE %]No title[% END %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %][% subtitl.subfield %][% END %]</a>
419
								[% IF ( SEARCH_RESULT.title ) %][% SEARCH_RESULT.title |html %][% ELSE %]No title[% END %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %][% subtitl.subfield %][% END %]</a>
Lines 526-532 $(document).ready(function(){ Link Here
526
        		[% IF ( opacbookbag ) %]<a class="addtocart" href="#" onclick="addRecord('[% SEARCH_RESULT.biblionumber %]'); return false;">Add to Cart</a>[% END %]
526
        		[% IF ( opacbookbag ) %]<a class="addtocart" href="#" onclick="addRecord('[% SEARCH_RESULT.biblionumber %]'); return false;">Add to Cart</a>[% END %]
527
				</span>
527
				</span>
528
				</td><td>
528
				</td><td>
529
					<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">
529
					<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %][% pasarParams |url %]">
530
                    [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<img src="http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" />[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %][% END %]
530
                    [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<img src="http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" />[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %][% END %]
531
531
532
					[% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %]
532
					[% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %]
(-)a/opac/opac-detail.pl (+246 lines)
Lines 66-71 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
66
66
67
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
67
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
68
68
69
# We look for the busc param to build the simple paging from the search
70
my %paging = (previous => {}, next => {});
71
if ($query->param('busc')) {
72
    use Compress::Zlib;
73
    use MIME::Base64;
74
    use URI::Escape;
75
    use C4::Search;
76
77
    # Rebuild the encrypted busc param
78
    sub rebuildBuscParam
79
    {
80
        my $arrParamsBusc = shift;
81
82
        my $pasarParams = '';
83
        my $j = 0;
84
        for (keys %$arrParamsBusc) {
85
            if ($_ =~ /^(?:query|listBiblios|query_type|simple_query|total|offset|offsetPrev|count|expand|scan)/) {
86
                if (defined($arrParamsBusc->{$_})) {
87
                    $pasarParams .= '&amp;' if ($j);
88
                    $pasarParams .= $_ . '=' . $arrParamsBusc->{$_};
89
                    $j++;
90
                }
91
            } else {
92
                for my $value (@{$arrParamsBusc->{$_}}) {
93
                    $pasarParams .= '&amp;' if ($j);
94
                    $pasarParams .= $_ . '=' . $value;
95
                    $j++;
96
                }
97
            }
98
        }
99
        my $pasarParamsEnc = compress($pasarParams, Z_BEST_COMPRESSION);
100
        $pasarParamsEnc = encode_base64($pasarParamsEnc);
101
        $pasarParamsEnc = uri_escape($pasarParamsEnc);
102
        return $pasarParamsEnc;
103
    }#rebuildBuscParam
104
105
    my $busc = uri_unescape($query->param("busc"));
106
    my $buscOrig = uri_escape($busc);
107
    $busc = decode_base64($busc);
108
    $busc = uncompress($busc);
109
    my $buscParam = '';
110
    my $j = 0;
111
    # Rebuild the query for the button "back to results"
112
    for (split(/\&(?:amp;)?/, $busc)) {
113
        unless ($_ =~ /^(?:query|listBiblios|query_type|simple_query|total|offsetPrev)/) {
114
            $buscParam .= '&amp;' unless ($j == 0);
115
            $buscParam .= $_;
116
            $j++;
117
        }
118
    }
119
    $template->param('busc' => $buscParam);
120
    my ($key, $value);
121
    my %arrParamsBusc = ();
122
    for (split(/\&(?:amp;)?/, $busc)) {
123
        ($key, $value) = split(/=/, $_, 2);
124
        if ($key =~ /^(?:query|listBiblios|query_type|simple_query|total|offset|offsetPrev|count|expand|scan)/) {
125
            $arrParamsBusc{$key} = $value;
126
        } else {
127
            unless (exists($arrParamsBusc{$key})) {
128
                $arrParamsBusc{$key} = [];
129
            }
130
            push @{$arrParamsBusc{$key}}, $value;
131
        }
132
    }
133
    my $searchAgain = 0;
134
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
135
    my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
136
    my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
137
    my $offsetSearch;
138
    my @arrBiblios;
139
    # We are inside the list of biblios and we don't have to search
140
    if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
141
        @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
142
        if (@arrBiblios) {
143
            # We are at the first item of the block
144
            if ($arrBiblios[0] == $biblionumber) {
145
                if (@arrBiblios > 1) {
146
                    for (my $j = 1; $j < @arrBiblios; $j++) {
147
                        next unless ($arrBiblios[$j]);
148
                        $paging{'next'}->{biblionumber} = $arrBiblios[$j];
149
                        last;
150
                    }
151
                }
152
                # search again if we are not at the first searching block
153
                if ($offset) {
154
                    $searchAgain = 1;
155
                    $offsetSearch = $offset - $results_per_page;
156
                }
157
            # we are at the last item of the block
158
            } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
159
                for (my $j = $#arrBiblios - 1; $j >= 0; $j--) {
160
                    next unless ($arrBiblios[$j]);
161
                    $paging{'previous'}->{biblionumber} = $arrBiblios[$j];
162
                    last;
163
                }
164
                if (!$offset) {
165
                    # search again if we are at the first block and there is more results
166
                    $searchAgain = 1 if ($arrParamsBusc{'total'} != @arrBiblios);
167
                } else {
168
                    # search again if we aren't at the first block and there is more results
169
                    $searchAgain = 1 if ($arrParamsBusc{'total'} > ($offset + @arrBiblios));
170
                }
171
                $offsetSearch = $offset + $results_per_page if ($searchAgain);
172
            } else {
173
                for (my $j = 1; $j < $#arrBiblios; $j++) {
174
                    if ($arrBiblios[$j] == $biblionumber) {
175
                        for (my $z = $j - 1; $z >= 0; $z--) {
176
                            next unless ($arrBiblios[$z]);
177
                            $paging{'previous'}->{biblionumber} = $arrBiblios[$z];
178
                            last;
179
                        }
180
                        for (my $z = $j + 1; $z < @arrBiblios; $z++) {
181
                            next unless ($arrBiblios[$z]);
182
                            $paging{'next'}->{biblionumber} = $arrBiblios[$z];
183
                            last;
184
                        }
185
                        last;
186
                    }
187
                }
188
            }
189
        }
190
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
191
        unless ($searchAgain) {
192
            $paging{'previous'}->{busc} = $buscOrig if ($paging{'previous'}->{biblionumber});
193
            $paging{'next'}->{busc} = $buscOrig if ($paging{'next'}->{biblionumber});
194
        } else {
195
            if ($paging{'previous'}->{biblionumber}) {
196
                $paging{'previous'}->{busc} = $buscOrig;
197
            }
198
            if ($paging{'next'}->{biblionumber}) {
199
                $paging{'next'}->{busc} = $buscOrig;
200
            }
201
            if (!$paging{'previous'}->{biblionumber}) {
202
                $arrParamsBusc{'offsetPrev'} = $offset;
203
                $arrParamsBusc{'offset'} = $offsetSearch;
204
                delete $arrParamsBusc{'listBiblios'};
205
                $paging{'previous'}->{busc} = rebuildBuscParam(\%arrParamsBusc);
206
            } elsif (!$paging{'next'}->{biblionumber} && $arrParamsBusc{'total'} > ($offset + @arrBiblios)) {
207
                $arrParamsBusc{'offsetPrev'} = $offset;
208
                $arrParamsBusc{'offset'} = $offsetSearch;
209
                delete $arrParamsBusc{'listBiblios'};
210
                $paging{'next'}->{busc} = rebuildBuscParam(\%arrParamsBusc);
211
            }
212
        }
213
    } else { # We have to search
214
        my $expanded_facet = $arrParamsBusc{'expand'};
215
        my $branches = GetBranches();
216
        my @servers;
217
        @servers = @{$arrParamsBusc{'server'}} if $arrParamsBusc{'server'};
218
        @servers = ("biblioserver") unless (@servers);
219
        my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
220
        my @sort_by = @{$arrParamsBusc{'sort_by'}} if $arrParamsBusc{'sort_by'};
221
        $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
222
        my ($error, $results_hashref, $facets);
223
        eval {
224
            ($error, $results_hashref, $facets) = getRecords($arrParamsBusc{'query'},$arrParamsBusc{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$arrParamsBusc{'query_type'},$arrParamsBusc{'scan'});
225
        };
226
        my $hits;
227
        my @newresults;
228
        for (my $i=0;$i<@servers;$i++) {
229
            my $server = $servers[$i];
230
            $hits = $results_hashref->{$server}->{"hits"};
231
            @newresults = searchResults('opac', '', $hits, $results_per_page, $offset, $arrParamsBusc{'scan'}, @{$results_hashref->{$server}->{"RECORDS"}},, C4::Context->preference('hidelostitems'));
232
        }
233
        # build the new listBiblios
234
        my $listBiblios = '';
235
        my $j = 0;
236
        # add new list param
237
        foreach (@newresults) {
238
            my $bibnum = ($_->{biblionumber})?$_->{biblionumber}:0;
239
            $listBiblios .= $bibnum . ',';
240
            $j++;
241
            last if ($j == $results_per_page);
242
        }
243
        chop $listBiblios if ($listBiblios =~ /,$/);
244
        $arrParamsBusc{'listBiblios'} = $listBiblios;
245
        @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
246
        if (@arrBiblios && !$biblionumber) {
247
            if (defined($arrParamsBusc{'offsetPrev'})) {
248
                $biblionumber = ($offset > $arrParamsBusc{'offsetPrev'})?$arrBiblios[0]:$arrBiblios[$#arrBiblios];
249
            } else {
250
                $biblionumber = $arrBiblios[0];
251
            }
252
        }
253
        # From the new list we build again the next and previous result
254
        if (@arrBiblios) {
255
            if ($arrBiblios[$#arrBiblios] == $biblionumber) {
256
                for (my $j = 0; $j < @newresults; $j++) {
257
                    next unless ($newresults[$j]);
258
                    $paging{'previous'}->{biblionumber} = $newresults[$j]->{biblionumber};
259
                    last;
260
                }
261
            } elsif ($arrBiblios[0] == $biblionumber) {
262
                for (my $j = $#newresults; $j >= 0; $j--) {
263
                    next unless ($newresults[$j]);
264
                    $paging{'next'}->{biblionumber} = $newresults[$j]->{biblionumber};
265
                    last;
266
                }
267
            }
268
        }
269
        # build new busc param
270
        $buscOrig = rebuildBuscParam(\%arrParamsBusc);
271
        if ($paging{'next'}->{biblionumber}) {
272
            $paging{'next'}->{busc} = $buscOrig;
273
        }
274
        if ($paging{'previous'}->{biblionumber}) {
275
            $paging{'previous'}->{busc} = $buscOrig;
276
        }
277
        if (!$paging{'previous'}->{biblionumber}) {
278
            $arrParamsBusc{'offset'} = $arrParamsBusc{'offsetPrev'};
279
            $arrParamsBusc{'offsetPrev'} = $offset;
280
            delete $arrParamsBusc{'listBiblios'};
281
            $paging{'previous'}->{busc} = rebuildBuscParam(\%arrParamsBusc);
282
        } elsif (!$paging{'next'}->{biblionumber} && $arrParamsBusc{'total'} > ($offset + @arrBiblios)) {
283
            $arrParamsBusc{'offset'} = $arrParamsBusc{'offsetPrev'};
284
            $arrParamsBusc{'offsetPrev'} = $offset;
285
            delete $arrParamsBusc{'listBiblios'};
286
            $paging{'next'}->{busc} = rebuildBuscParam(\%arrParamsBusc);
287
        }
288
    }
289
    
290
    # Previous biblio
291
    my $previous = 'opac-detail.pl?' . (($paging{'previous'}->{biblionumber})?'biblionumber=' . $paging{'previous'}->{biblionumber} . '&amp;':'') . 'busc=' . $paging{'previous'}->{busc} if ($paging{'previous'}->{busc});
292
    my $dataBiblioPaging = GetBiblioData($paging{'previous'}->{biblionumber});
293
    if ($dataBiblioPaging) {
294
        $template->param('previousTitle' => $dataBiblioPaging->{'title'});
295
    }
296
    # Next biblio
297
    my $next = 'opac-detail.pl?' . (($paging{'next'}->{biblionumber})?'biblionumber=' . $paging{'next'}->{biblionumber} . '&amp;':'') . 'busc=' . $paging{'next'}->{busc} if ($paging{'next'}->{busc});
298
    $dataBiblioPaging = GetBiblioData($paging{'next'}->{biblionumber});
299
    if ($dataBiblioPaging) {
300
        $template->param('nextTitle' => $dataBiblioPaging->{'title'});
301
    }
302
    $template->param('previous' => $previous, 'next' => $next);
303
    # Partial list of biblio results
304
    my @listResults;
305
    for (my $j = 0; $j < @arrBiblios; $j++) {
306
        next unless ($arrBiblios[$j]);
307
        $dataBiblioPaging = GetBiblioData($arrBiblios[$j]) if ($arrBiblios[$j] != $biblionumber);
308
        push @listResults, {index => $j + 1 + $offset, biblionumber => $arrBiblios[$j], title => ($arrBiblios[$j] == $biblionumber)?'':$dataBiblioPaging->{title}, author => ($arrBiblios[$j] != $biblionumber && $dataBiblioPaging->{author})?$dataBiblioPaging->{author}:'', url => ($arrBiblios[$j] == $biblionumber)?'':'opac-detail.pl?biblionumber=' . $arrBiblios[$j] . '&amp;busc=' . $buscOrig};
309
    }
310
    $template->param('listResults' => \@listResults) if (@listResults);
311
}
312
313
314
69
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
315
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
70
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
316
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
71
317
(-)a/opac/opac-search.pl (-1 / +49 lines)
Lines 39-44 use C4::Branch; # GetBranches Link Here
39
use POSIX qw(ceil floor strftime);
39
use POSIX qw(ceil floor strftime);
40
use URI::Escape;
40
use URI::Escape;
41
use Storable qw(thaw freeze);
41
use Storable qw(thaw freeze);
42
use Compress::Zlib;
43
use MIME::Base64;
44
42
45
43
46
44
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
47
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
Lines 84-89 else { Link Here
84
    authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
87
    authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
85
    }
88
    }
86
);
89
);
90
91
87
if ($template_name eq 'opac-results.tmpl') {
92
if ($template_name eq 'opac-results.tmpl') {
88
   $template->param('COinSinOPACResults' => C4::Context->preference('COinSinOPACResults'));
93
   $template->param('COinSinOPACResults' => C4::Context->preference('COinSinOPACResults'));
89
}
94
}
Lines 269-274 my $params = $cgi->Vars; Link Here
269
my $tag;
274
my $tag;
270
$tag = $params->{tag} if $params->{tag};
275
$tag = $params->{tag} if $params->{tag};
271
276
277
278
# String with params with the search criteria for the paging in opac-detail
279
my $pasarParams = '';
280
my $j = 0;
281
for (keys %$params) {
282
    my @pasarParam = split("\0", $params->{$_});
283
    for my $paramValue(@pasarParam) {
284
        $pasarParams .= '&amp;' if ($j > 0);
285
        $pasarParams .= $_ . '=' . $paramValue;
286
        $j++;
287
    }
288
}
289
#
290
291
272
# Params that can have more than one value
292
# Params that can have more than one value
273
# sort by is used to sort the query
293
# sort by is used to sort the query
274
# in theory can have more than one but generally there's just one
294
# in theory can have more than one but generally there's just one
Lines 422-427 elsif (C4::Context->preference('NoZebra')) { Link Here
422
        ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
442
        ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
423
    };
443
    };
424
} else {
444
} else {
445
    $pasarParams .= '&amp;query=' . $query;
446
    $pasarParams .= '&amp;simple_query=' . $simple_query;
447
    $pasarParams .= '&amp;query_type=' . $query_type if ($query_type);
425
    eval {
448
    eval {
426
        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
449
        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
427
    };
450
    };
Lines 543-548 for (my $i=0;$i<@servers;$i++) { Link Here
543
            exit;
566
            exit;
544
        }
567
        }
545
        if ($hits) {
568
        if ($hits) {
569
            if (!C4::Context->preference('NoZebra') && !$build_grouped_results) {
570
                # We build the encrypted list of first OPACnumSearchResults biblios to pass with the search criteria for paging on opac-detail
571
                $pasarParams .= '&amp;listBiblios=';
572
                my $j = 0;
573
                foreach (@newresults) {
574
                    my $bibnum = ($_->{biblionumber})?$_->{biblionumber}:0;
575
                    $pasarParams .= $bibnum . ',';
576
                    $j++;
577
                    last if ($j == $results_per_page);
578
                }
579
                chop $pasarParams if ($pasarParams =~ /,$/);
580
                $pasarParams .= '&amp;total=' . int($total) if ($pasarParams !~ /total=(?:[0-9]+)?/);
581
                if ($pasarParams) {
582
                    my $pasarParamsEnc = compress($pasarParams, Z_BEST_COMPRESSION);
583
                    $pasarParamsEnc = encode_base64($pasarParamsEnc);
584
                    $pasarParamsEnc = uri_escape($pasarParamsEnc);
585
                    my $pasarParamsFinal = '&amp;busc=' . $pasarParamsEnc;
586
                    $template->param('pasarParams' => $pasarParamsFinal);
587
                    foreach (@newresults) {
588
                        if ($_->{XSLTResultsRecord}) {
589
                            $_->{XSLTResultsRecord} =~ s/(opac-detail\.pl\?biblionumber=[0-9]+)/$1$pasarParamsFinal/g;
590
                        }
591
                    }
592
                }
593
                #
594
            }
546
            $template->param(total => $hits);
595
            $template->param(total => $hits);
547
            my $limit_cgi_not_availablity = $limit_cgi;
596
            my $limit_cgi_not_availablity = $limit_cgi;
548
            $limit_cgi_not_availablity =~ s/&limit=available//g if defined $limit_cgi_not_availablity;
597
            $limit_cgi_not_availablity =~ s/&limit=available//g if defined $limit_cgi_not_availablity;
549
- 

Return to bug 6483