koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha catalogue/search.pl koha-tmpl/intranet-tmp...


From: Antoine Farnault
Subject: [Koha-cvs] koha catalogue/search.pl koha-tmpl/intranet-tmp...
Date: Fri, 13 Jul 2007 15:37:20 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Antoine Farnault <toins>        07/07/13 15:37:20

Modified files:
        catalogue      : search.pl 
        koha-tmpl/intranet-tmpl/prog/en/catalogue: results.tmpl 

Log message:
        adding a pagination bar

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/search.pl?cvsroot=koha&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/catalogue/results.tmpl?cvsroot=koha&r1=1.11&r2=1.12

Patches:
Index: catalogue/search.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/search.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- catalogue/search.pl 10 Jul 2007 14:21:41 -0000      1.9
+++ catalogue/search.pl 13 Jul 2007 15:37:20 -0000      1.10
@@ -2,7 +2,7 @@
 # Script to perform searching
 # For documentation try 'perldoc /path/to/search'
 #
-# $Header: /sources/koha/koha/catalogue/search.pl,v 1.9 2007/07/10 14:21:41 
toins Exp $
+# $Header: /sources/koha/koha/catalogue/search.pl,v 1.10 2007/07/13 15:37:20 
toins Exp $
 #
 # Copyright 2006 LibLime
 #
@@ -445,7 +445,8 @@
     my $server = $servers[$i];
     if ($server =~/biblioserver/) { # this is the local bibliographic server
         $hits = $results_hashref->{$server}->{"hits"};
-        my @newresults = searchResults( 
$search_desc,$hits,$results_per_page,$offset,@{$results_hashref->{$server}->{"RECORDS"}});
+        my $page = $cgi->param('page') || 0;
+        my @newresults = searchResults( 
$search_desc,$hits,$results_per_page,$page,@{$results_hashref->{$server}->{"RECORDS"}});
         $total = $total + $results_hashref->{$server}->{"hits"};
         if ($hits) {
             $template->param(total => $hits);
@@ -453,23 +454,30 @@
             $template->param(results_per_page =>  $results_per_page);
             $template->param(SEARCH_RESULTS => address@hidden);
 
-            my @page_numbers;
-            my $pages = ceil($hits / $results_per_page);
-            my $current_page_number = 1;
-            $current_page_number = ($offset / $results_per_page + 1) if 
$offset;
-            my $previous_page_offset = $offset - $results_per_page unless 
($offset - $results_per_page <0);
-            my $next_page_offset = $offset + $results_per_page;
-            for (my $j=1; $j<=$pages;$j++) {
-                my $this_offset = (($j*$results_per_page)-$results_per_page);
-                my $this_page_number = $j;
-                my $highlight = 1 if ($this_page_number == 
$current_page_number);
-                if ($this_page_number <= $pages) {
-                push @page_numbers, { offset => $this_offset, pg => 
$this_page_number, highlight => $highlight, sort_by => join " ",@sort_by };
-                }
-            }
-            $template->param(PAGE_NUMBERS => address@hidden,
-                            previous_page_offset => $previous_page_offset,
-                            next_page_offset => $next_page_offset) unless 
$pages < 2;
+#             my @page_numbers;
+#             my $pages = ceil($hits / $results_per_page);
+#             my $previous_page_offset = $offset - $results_per_page unless 
($offset - $results_per_page <0);
+#             my $next_page_offset = $offset + $results_per_page;
+#             for (my $j=1; $j<=$pages;$j++) {
+#                 my $this_offset = (($j*$results_per_page)-$results_per_page);
+#                 my $this_page_number = $j;
+#                 my $highlight = 1 if ($this_page_number == 
$current_page_number);
+#                 if ($this_page_number <= $pages) {
+#                 push @page_numbers, { offset => $this_offset, pg => 
$this_page_number, highlight => $highlight, sort_by => join " ",@sort_by };
+#                 }
+#             }
+#             $template->param(PAGE_NUMBERS => address@hidden,
+#                             previous_page_offset => $previous_page_offset,
+#                             next_page_offset => $next_page_offset) unless 
$pages < 2;
+
+                       $template->param(
+                               pagination_bar => pagination_bar(
+                       "/cgi-bin/koha/catalogue/search.pl?q=$search_desc&",
+                       getnbpages($hits, $results_per_page),
+                       $page,
+                       'page'
+                               ),
+                       );
         }
     } # end of the if local
     else {

Index: koha-tmpl/intranet-tmpl/prog/en/catalogue/results.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/catalogue/results.tmpl,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- koha-tmpl/intranet-tmpl/prog/en/catalogue/results.tmpl      12 Jul 2007 
16:35:19 -0000      1.11
+++ koha-tmpl/intranet-tmpl/prog/en/catalogue/results.tmpl      13 Jul 2007 
15:37:20 -0000      1.12
@@ -79,7 +79,6 @@
             </table>
             </form>
     
-            
             <form action="/cgi-bin/koha/catalogue/search.pl" method="get">
             <table>
                 <tr>
@@ -189,6 +188,7 @@
                     <!-- RESORT END -->
               </form>
                     <!-- TABLE RESULTS START -->
+
                 <table>
                     <tr>
                         <th>&nbsp;</th>
@@ -294,30 +294,9 @@
                 </div>
         <!-- /TMPL_IF -->
     
-        <!-- TMPL_IF NAME="PAGE_NUMBERS" -->
             <div class="pages">
-                <!-- Row of numbers corresponding to search result pages -->
-                <!-- TMPL_IF NAME="previous_page_offset" -->
-                    <a class="nav" 
href="/cgi-bin/koha/catalogue/search.pl?q=<!-- TMPL_VAR NAME="searchdesc" 
-->&amp;offset=<!-- TMPL_VAR NAME="previous_page_offset" -->">
-                        &lt;&lt; Previous
-                    </a>
-                <!-- /TMPL_IF -->
-                <!-- TMPL_LOOP NAME="PAGE_NUMBERS" -->
-                    <!-- TMPL_IF NAME="highlight" -->
-                        <span class="current"><!-- TMPL_VAR NAME="pg" 
--></span>
-                    <!-- TMPL_ELSE -->
-                        <a class="nav" 
href="/cgi-bin/koha/catalogue/search.pl?q=<!-- TMPL_VAR NAME="searchdesc" 
-->&amp;offset=<!-- TMPL_VAR NAME="offset" --><!-- TMPL_IF NAME="sort_by" 
-->&amp;sort_by=<!-- TMPL_VAR NAME="sort_by" --><!-- /TMPL_IF -->">
-                            <!-- TMPL_VAR NAME="pg" -->
-                        </a>
-                    <!-- /TMPL_IF -->
-                <!-- /TMPL_LOOP -->
-                <!-- TMPL_IF NAME="next_page_offset" -->
-                    <a class="nav" 
href="/cgi-bin/koha/catalogue/search.pl?q=<!-- TMPL_VAR NAME="searchdesc" 
-->&amp;offset=<!-- TMPL_VAR NAME="next_page_offset" -->">
-                        Next &gt;&gt;
-                    </a>
-                <!-- /TMPL_IF -->
+           <!-- TMPL_VAR NAME='pagination_bar'-->
             </div>
-        <!-- /TMPL_IF -->
     
         <!-- TMPL_IF NAME="outer_sup_results_loop" -->
             <h3><!-- TMPL_LOOP NAME="outer_sup_results_loop" --></h3>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]