[Rt-commit] r6522 - in rt/branches/3.7-EXPERIMENTAL: . html/Elements/CollectionAsTable

ruz at bestpractical.com ruz at bestpractical.com
Sun Nov 26 17:45:26 EST 2006


Author: ruz
Date: Sun Nov 26 17:45:25 2006
New Revision: 6522

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/html/Elements/CollectionAsTable/Row
   rt/branches/3.7-EXPERIMENTAL/html/Elements/TicketList

Log:
 r4179 at cubic-pc:  cubic | 2006-11-27 01:49:39 +0300
  r3512 at cubic-pc:  cubic | 2006-06-29 06:39:54 +0400
  * run column map component only once for the first
    row of the collection
  
 


Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/CollectionAsTable/Row
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/CollectionAsTable/Row	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/CollectionAsTable/Row	Sun Nov 26 17:45:25 2006
@@ -50,6 +50,7 @@
 $maxitems => undef
 $Depth => undef
 $Warning => undef
+$ColumnMap => {}
 </%ARGS>
 
 <%PERL>
@@ -79,11 +80,16 @@
     foreach my $subcol ( @{ $column->{output} } ) {
         if ( $subcol =~ /^__(.*?)__$/o ) {
             my $col   = $1;
-            my $value = $m->comp(
-                '/Elements/RT__Ticket/ColumnMap',
-                Name => $col,
-                Attr => 'value'
-            );
+
+            unless ( exists $ColumnMap->{ $col } ) {
+                $ColumnMap->{ $col } = $m->comp(
+                    '/Elements/RT__Ticket/ColumnMap',
+                    Name => $col,
+                    Attr => 'value'
+                );
+            }
+
+            my $value = $ColumnMap->{ $col };
             my @out;
 
             if ( $value && ref($value) ) {

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/TicketList
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/TicketList	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/TicketList	Sun Nov 26 17:45:25 2006
@@ -58,14 +58,21 @@
     BaseURL => $BaseURL,
     maxitems => $maxitems &> 
 % }
-
-%   my $i;
-%   while (my $record = $Collection->Next) {
-%     $i++;
-%     # Every ten rows, flush the buffer and put something on the page.
-%     $m->flush_buffer() unless ($i % 10);
-<&    /Elements/CollectionAsTable/Row, Format => \@Format, i => $i, record => $record, maxitems => $maxitems &>
-%   }
+<%PERL>
+my ($i, $column_map) = (0, {});
+while ( my $record = $Collection->Next ) {
+    $i++;
+    # 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,
+    );
+}
+</%PERL>
 
 </table>
 


More information about the Rt-commit mailing list