[rt-users] Search Format Not Held On Re-Order

Matthew Meyer mmeyer at jasi.com
Fri Dec 10 11:28:36 EST 2004


Finally have a work around once my brain started working.  Highly unofficial
diffs attached from my local cvs rep.  Format string is not XSS-sanitized
yet, unless that is done somewhere else.

Index: /html/Elements/CollectionAsTable/Header
===================================================================
--- Header	2004/12/06 15:15:26	1.1
+++ Header	2004/12/10 16:00:00	1.3
@@ -39,6 +39,13 @@ my %generic_query_args = ( Query => $Que

 my $item = 0;
 $$maxitems = 0;
+
+#M.M. Reconstruct Format String From @Format - for Re-Order Links
+my $reformat = "";
+foreach my $recolref (@Format) {
+    $reformat = $reformat.$recolref->{original}.',';
+}
+
 foreach my $col (@Format) {
     $item++;
     $$maxitems = $item if $item > $$maxitems;
@@ -47,8 +54,9 @@ foreach my $col (@Format) {
 	$item = 0;
     }
     else {
-        $m->out('<TH align="center">');
+        $m->out('<TH style="font-size: 12px; font-weight:bold; text-align:
left; background-color: #dddddd;">');
         my $title = $col->{title};
+
         $title =~ s/^__(.*)__$/$1/o;
         $title = ( $m->comp('/Elements/RT__Ticket/ColumnMap',
                      Name => $title,
@@ -76,7 +84,8 @@ foreach my $col (@Format) {
                     )
                           || $col->{'attribute'}
                     ),
-                    Order => ( $ARGS{'Order'} eq 'ASC' ? 'DESC' : 'ASC' )
+                    Order => ( $ARGS{'Order'} eq 'ASC' ? 'DESC' : 'ASC' ),
+                    Format => ($reformat),
                   ).
                   '">' . loc($title) . '</a>'
             );


Index: /html/Elements/CollectionAsTable/ParseFormat
===================================================================
--- ParseFormat	2004/12/06 15:15:26	1.1
+++ ParseFormat	2004/12/10 16:00:00	1.2
@@ -37,12 +37,16 @@ my $word = qr [(?:\{|\}|\w|\.)+];
 while ($Format =~ /($justquoted|$word)/igx) {
     my $col = $1;

+    my $colref;
+
+    #Save Original Component of Format String
+    $colref->{'original'} = $col;
+
     if ($col =~ /^$RE{quoted}{-esc}$/) {
         substr($col,0,1) = "";
         substr($col,-1,1) = "";
     }

-    my $colref;
     if ( $col =~ s/\/STYLE:(.*?)$//io ) {
         $colref->{'style'} = $1;
     }

-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com
[mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Matthew Meyer
Sent: Thursday, December 09, 2004 7:35 AM
To: rt-users at lists.bestpractical.com
Subject: [rt-users] Search Format Not Held On Re-Order

With RT 3.2.2, I like the ability to customize the search format, including
creating columns for custom fields.  I have ran into one issue where if you
exec a search with a customized format, the format is not held when
re-ordering the results by clicking one of the links in the header.  I can
see the code in /html/Elements/CollectionsAsTable/Header, but I haven't been
successful in converting the @Format argument into the right part of the
query string for the header links.  Any thoughts on how I can do that?

Thanks.

 


_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com





More information about the rt-users mailing list