Master to 4.2.8
[usit-rt.git] / share / html / Admin / Elements / EditRights
index 046112e..18f3fdc 100644 (file)
@@ -92,19 +92,23 @@ if ($anchor =~ /AddPrincipal/) {
       sync_anchor(<% $anchor |n,j %>);
 
       jQuery(".rights-editor").tabs({
-          select: function(ev, ui) {
-              sync_anchor(ui.tab.hash);
+          beforeActivate: function(ev, ui) {
+              sync_anchor(ui.newPanel.selector);
+              if ( ui.newTab.find('input[type=text]').size() > 0 ) {
+                  ui.newTab.find('input[type=text]:first').focus();
+              }
           }
       });
 
       jQuery(".rights-editor .category-tabs").tabs({
-          cookie: { name: "rights-category-tab" /* saves current tab in cookie */ },
-          show: function(ev, ui) {
+          active: jQuery.cookie('rights-category-tab') || 0,
+          activate: function(ev, ui) {
+              jQuery.cookie('rights-category-tab', ui.newTab.index());
               jQuery(".rights-editor .category-tabs").not(this).each(function() {
                   var item     = jQuery(this);
-                  var selected = item.tabs("option", "selected") || 0;
-                  if (selected != ui.index)
-                      item.tabs("select", ui.index);
+                  var selected = item.tabs("option", "active") || 0;
+                  if (selected != ui.newTab.index())
+                      item.tabs("option", "active", ui.newTab.index());
               });
           }
       });