This commit was generated by cvs2svn to compensate for changes in r10640,
[freeside.git] / rt / share / html / Elements / CollectionList
index 6f21420..4e06e3f 100644 (file)
@@ -54,7 +54,9 @@ if (!$Collection && $Class eq 'RT::Tickets') {
 my $TotalFound = $Collection->CountAll();
 return '' if !$TotalFound && !$ShowEmpty;
 
-if ( @OrderBy ) {
+# XXX: ->{'order_by'} is hacky, but there is no way to check if
+# collection is ordered or not
+if ( @OrderBy && ($AllowSorting || !$Collection->{'order_by'}) ) {
     if ( $OrderBy[0] =~ /\|/ ) {
         @OrderBy = split /\|/, $OrderBy[0];
         @Order = split /\|/,$Order[0];
@@ -121,14 +123,30 @@ if ( $ShowHeader ) {
 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;
+    #broken w/FS, causes rows to be output prematurely
+    #$m->flush_buffer unless ++$i % 10;
+    ++$i;
+
+    my $warning = 0;
+    my $Classes = '';
+
+    $m->callback(
+        CallbackName => 'EachRow',
+        Record       => $record,
+        Warning      => \$warning,
+        Classes      => \$Classes,
+        Format       => \@Format,
+    );
+
     $m->comp('/Elements/CollectionAsTable/Row',
-        i => $i,
-        Format => \@Format,
-        record => $record,
-        maxitems => $maxitems,
+        i         => $i,
+        Format    => \@Format,
+        record    => $record,
+        maxitems  => $maxitems,
         ColumnMap => $column_map,
         Class     => $Class,
+        Warning   => $warning,
+        Classes   => $Classes,
     );
 }