[Rt-commit] rt branch, 4.2/apply-scrips-to-multiple-queues, updated. rt-4.0.8-462-ge6aee7a

Thomas Sibley trs at bestpractical.com
Wed Nov 14 18:07:25 EST 2012


The branch, 4.2/apply-scrips-to-multiple-queues has been updated
       via  e6aee7ac22664e8924c49dece146c3951a024875 (commit)
      from  873e6bf6c3fde236df9c3e4b151342bf1b05ea99 (commit)

Summary of changes:
 share/html/Admin/Elements/SelectStageForAdded |  5 ++++-
 share/html/Admin/Scrips/Objects.html          | 20 ++++++++++++++++++--
 2 files changed, 22 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit e6aee7ac22664e8924c49dece146c3951a024875
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Nov 14 14:51:26 2012 -0800

    Show the stage selector for global scrips
    
    Clarifies that global scrips *do* have a stage and provides a way to
    flip the stage without unapplying and reapplying.  The selector also
    shows the admin the current stage for a global scrip by preselecting the
    correct default.

diff --git a/share/html/Admin/Elements/SelectStageForAdded b/share/html/Admin/Elements/SelectStageForAdded
index d137bb4..4e534dd 100644
--- a/share/html/Admin/Elements/SelectStageForAdded
+++ b/share/html/Admin/Elements/SelectStageForAdded
@@ -46,6 +46,9 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <div style="text-align:right">
-<% loc('Select scrip stage for newly added queues:') %>
+<% $Label %>
 <& SelectStage, %ARGS &>
 </div>
+<%args>
+$Label => loc('Select scrip stage for newly added queues:')
+</%args>
diff --git a/share/html/Admin/Scrips/Objects.html b/share/html/Admin/Scrips/Objects.html
index 52db4d9..9dc5622 100644
--- a/share/html/Admin/Scrips/Objects.html
+++ b/share/html/Admin/Scrips/Objects.html
@@ -58,6 +58,11 @@
 <input type="checkbox" name="RemoveScrip-<% $id %>" value="0" />
 <&|/l&>check this box to remove this scrip from all objects and be able to choose specific objects.</&>
 </label>
+
+<& /Admin/Elements/SelectStageForAdded,
+    Default => $Stage || ($global_os ? $global_os->Stage : undef),
+    Label   => loc("Select global scrip stage:")
+    &>
 % } else {
 <h2><&|/l&>Apply globally</&></h2>
 
@@ -115,6 +120,15 @@ my $scrip = RT::Scrip->new( $session{'CurrentUser'} );
 $scrip->Load($id) or Abort(loc("Could not load scrip #[_1]", $id));
 $id = $scrip->id;
 
+my $is_global = $scrip->IsGlobal;
+my $global_os;
+
+if ( $is_global ) {
+    $global_os = RT::ObjectScrip->new( $session{CurrentUser} );
+    $global_os->LoadByCols( Scrip => $scrip->id, ObjectId => 0 );
+    undef $global_os unless $global_os->id;
+}
+
 if ( $Update ) {
     my (@results);
     if ( defined (my $del = $ARGS{"RemoveScrip-$id"}) ) {
@@ -129,14 +143,16 @@ if ( $Update ) {
             push @results, $msg;
         }
     }
+    if ($is_global and $global_os and $global_os->Stage ne $Stage) {
+        my ($status, $msg) = $global_os->SetStage($Stage);
+        push @results, $msg;
+    }
     MaybeRedirectForResults(
         Actions   => \@results,
         Arguments => { id => $id },
     );
 }
 
-my $is_global = $scrip->IsGlobal;
-
 my $added = $scrip->AddedTo;
 my $not_added = $scrip->NotAddedTo;
 

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


More information about the Rt-commit mailing list