[Rt-commit] r7112 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Mar 2 14:33:37 EST 2007


Author: ruz
Date: Fri Mar  2 14:33:37 2007
New Revision: 7112

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/ShowTransaction

Log:
 r4585 at cubic-pc:  cubic | 2007-02-15 23:30:09 +0300
 * simplify things a little for further development


Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/ShowTransaction
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/ShowTransaction	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/ShowTransaction	Fri Mar  2 14:33:37 2007
@@ -87,52 +87,59 @@
 $ShowBody => 1
 $LastTransaction => 0
 </%ARGS>
+<%ONCE>
 
-<%INIT>
+my %class = (
+    Create     => 'message',
+    Correspond => 'message',
+    Comment    => 'message',
+
+    AddWatcher => 'people',
+    DelWatcher => 'people',
+    Take       => 'people',
+    Untake     => 'people',
+    Force      => 'people',
+    Steal      => 'people',
+    Give       => 'people',
+
+    AddLink    => 'links',
+    DeleteLink => 'links',
+);
 
-my ( $TimeTaken, $TicketString, $type_class );
+</%ONCE>
+<%INIT>
 
 my $transdate = $Transaction->CreatedAsString();
 $transdate =~ s/\s/&nbsp;/g;
 
-if ( $Transaction->Type =~ /^(Create|Correspond|Comment$)/ ) {
-    if ( $Transaction->IsInbound ) {
-        $type_class = 'message';
-    }
-    else {
-        $type_class = 'message';
-    }
-}
-elsif (    ( $Transaction->Field =~ /^Owner$/ )
-        or ( $Transaction->Type =~ /^(AddWatcher|DelWatcher)$/ ) ) {
-    $type_class = 'people';
+my ($type, $field) = ($Transaction->Type, $Transaction->Field);
+my $type_class = $class{ $type };
 
-}
-elsif ( $Transaction->Type =~ /^(AddLink|DeleteLink)$/ ) {
-    $type_class = 'links';
-}
-elsif ( $Transaction->Type =~ /^(Status|Set|Told)$/ ) {
-    if ( $Transaction->Field =~ /^(Told|Starts|Started|Due)$/ ) {
-        $type_class = 'dates';
+unless ( $type_class ) {
+    if ( $field eq 'Owner' ) {
+        $type_class = 'people';
+    }
+    elsif ( $type =~ /^(Status|Set|Told)$/ ) {
+        if ( $field =~ /^(Told|Starts|Started|Due)$/ ) {
+            $type_class = 'dates';
+        }
+        else {
+            $type_class = 'basics';
+        }
     }
     else {
-        $type_class = 'basics';
+        $type_class = 'other';
     }
 }
-else {
-    $type_class = 'other';
-}
 
+my $TicketString = '';
 if ( $Ticket->Id != $Transaction->Ticket ) {
     $TicketString = "Ticket " . $Transaction->Ticket . ": ";
 }
-$TicketString ||= '';
 
-if ( $Transaction->TimeTaken != 0 ) {
-    $TimeTaken = $Transaction->TimeTaken . " min";
-} else {
-    $TimeTaken = '';
-}
+my $TimeTaken = '';
+$TimeTaken = $Transaction->TimeTaken . " min"
+    if $Transaction->TimeTaken;
 
 unless ($Attachments) { 
     my $attachments = $Transaction->Attachments;


More information about the Rt-commit mailing list