%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
$Collection->FromSQL($Query);
}
-my $TotalFound = $Collection->CountAll();
+$TotalFound = $Collection->CountAll() unless defined $TotalFound;
return '' if !$TotalFound && !$ShowEmpty;
if ( $Rows ) {
@OrderBy = split /\|/, $OrderBy[0];
@Order = split /\|/,$Order[0];
}
+ @OrderBy = grep length, @OrderBy;
$Collection->OrderByCols(
map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } }
( 0 .. $#OrderBy )
}
}
-$Class ||= ref $Collection;
-$Class =~ s/s$//;
-$Class =~ s/:/_/g;
+$Class ||= $Collection->ColumnMapClassName;
+if ($Class =~ /::/) { # older passed in value
+ $Class =~ s/s$//;
+ $Class =~ s/:/_/g;
+}
-$m->out('<table border="0" cellspacing="0" cellpadding="1"' .
- ' width="100%" class="' .
- ($Collection->isa('RT::Tickets') ? 'ticket-list' : 'collection') . '">');
+$m->out('<table cellspacing="0" class="' .
+ ($Collection->isa('RT::Tickets') ? 'ticket-list' : 'collection') . ' collection-as-table">');
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,
- GenericQueryArgs => $GenericQueryArgs,
- maxitems => $maxitems,
- );
+ $m->comp('/Elements/CollectionAsTable/Header',
+ %ARGS,
+ Class => $Class,
+ Format => \@Format,
+ FormatString => $Format,
+ Order => \@Order,
+ OrderBy => \@OrderBy,
+ Rows => $Rows,
+ Page => $Page,
+ AllowSorting => $AllowSorting,
+ BaseURL => $BaseURL,
+ GenericQueryArgs => $GenericQueryArgs,
+ maxitems => $maxitems,
+ PassArguments => \@PassArguments,
+ );
}
my ($i, $column_map) = (0, {});
<%ARGS>
$Class => ''
$Collection => undef
+$TotalFound => undef
$Format => undef
$DisplayFormat => undef
@Order => ()