[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-453-gac1d7d2

Alex Vandiver alexmv at bestpractical.com
Thu Nov 11 05:33:54 EST 2010


The branch, 3.9-trunk has been updated
       via  ac1d7d2a448e2a5a24a18a0fc8de2a5c7e415a5c (commit)
       via  aee21f9602588dfd85072d43b840d6c81ecc29bb (commit)
      from  427163819d48f552798b9b69f25ed22fdf001ebe (commit)

Summary of changes:
 share/html/Admin/Groups/Modify.html         |   31 +++++++-------------------
 share/html/Admin/Queues/Modify.html         |   11 ++++++++-
 share/html/Admin/Users/Modify.html          |   11 +++++++--
 share/html/Elements/MaybeRedirectForResults |    2 +-
 share/html/Elements/Tabs                    |    2 +-
 5 files changed, 29 insertions(+), 28 deletions(-)

- Log -----------------------------------------------------------------
commit aee21f9602588dfd85072d43b840d6c81ecc29bb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Nov 11 05:21:23 2010 -0500

    Give the global CF menu item a predictable id

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 95c34e1..d7b7871 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -148,7 +148,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
 #            $workflows->child( loc('Mappings')     => path => "/Admin/Global/Workflows/Mappings.html" );
 #        }
 
-        my $cfadmin = $admin_global->child( loc('Custom Fields'), path => '/Admin/Global/CustomFields/index.html', );
+        my $cfadmin = $admin_global->child( 'custom-fields' => title => loc('Custom Fields'), path => '/Admin/Global/CustomFields/index.html', );
         {
             $cfadmin->child( users => title => loc('Users') => text => loc('Select custom fields for all users'),
                              path => '/Admin/Global/CustomFields/Users.html');

commit ac1d7d2a448e2a5a24a18a0fc8de2a5c7e415a5c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Nov 11 05:21:54 2010 -0500

    Make more widespread use of MaybeRedirectForResults, which fixes some menu item breakage

diff --git a/share/html/Admin/Groups/Modify.html b/share/html/Admin/Groups/Modify.html
index 5e9cce5..bc5c585 100755
--- a/share/html/Admin/Groups/Modify.html
+++ b/share/html/Admin/Groups/Modify.html
@@ -102,38 +102,30 @@ my $Group = RT::Group->new($session{'CurrentUser'});
 
 if ($Create) {
     $title = loc("Create a new group");
-} 
-
-else {
+} else {
     if ($id eq 'new' ) {
-	
-	my ($create_id, $create_msg) = $Group->CreateUserDefinedGroup(Name =>
-    "$Name");
+	my ($create_id, $create_msg) = $Group->CreateUserDefinedGroup(Name => $Name );
         unless ($create_id) {
             Abort (loc("Group could not be created: [_1]", $create_msg));
-     }
+        }
 	$id = $Group->Id;
-    }
-    else {
+        push @results, $create_msg;
+    } else {
 	$Group->Load($id) || Abort('Could not load group');
     }
 
-
     if ($id) {
 	$title = loc("Modify the group [_1]", $Group->Name);
-
-    }	
+    }
 
     # If the create failed
     else {
 	$title = loc("Create a new group");
 	$Create = 1;
-    }    
-    
+    }
 }
 
 if ($id) {
-    
     my @fields = qw(Description Name );
     my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
 					    Object => $Group,
@@ -145,8 +137,7 @@ if ($id) {
 #we're asking about enabled on the web page but really care about disabled.
 if (defined $Enabled && $Enabled == 1) {
     $Disabled = 0;
-}	
-else {
+} else {
     $Disabled = 1;
 }
 if  ( ($SetEnabled) and ( $Disabled != $Group->Disabled) ) { 
@@ -159,14 +150,10 @@ $m->comp(
     '/Elements/MaybeRedirectForResults',
     Actions     => \@results,
     Path        => '/Admin/Groups/Modify.html',
-    id              => $id,
+    id          => $Group->Id,
     ARGSRef     => \%ARGS
 );
 
-
-
-
-
 unless ($Group->Disabled()) {
     $EnabledChecked ='checked="checked"';
 }
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index 9757827..bad71b4 100755
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -149,7 +149,7 @@ if ($Create) {
     if ( defined $id && $id eq 'new' ) {
         my ($val, $msg) = $QueueObj->Create( Name => $Name );
         Abort("$msg") unless $val;
-		push @results, $msg;
+	push @results, $msg;
     }
     else {
         $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort(loc("Couldn't load queue '[_1]'", $Name));
@@ -201,6 +201,15 @@ if ( $QueueObj->Id ) {
         }
     }
 }
+
+# This code does automatic redirection if any updates happen.
+$m->comp(
+    '/Elements/MaybeRedirectForResults',
+    Actions     => \@results,
+    Path        => '/Admin/Queues/Modify.html',
+    id          => $QueueObj->Id,
+    ARGSRef     => \%ARGS
+);
 </%INIT>
 
 
diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
index 143c4dc..194633a 100755
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@ -367,9 +367,14 @@ if (!$Create && $UserObj->Privileged()) {
     $PrivilegedChecked = 'checked="checked"';
 }
 
-# set the id, so the the menu will have the right info, this needs to
-# be done here to avoid creating and then modifying a user
-$id = $UserObj->Id;
+# This code does automatic redirection if any updates happen.
+$m->comp(
+    '/Elements/MaybeRedirectForResults',
+    Actions     => \@results,
+    Path        => '/Admin/Users/Modify.html',
+    id          => $UserObj->Id,
+    ARGSRef     => \%ARGS
+);
 
 </%INIT>
 
diff --git a/share/html/Elements/MaybeRedirectForResults b/share/html/Elements/MaybeRedirectForResults
index 0cf933b..4234f96 100644
--- a/share/html/Elements/MaybeRedirectForResults
+++ b/share/html/Elements/MaybeRedirectForResults
@@ -52,7 +52,7 @@ $Path
 $id
 </%args>
 <%init>
-if ( @$Actions ) {
+if ( grep {defined} @$Actions ) {
     # We've done something, so we need to clear the decks to avoid
     # resubmission on refresh.
     # But we need to store Actions somewhere too, so we don't lose them.

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


More information about the Rt-commit mailing list