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

kyoki at bestpractical.com kyoki at bestpractical.com
Mon Jun 9 15:17:18 EDT 2008


Author: kyoki
Date: Mon Jun  9 15:17:18 2008
New Revision: 13063

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

Log:
 r22577 at nyx:  kyoki | 2008-06-06 18:47:23 -0400
 made TicketList dependent on CollectionList and removed some redundant code


Modified: rt/branches/3.8-TESTING/share/html/Elements/CollectionList
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Elements/CollectionList	(original)
+++ rt/branches/3.8-TESTING/share/html/Elements/CollectionList	Mon Jun  9 15:17:18 2008
@@ -45,61 +45,8 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-<table border="0" cellspacing="0" cellpadding="1" width="100%" class="collection">
-
-% if ( $ShowHeader ) {
-<& /Elements/CollectionAsTable/Header,
-    %ARGS,
-    Class        => $Class,
-    Format       => \@Format,
-    FormatString => $Format,
-    Order        => \@Order,
-    OrderBy      => \@OrderBy,
-    Rows         => $Rows,
-    Page         => $Page,
-    AllowSorting => $AllowSorting, 
-    BaseURL      => $BaseURL,
-    maxitems     => $maxitems,
-&> 
-% }
-
-<%PERL>
-my ($i, $column_map) = (0, {});
-while ( my $record = $Collection->Next ) {
-    # Every ten rows, flush the buffer and put something on the page.
-    $m->flush_buffer unless ++$i % 10;
-    $m->comp('/Elements/CollectionAsTable/Row',
-        i => $i,
-        Format => \@Format,
-        record => $record,
-        maxitems => $maxitems,
-        ColumnMap => $column_map,
-        Class     => $Class,
-    );
-}
-</%PERL>
-
-</table>
-
-% if ( $Rows && $ShowNavigation && $TotalFound > $Rows ) {
-<hr />
-% my $oddRows = ($TotalFound && $TotalFound % $Rows == 0 )? 0 : 1;
-<&|/l, $Page, int($TotalFound/$Rows)+$oddRows&>Page [_1] of [_2]</&>
-
-<%PERL>
-my %query_args = map { $_ => $ARGS{$_} } @PassArguments;
-my $prev = $m->comp( '/Elements/QueryString', %query_args, Page => $Page - 1 );
-my $next = $m->comp( '/Elements/QueryString', %query_args, Page => $Page + 1 );
-</%PERL>
-% if ( $Page > 1 ) {
-<a href="<% $BaseURL %><% $prev %>"><&|/l&>Previous Page</&></a>
-% }
-% if ( ($Page * $Rows) < $TotalFound ) {
-<a href="<% $BaseURL %><% $next %>"><&|/l&>Next Page</&></a>
-% }
-% }
 <%INIT>
-my $TotalFound = $Collection->CountAll;
+my $TotalFound = $Collection->CountAll();
 return '' if !$TotalFound && !$ShowEmpty;
 
 if ( @OrderBy ) {
@@ -144,6 +91,60 @@
 $Class =~ s/s$//;
 $Class =~ s/:/_/g;
 
+$m->out('<table border="0" cellspacing="0" cellpadding="1" width="100%" class="collection">') unless ($IsTicket);
+
+if ( $ShowHeader ) {
+  $m->comp('/Elements/CollectionAsTable/Header',
+	   %ARGS,
+	   Class        => $Class,
+	   Format       => \@Format,
+	   FormatString => $Format,
+	   Order        => \@Order,
+	   OrderBy      => \@OrderBy,
+	   Rows         => $Rows,
+	   Page         => $Page,
+	   AllowSorting => $AllowSorting, 
+	   BaseURL      => $BaseURL,
+	   maxitems     => $maxitems,
+	   );
+}
+
+my ($i, $column_map) = (0, {});
+while ( my $record = $Collection->Next ) {
+    # Every ten rows, flush the buffer and put something on the page.
+    $m->flush_buffer unless ++$i % 10;
+    $m->comp('/Elements/CollectionAsTable/Row',
+        i => $i,
+        Format => \@Format,
+        record => $record,
+        maxitems => $maxitems,
+        ColumnMap => $column_map,
+        Class     => $Class,
+    );
+}
+
+$m->out('</table>');
+
+if ( $Rows && $ShowNavigation && $TotalFound > $Rows ) {
+  $m->out('<hr />');
+  my $oddRows = ($TotalFound && $TotalFound % $Rows == 0 )? 0 : 1;
+  my $pages = int( $TotalFound / $Rows ) + $oddRows;
+  $pages = 1 if $pages < 1;
+
+
+  my %query_args = map { $_ => $ARGS{$_} } @PassArguments;
+  $m->comp(
+        '/Elements/CollectionListPaging',
+        BaseURL     => $BaseURL,
+        Rows        => $Rows,
+        TotalFound  => $TotalFound,
+        CurrentPage => $Page,
+        Pages       => $pages,
+        URLParams   => \%query_args
+    );
+
+}
+
 </%INIT>
 <%ARGS>
 $Collection    => undef
@@ -154,15 +155,17 @@
 @Order         => ()
 @OrderBy       => ()
 
-$Rows          => undef
+$Rows          => 1
 $Page          => 1
 
 $Title         => loc('Ticket Search')
 $BaseURL       => RT->Config->Get('WebPath') . $m->request_comp->path .'?'
- at PassArguments => qw(Query Format Rows Page Order OrderBy)
+ at PassArguments => qw( Query Format Rows Page Order OrderBy)
 
 $AllowSorting   => 0
 $ShowNavigation => 1
 $ShowHeader     => 1
 $ShowEmpty      => 0
+$IsTicket => 0
+$Query => 0
 </%ARGS>

Modified: rt/branches/3.8-TESTING/share/html/Elements/CollectionListPaging
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Elements/CollectionListPaging	(original)
+++ rt/branches/3.8-TESTING/share/html/Elements/CollectionListPaging	Mon Jun  9 15:17:18 2008
@@ -8,11 +8,14 @@
 </%ARGS>
 
 <%INIT>
+if ($Pages == 1) {
+  $m->out(loc('Page 1 of 1'));
+}
+else{
 $m->out(loc('Page') . ' ');
-
 my $prev = $m->comp(
 		    '/Elements/QueryString',
-		    @$URLParams,
+		    %$URLParams,
 		    Page    => ( $CurrentPage - 1 )
 		   );
 my %show;
@@ -23,7 +26,7 @@
 for my $number (1..$Pages){
   if ($show{$number}){
     $dots = undef;
-    my $qs = $m->comp('/Elements/QueryString', @$URLParams, Page => $number);
+    my $qs = $m->comp('/Elements/QueryString', %$URLParams, Page => $number);
     $m->out(  qq{<a href="$BaseURL$qs">}
 	      . (($number == $CurrentPage)  ? "<em>$number</em>" : $number) 
 	      . qq{</a> });
@@ -36,13 +39,14 @@
 
 my $next = $m->comp(
 		    '/Elements/QueryString',
-		    @$URLParams,
+		    %$URLParams,
 		    Page    => ( $CurrentPage + 1 )
 		   );
+if ($CurrentPage > 1) {
+  $m->out(qq{<a href="$BaseURL$prev">}.loc('Previous ').qq{</a>});
+}
+if (($CurrentPage * $Rows) < $TotalFound) {
+  $m->out(qq{<a href="$BaseURL$next">}.loc('Next').qq{</a>});
+}
+}
 </%INIT>
-% if ($CurrentPage > 1) {
-<a href="<%$BaseURL%><%$prev%>"><&|/l&>Previous</&></a>
-% }
-% if (($CurrentPage * $Rows) < $TotalFound) {
-<a href="<%$BaseURL%><%$next%>"><&|/l&>Next</&></a>
-% }

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	Mon Jun  9 15:17:18 2008
@@ -214,14 +214,12 @@
 </%INIT>
 <%ARGS>
 $Collection => undef
-
 $Query => undef
 $Format => RT->Config->Get('DefaultSearchResultFormat')
 $DisplayFormat => undef
-$Order => undef
-$OrderBy => undef
+ at Order => ()
+ at OrderBy => ()
 $Rows => 50
-
 $Page => 1
 $Title => 'Ticket Search'
 $BaseURL => undef


More information about the Rt-commit mailing list