summaryrefslogtreecommitdiff
path: root/rt/html/Search/Elements/BuildFormatString
diff options
context:
space:
mode:
Diffstat (limited to 'rt/html/Search/Elements/BuildFormatString')
-rw-r--r--rt/html/Search/Elements/BuildFormatString196
1 files changed, 84 insertions, 112 deletions
diff --git a/rt/html/Search/Elements/BuildFormatString b/rt/html/Search/Elements/BuildFormatString
index 639e62c29..e5e131b6c 100644
--- a/rt/html/Search/Elements/BuildFormatString
+++ b/rt/html/Search/Elements/BuildFormatString
@@ -1,8 +1,8 @@
-%# BEGIN BPS TAGGED BLOCK {{{
+%# {{{ BEGIN BPS TAGGED BLOCK
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
%# <jesse@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -42,76 +42,45 @@
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
%#
-%# END BPS TAGGED BLOCK }}}
+%# }}} END BPS TAGGED BLOCK
<%args>
$Format => undef
%cfqueues => undef
-$Face => undef
-$Size => undef
-$Link => undef
-$Title => undef
-$AddCol => undef
-$RemoveCol => undef
-$ColUp => undef
-$ColDown => undef
-$SelectDisplayColumns => undef
-$CurrentDisplayColumns => undef
</%args>
<%init>
unless ($Format) {
$Format = $RT::DefaultSearchResultFormat;
}
-
-
-# All the things we can display in the format string by default
-my @fields = qw(
- id
- Status
- ExtendedStatus
- Subject
- QueueName
- OwnerName
- Priority
- InitialPriority
- FinalPriority
- Type
- TimeWorked
- TimeLeft
- TimeEstimated
- CreatedBy
- LastUpdatedBy
- Requestors
- Cc
- AdminCc
- Starts
- StartsRelative
- Started
- StartedRelative
- Created
- CreatedRelative
- LastUpdated
- LastUpdatedRelative
- Told
- ToldRelative
- Due
- DueRelative
- Resolved
- ResolvedRelative
- RefersTo
- ReferredToBy
- DependsOn
- DependedOnBy
- MemberOf
- Members
- Parents
- Children
- NEWLINE
+
+my @fields = (
+ "QueueName", "OwnerName",
+ "id", "Status",
+ "Subject", "ExtendedStatus",
+ "Priority", "InitialPriority",
+ "FinalPriority", "EffectiveId",
+ "Type", "TimeWorked",
+ "TimeLeft", "TimeEstimated",
+ "Requestors", "Cc",
+ "AdminCc", "StartsRelative",
+ "StartedRelative", "CreatedRelative",
+ "LastUpdatedRelative", "ToldRelative",
+ "DueRelative", "ResolvedRelative",
+ "Starts", "Started",
+ "Created", "CreatedBy",
+ "LastUpdated", "LastUpdatedBy",
+ "Told", "Due",
+ "Resolved", "NEWLINE",
+ "RefersTo", "ReferredToBy",
+ "DependsOn", "DependedOnBy",
+ "MemberOf", "Members",
+ "Parents", "Children",
+ "-",
);
my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'});
-foreach my $id (keys %cfqueues) {
- # What does this _do_? What are the keys to cfqueues
+foreach (keys %cfqueues) {
+ my $id = $_;
$id =~ s/^.'*(.*).'*$/$1/;
# Gotta load up the $queue object, since queues get stored by name now.
my $queue = RT::Queue->new($session{'CurrentUser'});
@@ -148,8 +117,8 @@ foreach my $field (@format) {
push @seen, \%column;
}
-if ( $RemoveCol ) {
- my $index = $CurrentDisplayColumns;
+if ( $ARGS{"RemoveCol"} ) {
+ my $index = $ARGS{'CurrentDisplayColumns'};
my $column = $seen[$index];
if ($index) {
delete $seen[$index];
@@ -161,9 +130,9 @@ if ( $RemoveCol ) {
}
}
}
-elsif ( $AddCol ) {
- if ( defined $SelectDisplayColumns ) {
- my $selected = $SelectDisplayColumns;
+elsif ( $ARGS{"AddCol"} ) {
+ if ( defined $ARGS{'SelectDisplayColumns'} ) {
+ my $selected = $ARGS{'SelectDisplayColumns'};
my @columns;
if (ref($selected) eq 'ARRAY') {
@columns = @$selected;
@@ -172,71 +141,74 @@ elsif ( $AddCol ) {
}
foreach my $col (@columns) {
my %column = ();
- $column{Column} = $col;
-
- if ( $Face eq "Bold" ) {
- $column{Prefix} .= "<B>";
- $column{Suffix} .= "</B>";
- }
- if ( $Face eq "Italic" ) {
- $column{Prefix} .= "<I>";
- $column{Suffix} .= "</I>";
- }
- if ($Size) {
- $column{Prefix} .= "<" . $m->interp->apply_escapes( $Size, 'h' ) . ">";
- $column{Suffix} .= "</" . $m->interp->apply_escapes( $Size, 'h' ) . ">";
- }
- if ( $Link eq "Display" ) {
- $column{Prefix} .=
- "<A HREF=\"" . $RT::WebPath . "/Ticket/Display.html?id=__id__\">";
- $column{Suffix} .= "</a>";
- }
- elsif ( $Link eq "Take" ) {
- $column{Prefix} .= "<A HREF=\"" . $RT::WebPath
- . "/Ticket/Display.html?Action=Take&id=__id__\">";
- $column{Suffix} .= "</a>";
- }
-
- if ($Title) {
- $column{Suffix} .= "/TITLE:" . $m->interp->apply_escapes( $Title, 'h' );
+ $column{Column} = $fields[ $col ];
+
+ if ( $ARGS{Face} eq "Bold" ) {
+ $column{Prefix} .= "<B>";
+ }
+ if ( $ARGS{Face} eq "Italic" ) {
+ $column{Prefix} .= "<I>";
+ }
+ if ( $ARGS{Size} ) {
+ $column{Prefix} .= "<" . $ARGS{Size} . ">";
+ }
+ if ( $ARGS{Link} eq "Display" ) {
+ $column{Prefix} .= "<A HREF=\"".$RT::WebPath."/Ticket/Display.html?id=__id__\">";
+ }
+ elsif ( $ARGS{Link} eq "Take" ) {
+ $column{Prefix} .=
+ "<A HREF=\"".$RT::WebPath."/Ticket/Display.html?Action=Take&id=__id__\">";
+ }
+
+ my $suffix;
+ if ( $ARGS{'Link'} eq "Display" || $ARGS{'Link'} eq "Take" ) {
+ $column{Suffix} .= "</a>";
+ }
+ if ( $ARGS{Size} ) {
+ $column{Suffix} .= "</" . $ARGS{Size} . ">";
+ }
+ if ( $ARGS{Face} eq "Italic" ) {
+ $column{Suffix} .= "</I>";
+ }
+ if ( $ARGS{Face} eq "Bold" ) {
+ $column{Suffix} .= "</B>";
+ }
+ if ( $ARGS{Title} ) {
+ $column{Suffix} .= "/TITLE:" . $ARGS{Title};
+ }
+ push @seen, \%column;
+ }
}
- push @seen, \%column;
-}
-}
}
-elsif ( $ColUp ) {
- my $index = $CurrentDisplayColumns;
+elsif ( $ARGS{"ColUp"} ) {
+ my $index = $ARGS{'CurrentDisplayColumns'};
if ( defined $index && ( $index - 1 ) >= 0 ) {
my $column = $seen[$index];
$seen[$index] = $seen[ $index - 1 ];
$seen[ $index - 1 ] = $column;
- $CurrentDisplayColumns = $index - 1;
+ $ARGS{CurrentDisplayColumns} = $index - 1;
}
}
-elsif ( $ColDown ) {
- my $index = $CurrentDisplayColumns;
+elsif ( $ARGS{"ColDown"} ) {
+ my $index = $ARGS{'CurrentDisplayColumns'};
if ( defined $index && ( $index + 1 ) < scalar @seen ) {
my $column = $seen[$index];
$seen[$index] = $seen[ $index + 1 ];
$seen[ $index + 1 ] = $column;
- $CurrentDisplayColumns = $index + 1;
+ $ARGS{CurrentDisplayColumns} = $index + 1;
}
}
-
-my @format_string;
+$Format = "";
foreach my $field (@seen) {
next unless $field;
- my $row = "'" . $field->{Prefix};
- $row .= "__" . $m->interp->apply_escapes( $field->{Column}, 'h' ) . "__"
- unless ( $field->{Column} eq "<blank>" );
- $row .= $field->{Suffix} . "'";
- push( @format_string, $row );
+ $Format .= ", \n" if $Format;
+ $Format .= "'";
+ $Format .= $field->{Prefix};
+ $Format .= "__" . $field->{Column} . "__" if ( $field->{Column} ne "<blank>" ) ;
+ $Format .= $field->{Suffix};
+ $Format .= "'";
}
-
-$Format = join(",\n", @format_string);
-
-
return($Format, \@fields, \@seen);
</%init>