[Rt-commit] rtir branch, 2.9-trunk, updated. 37d0957751acf623f411bb79ab65419ebfa33b6c

Ruslan Zakirov ruz at bestpractical.com
Thu Mar 10 15:01:14 EST 2011


The branch, 2.9-trunk has been updated
       via  37d0957751acf623f411bb79ab65419ebfa33b6c (commit)
       via  766e8a19b3ac96bce20077f5693733bb027e4e26 (commit)
       via  1d8ba713b93b9aabc1245cdd5c55ff8ca482cac6 (commit)
       via  48fa1c8f3a9ac5dd6364a3de9873b44dc931cd88 (commit)
       via  cec30d0c30f19bbf4700b5d7d1b623b6b74d2a71 (commit)
       via  6610ed146286f143afb9dd9dbcfc796345236006 (commit)
       via  da3c83ac7a54bca74f5c56c1a982a0346ee4db80 (commit)
      from  55c52d2fabec64a1fd69014109294b3be1882d29 (commit)

Summary of changes:
 html/Callbacks/RTIR/Elements/Tabs/Privileged    |   47 ++++++++++++-----------
 html/Callbacks/RTIR/Ticket/Display.html/Initial |   17 +++++---
 html/RTIR/Update.html                           |    2 +-
 lib/RT/Action/RTIR_SetState.pm                  |   16 ++++---
 4 files changed, 44 insertions(+), 38 deletions(-)

- Log -----------------------------------------------------------------
commit da3c83ac7a54bca74f5c56c1a982a0346ee4db80
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 10 17:16:52 2011 +0300

    cleanup SetState

diff --git a/lib/RT/Action/RTIR_SetState.pm b/lib/RT/Action/RTIR_SetState.pm
index 8bc3ec4..03d0d3d 100644
--- a/lib/RT/Action/RTIR_SetState.pm
+++ b/lib/RT/Action/RTIR_SetState.pm
@@ -23,16 +23,18 @@ sub Commit {
     my $self = shift;
 
     my $t = $self->TicketObj;
+
+    my $txn = $self->TransactionObj;
  
-    if ( $self->TransactionObj->Field eq 'Status' ) {
-        return 1;
-    }
+    return 1 if $txn->Type eq 'Set' && $txn->Field eq 'Status';
 
-    my $state = $self->GetState;
-    return 1 unless $state;
+    my $status = $self->GetState;
+    return 1 unless $status;
+    return 1 if $t->Status eq $status;
 
-    my ( $res, $msg ) = $t->SetStatus( $state ) unless $t->Status eq $state;
-    $RT::Logger->warning("Couldn't set status to $state: $msg") unless $res;
+    my ( $res, $msg ) = $t->SetStatus( $status );
+    $RT::Logger->warning("Couldn't set status to $status: $msg")
+        unless $res;
     return 1;
 }
 

commit 6610ed146286f143afb9dd9dbcfc796345236006
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 10 17:46:42 2011 +0300

    typo s/$type/$Type/

diff --git a/html/RTIR/Update.html b/html/RTIR/Update.html
index 6f6c913..22ac64e 100644
--- a/html/RTIR/Update.html
+++ b/html/RTIR/Update.html
@@ -105,7 +105,7 @@ $DefaultStatus ||= $ARGS{'Status'} || '';
 $ARGS{'Status'} ||= $DefaultStatus; # XXX: we should get rid of the DefaultStatus
 $DefaultStatus = 'open' if $DefaultStatus eq 'new';
 
-my $title = loc("Update [_1] #[_2] ([_3])", $type, $id, $Ticket->Subject);
+my $title = loc("Update [_1] #[_2] ([_3])", $Type, $id, $Ticket->Subject);
 
 my $CanRespond = 0;
 my $CanComment = 0;

commit cec30d0c30f19bbf4700b5d7d1b623b6b74d2a71
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 10 17:47:20 2011 +0300

    use Redirect so request_path =~ RTIR and Tabs are correct

diff --git a/html/Callbacks/RTIR/Ticket/Display.html/Initial b/html/Callbacks/RTIR/Ticket/Display.html/Initial
index cbaae1c..202f4e2 100644
--- a/html/Callbacks/RTIR/Ticket/Display.html/Initial
+++ b/html/Callbacks/RTIR/Ticket/Display.html/Initial
@@ -15,17 +15,20 @@ if ( $TicketObj ) {
     $QueueObj->Load( $ARGSRef->{'Queue'} );
     $Queue = $QueueObj->Name;
 }
-return unless $Queue;
+return unless $Queue && RT::IR->OurQueue( $Queue );
 
-if ( $Queue eq 'Incidents' ||
-     $Queue eq 'Incident Reports' ||
-     $Queue eq 'Investigations' ||
-     $Queue eq 'Blocks' )
-{
+# for something more complex use subexec
+if ( grep !/^(id|results)$/, keys %$ARGSRef ) {
     $m->subexec( '/RTIR/Display.html', %$ARGSRef );
-    $m->abort;
+    return $m->abort;
 }
 
+# we should use redirect so tabs displayed correctly according to request_comp
+my $url = RT->Config->Get('WebURL') ."RTIR/Display.html?id=". $ARGSRef->{'id'};
+$url .= '&results='. $m->interp->apply_escapes( $ARGSRef->{'results'}, 'u' )
+    if $ARGSRef->{'results'};
+RT::Interface::Web::Redirect( $url );
+
 </%INIT>
 
 <%ARGS>

commit 48fa1c8f3a9ac5dd6364a3de9873b44dc931cd88
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 10 22:59:11 2011 +0300

    add actions submenu like in RT

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 2f769ef..eab27a8 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -109,6 +109,8 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
         return $can{$_[0]} = $ticket->CurrentUserHasRight( $_[0] );
     };
 
+    my $actions_tab = PageMenu()->child( actions => title => loc('Actions'), sort_order  => 95 );
+
     PageMenu()->child( display => title => loc('Display'), path => "/RTIR/Display.html?id=$id" );
 
     # RT4 TODO: something wrong, this doesn't work
@@ -157,36 +159,37 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
         PageMenu()->child( advanced => title => loc('Advanced'), path => "/RTIR/Advanced.html?id=$id" );
     }
 
+    if ( $can->('OwnTicket') ) {
+        if ( $ticket->Owner == $RT::Nobody->id ) {
+            $actions_tab->child(
+                take => title => loc('Take'),
+                path  => "/RTIR/Display.html?Action=Take&id=$id",
+            ) if $can->('ModifyTicket') || $can->('TakeTicket');
+        } elsif ( $ticket->Owner != $session{CurrentUser}->id ) {
+            $actions_tab->child(
+                steal => title => loc('Steal'),
+                path  => "/RTIR/Display.html?Action=Steal&id=$id",
+            ) if $can->('ModifyTicket') || $can->('StealTicket');
+        }
+    }
+
     if ( $can->('ModifyTicket') || $can->('ReplyToTicket') ) {
         if ( $type eq 'Incident' ) {
-            PageMenu()->child(
+            $actions_tab->child(
                 reply_reporters => title => loc('Reply to Reporters'),
                 path  => "/RTIR/Incident/Reply.html?id=$id&SelectAllTickets=1",
             );
-            PageMenu()->child(
+            $actions_tab->child(
                 reply_all => title => loc('Reply to All'),
                 path  => "/RTIR/Incident/Reply.html?id=$id&SelectAllTickets=1&All=1",
             );
         } else {
-            PageMenu()->child(
+            $actions_tab->child(
                 reply => title => loc('Reply'),
                 path  => "/RTIR/Update.html?id=$id&Action=Respond",
             );
         }
     }
-    if ( $can->('OwnTicket') ) {
-        if ( $ticket->Owner == $RT::Nobody->id ) {
-            PageMenu()->child(
-                take => title => loc('Take'),
-                path  => "/RTIR/Display.html?Action=Take&id=$id",
-            ) if $can->('ModifyTicket') || $can->('TakeTicket');
-        } elsif ( $ticket->Owner != $session{CurrentUser}->id ) {
-            PageMenu()->child(
-                steal => title => loc('Steal'),
-                path  => "/RTIR/Display.html?Action=Steal&id=$id",
-            ) if $can->('ModifyTicket') || $can->('StealTicket');
-        }
-    }
 
     my $i = 0;
     my $status = $ticket->Status;
@@ -222,7 +225,7 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
                 Status => $next,
             );
         }
-        PageMenu()->child(
+        $actions_tab->child(
             lc($info->{'label'} || $next),
             title => loc( $info->{'label'} || ucfirst($next) ),
             path  => $path,

commit 1d8ba713b93b9aabc1245cdd5c55ff8ca482cac6
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 10 22:59:56 2011 +0300

    don't show first/last link if it's the same ticket

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index eab27a8..0cf2b71 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -133,7 +133,7 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
             $top->child(
                 first => path  => "/RTIR/Display.html?id=$t",
                 title => '<< ' . loc('First')
-            );
+            ) if $t != $id;
         }
 
         $top = PageMenu();
@@ -147,7 +147,7 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
             $top->child(
                 last => path  => "/RTIR/Display.html?id=$t",
                 title => loc('Last') . ' >>'
-            );
+            ) if $t != $id;
         }
     }
 

commit 766e8a19b3ac96bce20077f5693733bb027e4e26
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 10 23:00:36 2011 +0300

    put Comment under actions as well

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 0cf2b71..74a185d 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -233,7 +233,7 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
     }
 
     if ( $can->('ModifyTicket') || $can->('CommentOnTicket') ) {
-        PageMenu()->child(
+        $actions_tab->child(
             comment => title => loc('Comment'),
             path  => "/RTIR/Update.html?Action=Comment&id=$id",
         );

commit 37d0957751acf623f411bb79ab65419ebfa33b6c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 10 23:00:55 2011 +0300

    fix bookmark link

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 74a185d..3efff13 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -240,9 +240,7 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
     }
 
     PageMenu()->child(
-        bookmark => title => $m->scomp( '/Ticket/Elements/Bookmark', id => $id ),
-        escape_title => 0,
-        link_item    => 0,
+        bookmark => raw_html => $m->scomp( '/Ticket/Elements/Bookmark', id => $id ),
         sort_order   => 99
     );
 } elsif ( $request_path =~ m{^/RTIR/Link/(ToIncident|FromIncident)/} ) {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list