[Rt-commit] r16482 - rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements

ruz at bestpractical.com ruz at bestpractical.com
Tue Oct 21 22:35:29 EDT 2008


Author: ruz
Date: Tue Oct 21 22:35:28 2008
New Revision: 16482

Modified:
   rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/Tabs

Log:
* show actions on ticket according to its status schema

Modified: rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/Tabs
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/Tabs	(original)
+++ rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/Tabs	Tue Oct 21 22:35:28 2008
@@ -175,18 +175,31 @@
     }
 
     if ( $can{'ModifyTicket'} ) {
-        if ( $ticket->status ne 'resolved' ) {
-            $actions->{'G'} = {
-                path =>
-                    "Ticket/Update.html?action=comment&DefaultStatus=resolved&id="
-                    . $id,
-                title => _('Resolve')
-            };
-        }
-        if ( $ticket->status ne 'open' ) {
-            $actions->{'A'} = {
-                path  => "Ticket/Display.html?Status=open&id=" . $id,
-                title => _('Open it')
+        my $current = $ticket->status;
+        my $schema = $ticket->queue->status_schema;
+        my $i = 1;
+        foreach my $next ( $schema->transitions( $current ) ) {
+            my $action = $schema->transition_action( $current => $next );
+            next if $action eq 'hide';
+
+            my $path = 'Ticket/';
+            if ( $action ) {
+                $path .= "Update.html?". $m->comp(
+                    '/Elements/QueryString',
+                    action => $action,
+                    default_status => $next,
+                    id => $id
+                );
+            } else {
+                $path .= "Display.html?". $m->comp(
+                    '/Elements/QueryString',
+                    Status => $next,
+                    id => $id
+                );
+            }
+            $actions->{'G'. $i++} = {
+                path => $path,
+                title => _( $schema->transition_label( $current => $next ) ),
             };
         }
     }


More information about the Rt-commit mailing list