[Rt-commit] rt branch, 4.0/retain-selection-in-admin-rights, created. rt-4.0.4-151-gdc1da3e

? sunnavy sunnavy at bestpractical.com
Mon Jan 9 03:31:30 EST 2012


The branch, 4.0/retain-selection-in-admin-rights has been created
        at  dc1da3e8286a9b62b7e3685f1ac2ce21b95134ce (commit)

- Log -----------------------------------------------------------------
commit dc1da3e8286a9b62b7e3685f1ac2ce21b95134ce
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Jan 9 16:07:56 2012 +0800

    show the selected user/group after submition. issue #19205

diff --git a/share/html/Admin/Elements/EditRights b/share/html/Admin/Elements/EditRights
index 5ef7389..6f05ca6 100644
--- a/share/html/Admin/Elements/EditRights
+++ b/share/html/Admin/Elements/EditRights
@@ -66,6 +66,27 @@ unless ( $AddPrincipal ) {
         $AddPrincipal = 'user'; # loc
     }
 }
+
+my $req_args = $m->request_args;
+my $hash;
+
+if ( $req_args->{'AddPrincipalForRights-group'} ) {
+    my $group = RT::Group->new( $session{CurrentUser} );
+    $group->LoadUserDefinedGroup( $req_args->{'AddPrincipalForRights-group'} );
+    if ( $group->id ) {
+        $hash = "#acl-User_Groups-" . $group->PrincipalObj->id;
+    }
+}
+elsif ( $req_args->{'AddPrincipalForRights-user'} ) {
+    my $user = RT::User->new( $session{CurrentUser} );
+    $user->Load( $req_args->{'AddPrincipalForRights-user'} );
+    if ( $user->id ) {
+        $hash = "#acl-Users-" . $user->PrincipalObj->id;
+    }
+}
+else {
+    $hash = $req_args->{LocationHash};
+}
 </%init>
 %# Principals is an array of arrays, where the inner arrays are like:
 %#      [ 'Category name' => $CollectionObj => 'DisplayColumn' => 1 ]
@@ -74,16 +95,31 @@ unless ( $AddPrincipal ) {
 
 <script type="text/javascript">
   jQuery(function() {
+% if ( $hash ) {
+    if ( jQuery('<% $hash %>').length ) {
+      window.location.hash = "<% $hash %>";
+      jQuery(".rights-editor").find("input[name=LocationHash]").attr(
+"value", "<% $hash %>" );
+    }
+% }
+
       jQuery(".rights-editor").tabs({
           select: function(ev, ui) {
               window.location.hash = ui.tab.hash;
+              if ( ui.tab.hash.match(/\d+/) ) {
+                  jQuery(".rights-editor").find("input[name=LocationHash]").attr(
+"value", ui.tab.hash );
+              }
           }
       });
+
       jQuery(".rights-editor .category-tabs").tabs();
   });
 </script>
 
 <div class="rights-editor clearfix">
+  <input type="hidden" value="" name="LocationHash" />
+
   <ul>
 <%perl>
 for my $category (@$Principals) {

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


More information about the Rt-commit mailing list