[Koha-patches] [PATCH] BUG6120 Add search links in detail pages
Fridolyn SOMERS
fridolyn.somers at progilone.fr
Thu Apr 7 16:22:48 CEST 2011
---
koha-tmpl/opac-tmpl/prog/en/css/opac.css | 6 +++---
koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 4 ++--
.../opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl | 1 +
.../opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl | 1 +
.../opac-tmpl/prog/en/modules/opac-detail.tmpl | 1 +
opac/opac-ISBDdetail.pl | 10 +++++++++-
opac/opac-MARCdetail.pl | 10 +++++++++-
opac/opac-detail.pl | 10 +++++++++-
opac/opac-main.pl | 20 ++++++++++++++++++++
opac/opac-search.pl | 9 +++++++++
10 files changed, 64 insertions(+), 8 deletions(-)
diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
index f04a51c..09c43a4 100644
--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css
+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
@@ -389,20 +389,20 @@ a .term {
}
/* action buttons */
-#action {
+#action, #searchlinks {
margin-top : .5em;
background-color : #F3F3F3;
border : 1px solid #E8E8E8;
padding-bottom : 3px;
}
-#action li {
+#action li, #searchlinks li {
list-style : none;
margin : .2em;
padding : .3em 0;
}
-#action a {
+#action a, #searchlinks a {
background-position : 5px center;
background-repeat : no-repeat;
text-decoration : none;
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
index df0b413..85910c5 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
@@ -72,9 +72,9 @@
<option value="callnum">Call Number</option>
<!-- /TMPL_IF --></select>
<!-- TMPL_IF NAME="ms_value" -->
- <input type="text" id = "transl1" name="q" value="<!-- TMPL_VAR ESCAPE="HTML" NAME="ms_value" -->" class="left" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
+ <input type="text" id = "transl1" name="q" value="<!-- TMPL_VAR ESCAPE="HTML" NAME="ms_value" -->" class="left focus" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
<!-- TMPL_ELSE -->
- <input type="text" id = "transl1" name="q" class="left" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
+ <input type="text" id = "transl1" name="q" class="left focus" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="OpacAddMastheadLibraryPulldown" -->
<select name="limit" id="masthead_search" class="left" style="max-width:10em;width:10em;">
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
index 5e9a640..8ba6b5c 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
@@ -103,6 +103,7 @@
<option value="ris">RIS</option>
</select><input type="hidden" name="op" value="export" /><input type="hidden" name="bib" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
<input type="submit" name="save" value="Go" /></form></div>
+<!-- TMPL_INCLUDE NAME="search-links.inc" -->
</div>
</div>
</div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl
index 5c50d64..983855d 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl
@@ -257,6 +257,7 @@ $(document).ready(function(){
<option value="marc8">MARC (non-Unicode/MARC-8)</option>
<option value="utf8">MARC (Unicode/UTF-8)</option> </select><input type="hidden" name="op" value="export" /><input type="hidden" name="bib" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
<input type="submit" name="save" value="Go" /></form></div>
+<!-- TMPL_INCLUDE NAME="search-links.inc" -->
</div>
</div>
</div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
index 52a866b..3286b49 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
@@ -845,6 +845,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
</select><input type="hidden" name="op" value="export" /><input type="hidden" name="bib" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
<input type="submit" name="save" value="Go" /></form>
</div>
+ <!-- TMPL_INCLUDE NAME="search-links.inc" -->
</div>
</div>
diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl
index b50947d..5b070d4 100755
--- a/opac/opac-ISBDdetail.pl
+++ b/opac/opac-ISBDdetail.pl
@@ -42,7 +42,7 @@ the items attached to the biblio
use strict;
use warnings;
-use C4::Auth;
+use C4::Auth qw(:DEFAULT get_session);
use C4::Context;
use C4::Output;
use CGI;
@@ -202,4 +202,12 @@ if ( C4::Context->preference("OPACAmazonEnabled") == 1 ) {
$template->param( AMAZONREVIEWS => \@reviews );
}
+# Get current search from session
+my $session = get_session($query->cookie("CGISESSID"));
+if ($session) {
+ foreach (qw(currentsearchquery currentsearchlimit currentsearchisoneresult)) {
+ $template->param( $_ => $session->param( $_ ) );
+ }
+}
+
output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl
index a5c9789..0d0a701 100755
--- a/opac/opac-MARCdetail.pl
+++ b/opac/opac-MARCdetail.pl
@@ -44,7 +44,7 @@ the items attached to the biblio
use strict;
use warnings;
-use C4::Auth;
+use C4::Auth qw(:DEFAULT get_session);
use C4::Context;
use C4::Output;
use CGI;
@@ -286,4 +286,12 @@ $template->param(
biblionumber => $biblionumber,
);
+# Get current search from session
+my $session = get_session($query->cookie("CGISESSID"));
+if ($session) {
+ foreach (qw(currentsearchquery currentsearchlimit currentsearchisoneresult)) {
+ $template->param( $_ => $session->param( $_ ) );
+ }
+}
+
output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index f230834..a1899fc 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -23,7 +23,7 @@ use strict;
use warnings;
use CGI;
-use C4::Auth;
+use C4::Auth qw(:DEFAULT get_session);
use C4::Branch;
use C4::Koha;
use C4::Serials; #uses getsubscriptionfrom biblionumber
@@ -567,4 +567,12 @@ my $defaulttab =
? 'serialcollection' : 'subscription';
$template->param('defaulttab' => $defaulttab);
+# Get current search from session
+my $session = get_session($query->cookie("CGISESSID"));
+if ($session) {
+ foreach (qw(currentsearchquery currentsearchlimit currentsearchisoneresult)) {
+ $template->param( $_ => $session->param( $_ ) );
+ }
+}
+
output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/opac/opac-main.pl b/opac/opac-main.pl
index 177d812..bf3313b 100755
--- a/opac/opac-main.pl
+++ b/opac/opac-main.pl
@@ -95,4 +95,24 @@ if (C4::Context->preference('GoogleIndicTransliteration')) {
$template->param('GoogleIndicTransliteration' => 1);
}
+# Restore current search index and query
+# multivalued CGI paramaters are returned as a packaged string separated by "\0" (null)
+my $param_idx = $input->param('idx') || '';
+my $param_q = $input->param('q') || '';
+
+# indexes are query qualifiers, like 'title', 'author', etc.
+# They can be single or multiple parameters separated by comma: kw,right-Truncation
+my @indexes = split("\0", $param_idx);
+# if a simple index (only one) display the index used in the top search box
+if ($indexes[0] && !$indexes[1]) {
+ $template->param( "ms_".$indexes[0] => 1 );
+}
+
+# an operand can be a single term, a phrase, or a complete ccl query
+my @operands = split("\0",$param_q);
+# if a simple search, display the value in the search box
+if ($operands[0] && !$operands[1]) {
+ $template->param( ms_value => $operands[0] );
+}
+
output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 778c7ca..e109a1b 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -118,6 +118,9 @@ if (C4::Context->preference('TagsEnabled')) {
}
}
+# Read session
+my $session = get_session($cgi->cookie("CGISESSID"));
+
## URI Re-Writing
# Deprecated, but preserved because it's interesting :-)
# The same thing can be accomplished with mod_rewrite in
@@ -394,6 +397,11 @@ if (C4::Context->preference('OpacSuppression')) {
$template->param ( LIMIT_INPUTS => \@limit_inputs );
+# Set session variables
+$session->param('currentsearchisoneresult', '0'); # init is only one result
+$session->param('currentsearchquery', $query_cgi);
+$session->param('currentsearchlimit', $limit_cgi);
+
## II. DO THE SEARCH AND GET THE RESULTS
my $total = 0; # the total results for the whole set
my $facets; # this object stores the faceted results that display on the left-hand of the results page
@@ -538,6 +546,7 @@ for (my $i=0;$i<@servers;$i++) {
} else {
print $cgi->redirect("/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber");
}
+ $session->param('currentsearchisoneresult', 1);
exit;
}
if ($hits) {
--
1.7.1
More information about the Koha-patches
mailing list