[Rt-devel] Advanced Search style/class functionality?

Dowling, Brian BDowling at Kronos.com
Wed May 18 02:10:59 EDT 2005


While testing an idea of adding "TicketHistory" to search result pages
(for creating those long, tree killling, management/SOX style reports),
I found a feature of the advanced Query/ParseFormat that satisfied a
need but seemed unused?

It looks like at some point /style: /class: options flags were
considered for extending the advanced results formatting?  I do not see
where these were used?  Did I miss it?  I am not certain where these
were being considered for, but they seemed most appropriate to adjust
the table cell (TD) element containing the field.

In any case, I made a couple of changes to Row to allow these to be
utilized.  I wanted the ability to tweak colspan as well, so I added
that to ParseFormat as well.  I'll include these patches once I clean up
the rest of the things I want to submit, but for now, here are snippets
of them for consideration/discussion.

(Note: the colspan currently works best as the last line of the Row
Group.  /colspan:all should probably really imply end of format or a
NEWLINE after if other output fields exist).

Cheers,
Brian

html/Elements/CollectionAsTable/Row
+    my $tdflags = "";
+    if ($column->{colspan} > $maxitems or $column->{colspan} =~
/^all/i) {
+       $tdflags .= qq{colspan="$maxitems" };
+    } elsif ($column->{colspan}) {
+       $tdflags .= qq{colspan="$column->{colspan}" };
+    }
+
+    foreach (qw(style class)) {
+       $tdflags .= qq{$_="$column->{$_}" } if $column->{$_};
+    }
+
+    $m->out(qq{<td class="collection-as-table" $tdflags>});
     foreach my $subcol ( @{ $column->{output} } ) {
         if ( $subcol =~ /^__(.*?)__$/o ) {
             my $col = $1;

-----------
--- share/html/Elements/CollectionAsTable/ParseFormat   2005-02-01
09:20:40.000000000 -0500
+++ local/html/Elements/CollectionAsTable/ParseFormat   2005-05-17
23:46:31.046424320 -0400
@@ -63,6 +63,9 @@
     if ( $col =~ s/\/STYLE:(.*?)$//io ) {
         $colref->{'style'} = $1;
     }
+    if ( $col =~ s/\/COLSPAN:(.*?)$//io ) {
+        $colref->{'colspan'} = $1;
+    }
     if ( $col =~ s/\/CLASS:(.*?)$//io ) {
         $colref->{'class'} = $1;
     }
-----------


--- share/html/Elements/RT__Ticket/ColumnMap    2005-05-01
01:35:17.122850216 -0
400
+++ local/html/Elements/RT__Ticket/ColumnMap    2005-05-18
00:27:17.558497952 -0
400
@@ -134,7 +134,7 @@
         value => sub { return $_[0]->Subject || "(" . loc('No subject')
. ")" }
     },
     ExtendedStatus => {
-        title     => 'Status',
+        title     => 'Detailed Status',
         attribute => 'Status',
         value     => sub {
             my $Ticket = shift;
@@ -244,16 +244,19 @@
         value     => sub { return $_[0]->ResolvedObj->AgeAsString }
     },
     Starts => {
+       title => "Start Time",
         attribute => 'Starts',
-        value     => sub { return $_[0]->StartsObj->AsString }
+        value     => sub { return $_[0]->StartsObj->AsString(@_); }
     },
-    Started => {
+    Started => {
+       title => "Started Time",
         attribute => 'Started',
-        value     => sub { return $_[0]->StartedObj->AsString }
+        value     => sub { return $_[0]->StartedObj->AsString(@_); }
     },
     Created => {
+       title => "Created Time",
         attribute => 'Created',
-        value     => sub { return $_[0]->CreatedObj->AsString }
+        value     => sub { return $_[0]->CreatedObj->AsString(@_); }
     },
     CreatedBy => {
         attribute => 'CreatedBy',
@@ -262,8 +265,8 @@
     },
     LastUpdated => {
         attribute => 'LastUpdated',
-        title     => 'Last Updated',
-        value     => sub { return $_[0]->LastUpdatedObj->AsString }
+        title     => 'Last Updated Time',
+        value     => sub { return $_[0]->LastUpdatedObj->AsString(@_);
}
     },
     LastUpdatedBy => {
         attribute => 'LastUpdatedBy',
@@ -271,16 +274,28 @@
         value     => sub { return $_[0]->LastUpdatedByObj->Name }
     },
     Told => {
+       title => "Told Time",
         attribute => 'Told',
-        value     => sub { return $_[0]->ToldObj->AsString }
+        value     => sub { return $_[0]->ToldObj->AsString(@_); }
     },
     Due => {
+       title => "Due Time",
         attribute => 'Due',
-        value     => sub { return $_[0]->DueObj->AsString }
+        value     => sub { return $_[0]->DueObj->AsString(@_); }
     },
     Resolved => {
+       title => "Resolved Time",
         attribute => 'Resolved',
-        value     => sub { return $_[0]->ResolvedObj->AsString }
+        value     => sub { return $_[0]->ResolvedObj->AsString(@_); }
+    },
+    TicketHistory => {
+       title => "TicketHistory",
+        attribute => 'id',
+        value     => sub { return
($m->comp("/Ticket/Elements/ShowHistory",
+                                          "Ticket" => $_[0]),
+                                  \"<br style='page-break-after:
always;'/>");
+
+# XXX Should including the TicketHistory field could force a page
+# break after when printing results, or should this be up to the user
+# to add something such as the above to the format?  It could possibly
+# be added to the stylesheet as well if there is an appropriate
+# classed tag somewhere related.
+#
+# Unfortunately it looks like Firefox does not currently support the
+# page-break tags. --BD
+
+                      }
     },


More information about the Rt-devel mailing list