Hello,

Here it is, the solution you need, a little messy perhaps.
I'd love to ask you and the other subscribers to try it, I need your responses 
and feedbacks to put these or better patches under Best Practical's wiki.

Thanks in advance.

-----Original Message-----
From: Carrie Coy <[EMAIL PROTECTED]>
To: [email protected]
Date: Fri, 27 Jul 2007 22:36:33 -0400
Subject: [rt-users] Hide metadata on ticket display?

> 
> Is there a good way to change the ticket display so the Ticket metadata 
> is hidden by default (and may be toggled into view by the user)?  I 
> would like my users to be able to step through a list of tickets using 
> "next" and "previous" without having to hide the metadata each time.

We currently use the following patches to rt codebase to hide what you likely 
want to hide.

put the following in your RT_ROOT/local/po/<yourlocalecode>.po
=====================================================================
msgid "Show Top10 tickets"
msgstr "Show Top10 tickets"

msgid "Hide Top10 tickets"
msgstr "Hide Top10 tickets"

msgid "Show ticket metadata"
msgstr "Show ticket metadata"

msgid "Hide ticket metadata"
msgstr "Hide ticket metadata"
=====================================================================

Apply the following patch (RT_ROOT/local/html/Ticket/Display.html should be 
created automatically, but you might have to create the directory 
RT_ROOT/local/html/Ticket/). Mind it shifts ticket transactions data to the 
top, ticket metadata (junk info, usually) to the bottom. It also provides the 
ability to 'delete' tickets via 
http://rt/Ticket/Display.html?Action=delete&id=<someid>
It uses CustomFieldsOnReply solution, which you are free to omit (look at if ( 
$RT::CustomFieldsOnReply ) part, it's to be skipped if you don't need it)
=====================================================================
diff -ubr --minimal RT_ROOT/share/html/Ticket/Display.html 
RT_ROOT/local/html/Ticket/Display.html
--- RT_ROOT/share/html/Ticket/Display.html      Thu May 17 08:08:14 2007
+++ RT_ROOT/local/html/Ticket/Display.html      Thu Jul 12 19:18:49 2007
@@ -53,12 +53,6 @@
     Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
 
 <& /Elements/ListActions, actions => [EMAIL PROTECTED] &>
-<& /Elements/Callback, _CallbackName => 'BeforeShowSummary', Ticket => 
$TicketObj, %ARGS &>
-<&| /Widgets/TitleBox, title => loc('Ticket metadata') &>
-<& /Ticket/Elements/ShowSummary,  Ticket => $TicketObj, Attachments => 
$attachments &>
-</&>
-
-<br />
 
 <& /Elements/Callback, _CallbackName => 'BeforeShowHistory', Ticket => 
$TicketObj, %ARGS &>
 
@@ -74,12 +68,28 @@
 
 <& /Elements/Callback, _CallbackName => 'AfterShowHistory', Ticket => 
$TicketObj, %ARGS &>
 
+<& /Elements/Callback, _CallbackName => 'BeforeShowSummary', Ticket => 
$TicketObj, %ARGS &>
+<&| /Widgets/TitleBox,
+       title => loc('Ticket metadata'),
+       titleright=> loc( ( $ShowSummary or $ShowTopTen )? "Hide ticket 
metadata" : "Show ticket metadata" ),
+       titleright_href => "$RT::[EMAIL PROTECTED]>Id]}&ShowSummary=" . ( 1 - 
!! ( $ShowTopTen or $ShowSummary ) )
+&>
+% if ( $ShowSummary or $ShowTopTen ) {
+<& /Ticket/Elements/ShowSummary,  Ticket => $TicketObj, Attachments => 
$attachments, ShowTopTen => $ARGS{'ShowTopTen'} &>
+% }
+</&>
+
+<br />
+
 <%ARGS>
 $id => undef
 $Create => undef
 $ShowHeaders => 0
+$ShowTopTen => 0
+$ShowSummary => 0
 $Collapsed => undef
 $TicketObj => undef
+$DisplayPath => "/Ticket/Display.html"
 </%ARGS>
 
 <%INIT>
@@ -126,7 +136,7 @@
          ActionsRef => [EMAIL PROTECTED], ARGSRef => \%ARGS);
 
     if (defined $ARGS{'Action'}) {
-       if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
+        if ($ARGS{'Action'} =~ /^(Steal|Delete|Take|SetTold)$/) {
            my $action = $1;
            my ($res, $msg)=$TicketObj->$action();
            push(@Actions, $msg);
@@ -153,16 +163,14 @@
     my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, 
TicketObj=>$TicketObj);
     my @results = ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => 
\%ARGS);
 
+    if ( $RT::TicketCustomFieldsOnReply ) {
+         my @cf_results = ProcessTicketCustomFieldUpdates( ARGSRef => \%ARGS );
+         push(@results, @cf_results);
+    }
+
     push (@Actions, @PeopleActions, @BasicActions, @results);
 }
 
-$m->comp('/Elements/Callback', _CallbackName => 'BeforeDisplay',
-        TicketObj => \$TicketObj,
-     Tickets => \$Tickets,
-     Actions => [EMAIL PROTECTED],
-     ARGSRef => \%ARGS,
-);
-
 # This code does automatic redirection if any updates happen. 
 
 if (@Actions) {
@@ -174,6 +182,13 @@
 } else {
     @Actions = @{ delete $session{"Actions"} || [] };
 }
+
+$m->comp('/Elements/Callback', _CallbackName => 'BeforeDisplay',
+        TicketObj => \$TicketObj,
+     Tickets => \$Tickets,
+     Actions => [EMAIL PROTECTED],
+     ARGSRef => \%ARGS,
+);
 
 my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj, 
Tickets => $Tickets);
 my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => 
$TicketObj);
=====================================================================

Now the following path implements the possibility to hide unneccessary 'show 
the requestor's top 10 most prioritized tickets', which is quite expensive for 
the tracker's performance
=====================================================================
diff -ubr --minimal RT_ROOT/share/html/Ticket/Elements/ShowRequestor 
RT_ROOT/local/html/Ticket/Elements/ShowRequestor
--- RT_ROOT/share/html/Ticket/Elements/ShowRequestor    Tue Apr 24 21:21:42 2007
+++ RT_ROOT/local/html/Ticket/Elements/ShowRequestor    Thu Jul 12 19:58:17 2007
@@ -52,15 +52,20 @@
 while (my $requestor=$people->Next) {
 next if $requestor->Privileged;
 my $name=$requestor->RealName || $requestor->EmailAddress;     
-my $tickets = RT::Tickets->new($session{'CurrentUser'});
-$tickets->FromSQL( "Requestor.id = ". $requestor->id ." AND (Status = 'open' 
OR Status = 'new')" );
-$tickets->RowsPerPage($rows);
-$tickets->OrderBy(FIELD => 'Priority', ORDER => 'DESC');
+my $tickets = undef;
+if ( $ShowTopTen ) {
+    $tickets = RT::Tickets->new($session{'CurrentUser'});
+    $tickets->FromSQL( "Requestor.id = ". $requestor->id ." AND (Status = 
'open' OR Status = 'new')" );
+    $tickets->RowsPerPage($rows);
+    $tickets->OrderBy(FIELD => 'Priority', ORDER => 'DESC');
+}
 </%PERL>
 
 <&| /Widgets/TitleBox,
     title_href => $has_right_adminusers ? 
"$RT::WebPath/Admin/Users/Modify.html?id=".$requestor->id : undef,
     title=> loc("More about [_1]", $name),
+    titleright=> loc( $ShowTopTen? "Hide Top10 tickets" : "Show Top10 tickets" 
),
+    titleright_href => "$RT::[EMAIL PROTECTED]>id]}&ShowTopTen=" . ( 1 - 
!!$ShowTopTen )
 &>
 
 %# Additional information about this user.  Empty by default.
@@ -69,12 +74,14 @@
 <&|/l&>Comments about this user</&>:<br />
 <b><% ($requestor->Comments || loc("No comment entered about this user")) 
%></b><br />
 
+% if ( $tickets ) {
 <&|/l, $rows &>This user's [_1] highest priority tickets</&>:<br />
 <ul>
 %while (my $w=$tickets->Next) {
 <li><a href="<%$RT::WebPath%><%$DisplayPath%>?id=<%$w->id%>"><%$w->Id%>: 
<%$w->Subject%></a> (<%$w->Status%>)
 %}
 </ul>
+% }
 
 <&|/l&>Groups this user belongs to</&>:<br />
 
@@ -85,5 +92,6 @@
 %}
 <%ARGS>
 $Ticket=>undef
+$ShowTopTen=>undef
 $DisplayPath => "/Ticket/Display.html"
 </%ARGS>
=====================================================================

And the following patch just passes ShowTopTen parameter from ShowSummary to 
the underlying component, namely ShowRequestor.
=====================================================================
diff -ubr --minimal RT_ROOT/share/html/Ticket/Elements/ShowSummary 
RT_ROOT/local/html/Ticket/Elements/ShowSummary
--- RT_ROOT/share/html/Ticket/Elements/ShowSummary      Sun May  6 10:35:28 2007
+++ RT_ROOT/local/html/Ticket/Elements/ShowSummary      Thu Jul 12 20:01:27 2007
@@ -69,7 +69,7 @@
 
       <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => 
$Attachments &>
         <br />
-         <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
+         <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket, ShowTopTen => 
$ShowTopTen &>
 
       <& /Elements/Callback, %ARGS, _CallbackName => 'LeftColumn' &>
        </td>
@@ -107,6 +107,7 @@
 <%ARGS>
 $Ticket => undef
 $Attachments => undef
+$ShowTopTen => undef
 </%ARGS>
=====================================================================

> Thanks,
> Carrie Coy
> 
> 
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: [EMAIL PROTECTED]
> 
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
> 
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to