ColorizedLinks

From Request Tracker Wiki
Jump to navigation Jump to search

Brew Your Own (tested 3.4 & 3.6)

If you use links (depends on, parent, child, etc.) heavily between tickets, it is worth making it more readable by colorizing them.

1. Copy /rt_path/share/html/Ticket/Elements/ShowMembers under local tree.

2. Edit it and change:

<LI><a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: <%$member->Subject%> [<%loc($member->Status)%>]<br>

to:

<li><& /Elements/ShowLink, URI => $link->BaseURI &>

3. Copy /rt_path/share/html/Elements/ShowLink under local tree

4. And edit it to insert something like this:

...
% if (UNIVERSAL::isa($member, "RT::Ticket")) {
% if ($member->Status eq "resolved")  {
<font color="grey">
% } elsif ($member->Status eq "stalled")  {
<font color="orange">
% } else  {
<font color="black">
% }
<%$member->Id%>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<% loc($member->Status) %>]
</font>
% } elsif ( UNIVERSAL::can($member, 'Name')) {
...

That's all you need. Enjoy your colorized links! :)

Native Colors: RT 3.8

--- share/html/Elements/ShowLink	2008-08-30 19:22:15.000000000 -0400
 +++ local/html/Elements/ShowLink	2008-11-27 16:31:54.000000000 -0500
 @@ -49,9 +49,13 @@
  % if ($URI->IsLocal) {
  % my $member = $URI->Object;
  % if (UNIVERSAL::isa($member, "RT::Ticket")) {
 -% my $inactive = $member->QueueObj->IsInactiveStatus($member->Status);
 -
 -<span class="<% $inactive ? 'ticket-inactive' : '' %>">
 +<%perl>
 +require RT::Graph::Tickets;
 +my $status = $member->Status;
 +my $class  = $member->QueueObj->IsInactiveStatus($status)?'ticket-inactive':'';
 +my $color  = $RT::Graph::Tickets::ticket_status_style{$status}->{'fontcolor'};
 +</%perl>
 +<span class="<% $class %>" style="color: <% $color %>">
  <%$member->Id%>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<% loc($member->Status) %>]
  </span>