[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-116-gcc25c47
Shawn Moore
sartak at bestpractical.com
Tue Jul 6 16:55:27 EDT 2010
The branch, 3.9-trunk has been updated
via cc25c4749f366d7cc5159885c30e9678e99b7921 (commit)
from 683e5753c7efd1e59fa59b1db0f5280f80ab4e4b (commit)
Summary of changes:
share/html/Search/Elements/DisplayOptions | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
- Log -----------------------------------------------------------------
commit cc25c4749f366d7cc5159885c30e9678e99b7921
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Jul 6 16:53:52 2010 -0400
Make query builder sorting more extensible
Includes a new callback for injecting arbitrary new Display => SQL
sorting options.
diff --git a/share/html/Search/Elements/DisplayOptions b/share/html/Search/Elements/DisplayOptions
index 40d976c..2195e52 100644
--- a/share/html/Search/Elements/DisplayOptions
+++ b/share/html/Search/Elements/DisplayOptions
@@ -61,10 +61,12 @@
% if ($o > 0) {
<option value=""><&|/l&>~[none~]</&></option>
% }
+% # %fields maps display name to SQL column/function
% foreach my $field (sort keys %fields) {
% next unless $field;
-<option value="<%$field%>"
-% if (defined $OrderBy[$o] and $field eq $OrderBy[$o]) {
+% my $fieldval = $fields{$field};
+<option value="<%$fieldval%>"
+% if (defined $OrderBy[$o] and $fieldval eq $OrderBy[$o]) {
selected="selected"
% }
><% loc($field) %></option>
@@ -102,18 +104,27 @@ selected="selected"
<%INIT>
my $tickets = new RT::Tickets($session{'CurrentUser'});
-my %fields = %{$tickets->FIELDS};
-map { $fields{$_}->[0] =~ /^(?:ENUM|INT|DATE|STRING|ID)$/ || delete $fields{$_} } keys %fields;
-delete $fields{'EffectiveId'};
-$fields{'Owner'} = 1;
-$fields{ $_ . '.EmailAddress' } = 1 foreach( qw(Requestor Cc AdminCc) );
+my %FIELDS = %{$tickets->FIELDS};
+my %fields;
+
+for my $field (keys %FIELDS) {
+ next if $field eq 'EffectiveId';
+ next unless $FIELDS{$field}->[0] =~ /^(?:ENUM|INT|DATE|STRING|ID)$/;
+ $fields{$field} = $field;
+}
+
+$fields{'Owner'} = 'Owner';
+$fields{ $_ . '.EmailAddress' } = $_ . '.EmailAddress'
+ for qw(Requestor Cc AdminCc);
# Add all available CustomFields to the list of sortable columns.
my @cfs = grep /^CustomField/, @{$ARGS{AvailableColumns}};
-$fields{$_}=1 for @cfs;
+$fields{$_} = $_ for @cfs;
# Add PAW sort
-$fields{'Custom.Ownership'} = 1;
+$fields{'Custom.Ownership'} = 'Custom.Ownership';
+
+$m->callback(CallbackName => 'MassageSortFields', Fields => \%fields );
my @Order = split /\|/, $Order;
my @OrderBy = split /\|/, $OrderBy;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list