[Rt-commit] r12940 - in rt/branches/3.8-TESTING: share/html/Elements

sartak at bestpractical.com sartak at bestpractical.com
Thu Jun 5 17:14:30 EDT 2008


Author: sartak
Date: Thu Jun  5 17:14:30 2008
New Revision: 12940

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/share/html/Elements/TicketList

Log:


Modified: rt/branches/3.8-TESTING/share/html/Elements/TicketList
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Elements/TicketList	(original)
+++ rt/branches/3.8-TESTING/share/html/Elements/TicketList	Thu Jun  5 17:14:30 2008
@@ -80,24 +80,67 @@
 
 %if ($Rows && $ShowNavigation) {
 <hr />
-<%PERL>
-my $oddRows = ($TotalFound && $TotalFound % $Rows == 0 )? 0 : 1;
-my $pages = int($TotalFound/$Rows)+$oddRows;
-$pages = 1 if $pages < 1;
-my @url_params = (Query => $Query, 
-                  Format => $Format, 
-                  Rows => $Rows, 
-                  OrderBy => $OrderBy, 
-                  Order => $Order);
-$m->comp( '/Elements/CollectionListPaging',
-          BaseURL => $BaseURL,
-          Rows => $Rows,
-          TotalFound => $TotalFound,
-          CurrentPage => $Page,
-          Pages => $pages,
-          URLParams => \@url_params);
+% my $oddRows = ($TotalFound && $TotalFound % $Rows == 0 )? 0 : 1;
+% my $pages = int($TotalFound/$Rows)+$oddRows;
+% $pages = 1 if $pages < 1;
+<&|/l, $Page, $pages &>Page </&>
+
+<%perl>
+my $prev = $m->comp(
+    '/Elements/QueryString',
+    Query   => $Query,
+    Format  => $Format,
+    Rows    => $Rows,
+    OrderBy => $OrderBy,
+    Order   => $Order,
+    Page    => ( $Page - 1 )
+);
+
+my %show;
+$show{1} = 1;
+$show{$_} = 1 for (($Page - 2)..($Page + 2));
+$show{$pages} = 1;
+my $dots;
+for my $number (1..$pages){
+  if ($show{$number}){
+    $dots = undef;
+    if ($number == $Page){
+      $number = ("<em>$number </em>");
+    }	
+    my $num = $m->comp(
+		       '/Elements/QueryString',
+		       Query   => $Query,
+		       Format  => $Format,
+		       Rows    => $Rows,
+		       OrderBy => $OrderBy,
+		       Order   => $Order,
+		       Page    => $number
+		      );
+    $m->out("<a href=\"$BaseURL$num\">$number </a>");
+  }
+  elsif (not $dots){
+    $dots = 1;
+    $m->out(" ... ");
+  }
 }
-</%PERL>
+
+my $next = $m->comp(
+    '/Elements/QueryString',
+    Query   => $Query,
+    Format  => $Format,
+    Rows    => $Rows,
+    OrderBy => $OrderBy,
+    Order   => $Order,
+    Page    => ( $Page + 1 )
+);
+</%perl>
+% if ($Page > 1) {
+<a href="<%$BaseURL%><%$prev%>"><&|/l&>Previous</&></a>
+% }
+% if (($Page * $Rows) < $TotalFound) {
+<a href="<%$BaseURL%><%$next%>"><&|/l&>Next</&></a>
+% }
+% }
 <%INIT>
 unless ($Collection) {
         $Collection = RT::Tickets->new( $session{'CurrentUser'} );


More information about the Rt-commit mailing list