[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/opac search [dev_week]
From: |
Joshua Ferraro |
Subject: |
[Koha-cvs] koha/opac search [dev_week] |
Date: |
Mon, 09 Oct 2006 14:12:56 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Joshua Ferraro <kados> 06/10/09 14:12:56
Modified files:
opac : search
Log message:
pages numbers fix for results that have less than 10 pages of results:
the display only shows the number of pages now.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/search?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.6&r2=1.1.2.7
Patches:
Index: search
===================================================================
RCS file: /sources/koha/koha/opac/Attic/search,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -b -r1.1.2.6 -r1.1.2.7
--- search 8 Oct 2006 18:42:45 -0000 1.1.2.6
+++ search 9 Oct 2006 14:12:56 -0000 1.1.2.7
@@ -2,7 +2,7 @@
# Script to perform searching
# For documentation try 'perldoc /path/to/search'
#
-# $Header: /sources/koha/koha/opac/Attic/search,v 1.1.2.6 2006/10/08 18:42:45
kados Exp $
+# $Header: /sources/koha/koha/opac/Attic/search,v 1.1.2.7 2006/10/09 14:12:56
kados Exp $
#
# Copyright 2006 LibLime
#
@@ -403,6 +403,13 @@
$hits = $results_hashref->{$server}->{"hits"};
my @newresults = searchResults(
$search_desc,$hits,$results_per_page,$offset,@{$results_hashref->{$server}->{"RECORDS"}});
$total = $total + $results_hashref->{$server}->{"hits"};
+
+ ## If there's just one result, redirect to the detail page
+ if ($total == 1) {
+ my address@hidden>{biblionumber};
+ print $cgi->redirect("/bib/$biblionumber");
+ exit;
+ }
if ($hits) {
$template->param(total => $hits);
$template->param(searchdesc => $search_desc );
@@ -422,12 +429,21 @@
my $next_page_offset = $offset + $results_per_page;
# If we're within the first 10 pages, keep it simple
+ warn "current page:".$current_page_number;
if ($current_page_number < 10) {
# just show the first 10 pages
- for ($i=1; $i<=10;$i++) {
+ #
+ # Loop through the pages
+ my $pages_to_show = 10;
+ $pages_to_show = $pages if $pages<10;
+ for ($i=1; $i<=$pages_to_show;$i++) {
+ # the offset for this page
my $this_offset =
(($i*$results_per_page)-$results_per_page);
+ # the page number for this page
my $this_page_number = $i;
+ # it should only be highlighted if it's
the current page
my $highlight = 1 if ($this_page_number
== $current_page_number);
+ # put it in the array
push @page_numbers, { offset =>
$this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join
" ",@sort_by };
}
}
@@ -472,6 +488,7 @@
} #/end of the for loop
#$template->param(FEDERATED_RESULTS => address@hidden);
+
$template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary"))
if (C4::Context->preference("Disable_Dictionary"));
$template->param(
@@ -492,6 +509,7 @@
scan_use => $scan,
search_error => $error,
);
+
## Now let's find out if we have any supplemental data to show the user
# and in the meantime, save the current query for statistical purposes, etc.
my $koha_spsuggest; # a flag to tell if we've got suggestions coming from Koha
@@ -504,7 +522,7 @@
my $koha_spsuggest_dbh;
# FIXME: this needs to be moved to Context.pm
eval {
-
$koha_spsuggest_dbh=DBI->connect("DBI:mysql:suggest:66.213.78.76","auth","Free2cirC");
+
$koha_spsuggest_dbh=DBI->connect("DBI:mysql:suggest:66.213.78.79","auth","Free2cirC");
};
if ($@) { warn "can't connect to spsuggest db";
}