[Koha-cvs] koha/opac opac-search.pl [rel_2_2]

Antoine Farnault antoine at koha-fr.org
Fri Sep 8 10:45:47 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Antoine Farnault <toins>	06/09/08 08:45:47

Modified files:
	opac           : opac-search.pl 

Log message:
	Fix bug #1160 (multi page gestion)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-search.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.21.2.17&r2=1.21.2.18

Patches:
Index: opac-search.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-search.pl,v
retrieving revision 1.21.2.17
retrieving revision 1.21.2.18
diff -u -b -r1.21.2.17 -r1.21.2.18
--- opac-search.pl	3 Apr 2006 10:29:23 -0000	1.21.2.17
+++ opac-search.pl	8 Sep 2006 08:45:47 -0000	1.21.2.18
@@ -121,18 +121,34 @@
 	push @field_data, {term => "orderby", val => $orderby} if $orderby;
 	my @numbers = ();
 
-	if ($total>$resultsperpage)
-	{
-		for (my $i=1; $i<$total/$resultsperpage+1; $i++)
-		{
-			if ($i<16)
-			{
-	    		my $highlight=0;
-	    		($startfrom==($i-1)) && ($highlight=1);
-	    		push @numbers, { number => $i,
+	if ($total>$resultsperpage){
+		
+		if($startfrom>5){
+			for(my $i = $startfrom-4;$i<$total/$resultsperpage+1;$i++){
+				if($i<$startfrom+7){
+					my $highlight = 0;
+					($startfrom==($i-1)) && ($highlight = 1);
+					push @numbers,
+					{       number => $i,
+						 highlight => $highlight ,
+						 searchdata=> \@field_data,
+						 startfrom => ($i-1)
+					};
+				}
+			}
+		}
+		else {
+			for (my $i=1; $i<$total/$resultsperpage+1; $i++){
+				if (($i<=10)) {
+					my $highlight = 0;
+					($startfrom==($i-1)) && ($highlight = 1);
+					push @numbers,{
+						number => $i,
 					highlight => $highlight ,
 					searchdata=> \@field_data,
-					startfrom => ($i-1)};
+						startfrom => ($i-1)
+					};
+				}
 			}
     	}
 	}
@@ -147,7 +163,8 @@
 		$to = (($startfrom+1)*$resultsperpage);
 	}
 	my $defaultview = 'BiblioDefaultView'.C4::Context->preference('BiblioDefaultView');
-	$template->param(results => $results,
+	$template->param(
+			results => $results,
 							startfrom=> $startfrom,
 							displaynext=> $displaynext,
 							displayprev=> $displayprev,





More information about the Koha-cvs mailing list