Bugzilla – Attachment 26023 Details for
Bug 11515
Encoding problem with OpacBrowseResults
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11515 - Encoding problem with OpacBrowseResults
Bug-11515---Encoding-problem-with-OpacBrowseResult.patch (text/plain), 8.50 KB, created by
Biblibre Sandboxes
on 2014-03-10 15:57:28 UTC
(
hide
)
Description:
Bug 11515 - Encoding problem with OpacBrowseResults
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2014-03-10 15:57:28 UTC
Size:
8.50 KB
patch
obsolete
>From 807da7e7edc1f149cd3e3862d816a7b6be38c532 Mon Sep 17 00:00:00 2001 >From: Fridolin SOMERS <fridolin.somers@biblibre.com> >Date: Fri, 10 Jan 2014 11:52:22 +0100 >Subject: [PATCH] Bug 11515 - Encoding problem with OpacBrowseResults >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >When OpacBrowseResults syspref is on, the detail page contains a results browser. >When search terms contains non-ASCII character, the search query is not well encoded in this browser. > >This patch adds the URI-coding to search terms into session to avoid any encoding problem with diacritics and URI specific characters like ?,& ... >So that TT parameter 'busc' is already URI encoded and can be used to recreate seach URL. > >Test plan : >- Set OpacBrowseResults on >- At OPAC, perform a search with a diacritique. For example 'déjà ' >- Go to detail page of a result >=> You see browser under "Browser results" >- Click on "Back to results" >=> You get same results and same search term with correct encoding > >Signed-off-by: Broust <jean-manuel.broust@univ-lyon2.fr> >--- > .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 3 ++- > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 1 + > opac/opac-detail.pl | 12 +++++++----- > opac/opac-search.pl | 15 ++++++++------- > 4 files changed, 18 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index 64821b9..db0a418 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1026,7 +1026,8 @@ > <span>Previous</span> > [% END %] > </li> >- <li class="back_results"><a href="opac-search.pl?[% busc |url %]" title="Back to the results search list">Back to results</a></li> >+ [%# busc is already URI encoded %] >+ <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list">Back to results</a></li> > <li class="right_results"> > [% IF ( next ) %]<a href="[% next %]" title="See: [% IF ( nextTitle ) %][% nextTitle |html %][% ELSE %]next biblio[% END %]">Next »</a> > [% ELSE %] >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 26bbbc4..6507228 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -1417,6 +1417,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > <div class="l_Results">[% IF ( listResults ) %]<a href="#" id="a_listResults" title="Show pagination list ([% indexPag %]-[% indexPagEnd %] / [% totalPag %])">Browse results</a>[% ELSE %]<span>Browse results</span>[% END %]</div> > <ul class="pg_menu clearfix"> > <li class="left_results">[% IF ( previous ) %]<a href="[% previous %]" title="See: [% IF ( previousTitle ) %][% previousTitle |html %][% ELSE %]previous biblio[% END %]">« Previous</a>[% ELSE %]<span>Previous</span>[% END %]</li> >+ [%# busc ise already URI encoded %] > <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list">Back to results</a></li> > <li class="right_results">[% IF ( next ) %]<a href="[% next %]" title="See: [% IF ( nextTitle ) %][% nextTitle |html %][% ELSE %]next biblio[% END %]">Next »</a>[% ELSE %]<span>Next</span>[% END %]</li> > </ul> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 0c2a6d9..96e11a9 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -121,8 +121,10 @@ my $session = get_session($query->cookie("CGISESSID")); > my %paging = (previous => {}, next => {}); > if ($session->param('busc')) { > use C4::Search; >+ use URI::Escape; > > # Rebuild the string to store on session >+ # param value is URI encoded and params separator is HTML encode (&) > sub rebuildBuscParam > { > my $arrParamsBusc = shift; >@@ -133,13 +135,13 @@ if ($session->param('busc')) { > if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) { > if (defined($arrParamsBusc->{$_})) { > $pasarParams .= '&' if ($j); >- $pasarParams .= $_ . '=' . $arrParamsBusc->{$_}; >+ $pasarParams .= $_ . '=' . uri_escape( $arrParamsBusc->{$_} ); > $j++; > } > } else { > for my $value (@{$arrParamsBusc->{$_}}) { > $pasarParams .= '&' if ($j); >- $pasarParams .= $_ . '=' . $value; >+ $pasarParams .= $_ . '=' . uri_escape($value); > $j++; > } > } >@@ -201,12 +203,12 @@ if ($session->param('busc')) { > for (@arrBusc) { > ($key, $value) = split(/=/, $_, 2); > if ($key =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/) { >- $arrParamsBusc{$key} = $value; >+ $arrParamsBusc{$key} = uri_unescape($value); > } else { > unless (exists($arrParamsBusc{$key})) { > $arrParamsBusc{$key} = []; > } >- push @{$arrParamsBusc{$key}}, $value; >+ push @{$arrParamsBusc{$key}}, uri_unescape($value); > } > } > my $searchAgain = 0; >@@ -279,7 +281,7 @@ if ($session->param('busc')) { > for (@arrBusc) { > unless ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|count|offsetSearch)/) { > $buscParam .= '&' unless ($j == 0); >- $buscParam .= $_; >+ $buscParam .= $_; # string already URI encoded > $j++; > } > } >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 617d67e..a6e3438 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -330,13 +330,14 @@ $tag = $params->{tag} if $params->{tag}; > > > # String with params with the search criteria for the paging in opac-detail >+# param value is URI encoded and params separator is HTML encode (&) > my $pasarParams = ''; > my $j = 0; > for (keys %$params) { > my @pasarParam = $cgi->param($_); > for my $paramValue(@pasarParam) { > $pasarParams .= '&' if ($j > 0); >- $pasarParams .= $_ . '=' . $paramValue; >+ $pasarParams .= $_ . '=' . uri_escape($paramValue); > $j++; > } > } >@@ -511,10 +512,10 @@ if ($tag) { > ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); > }; > } else { >- $pasarParams .= '&query=' . $query; >- $pasarParams .= '&count=' . $results_per_page; >- $pasarParams .= '&simple_query=' . $simple_query; >- $pasarParams .= '&query_type=' . $query_type if ($query_type); >+ $pasarParams .= '&query=' . uri_escape($query); >+ $pasarParams .= '&count=' . uri_escape($results_per_page); >+ $pasarParams .= '&simple_query=' . uri_escape($simple_query); >+ $pasarParams .= '&query_type=' . uri_escape($query_type) if ($query_type); > eval { > ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan,1); > }; >@@ -667,12 +668,12 @@ for (my $i=0;$i<@servers;$i++) { > my $j = 0; > foreach (@newresults) { > my $bibnum = ($_->{biblionumber})?$_->{biblionumber}:0; >- $pasarParams .= $bibnum . ','; >+ $pasarParams .= uri_escape($bibnum) . ','; > $j++; > last if ($j == $results_per_page); > } > chop $pasarParams if ($pasarParams =~ /,$/); >- $pasarParams .= '&total=' . int($total) if ($pasarParams !~ /total=(?:[0-9]+)?/); >+ $pasarParams .= '&total=' . uri_escape( int($total) ) if ($pasarParams !~ /total=(?:[0-9]+)?/); > if ($pasarParams) { > my $session = get_session($cgi->cookie("CGISESSID")); > $session->param('busc' => $pasarParams); >-- >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 11515
:
24113
|
26023
|
32063
|
33084