ACL editor: finally fixed that annoying blank-window bug on rule deletion
authorDan
Mon, 13 Jul 2009 08:00:36 -0400
changeset 1056 f21d6e75b469
parent 1055 15ef8d2147c2
child 1057 183111d8c46a
ACL editor: finally fixed that annoying blank-window bug on rule deletion
includes/clientside/jsres.php
includes/clientside/static/acl.js
includes/clientside/static/fadefilter.js
language/english/admin.json
language/english/core.json
--- a/includes/clientside/jsres.php	Sat Jul 11 20:28:28 2009 -0400
+++ b/includes/clientside/jsres.php	Mon Jul 13 08:00:36 2009 -0400
@@ -13,7 +13,7 @@
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
  */
 
-// define('ENANO_JS_DEBUG', 1);
+define('ENANO_JS_DEBUG', 1);
 
 // if Enano's already loaded, we've been included from a helper script
 if ( defined('ENANO_CONFIG_FETCHED') )
--- a/includes/clientside/static/acl.js	Sat Jul 11 20:28:28 2009 -0400
+++ b/includes/clientside/static/acl.js	Mon Jul 13 08:00:36 2009 -0400
@@ -134,7 +134,7 @@
         document.getElementById(aclManagerID+'_main').innerHTML = '';
         document.getElementById(aclManagerID + '_back').style.display = 'none';
         document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next');
-        groups = parseJSON(ajax.responseText);
+        var groups = parseJSON(ajax.responseText);
         if ( groups.mode == 'error' )
         {
           alert(groups.error);
@@ -196,7 +196,7 @@
   
   selector = document.createElement('div');
   
-  grpsel = __aclBuildGroupsHTML(groups);
+  var grpsel = __aclBuildGroupsHTML(groups);
   grpsel.name = 'group_id';
   
   span = document.createElement('div');
@@ -503,36 +503,55 @@
                 document.getElementById(aclManagerID+'_main').innerHTML = '';
                 document.getElementById(aclManagerID + '_back').style.display = 'none';
                 document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next');
-                var thispage = strToPageID(title);
-                groups.page_id = thispage[0];
-                groups.namespace = thispage[1];
-                __aclBuildSelector(groups);
+                ajaxACLSwitchToSelector();
+                
+                // note
+                var note = document.createElement('div');
+                note.className = 'info-box-mini';
+                note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success')));
                 
-                note = document.createElement('div');
-                note.className = 'info-box';
-                note.style.marginLeft = '0';
+                // button: dismiss note
+                var a_dismiss = document.createElement('a');
+                a_dismiss.href = '#';
+                a_dismiss.onclick = function()
+                {
+                  var p = this.parentNode;
+                  domOpacity(p, 100, 0, 500);
+                  window.setTimeout(function()
+                    {
+                      p.parentNode.removeChild(p);
+                    }, 600);
+                  return false;
+                }
+                a_dismiss.appendChild(document.createTextNode($lang.get('acl_btn_success_dismiss')));
+                note.appendChild(a_dismiss);
+                // add a space
+                note.appendChild(document.createTextNode(' / '));
+                
+                // button: dismiss note
+                var a_close = document.createElement('a');
+                a_close.href = '#';
+                a_close.onclick = function()
+                {
+                  killACLManager();
+                  return false;
+                }
+                a_close.appendChild(document.createTextNode($lang.get('acl_btn_success_close')));
+                note.appendChild(a_close);
+                
+                // style note
+                domObjChangeOpac(note, 0);
                 note.style.position = 'absolute';
-                note.style.width = '558px';
-                note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000);
-                b = document.createElement('b');
-                b.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title')));
-                note.appendChild(b);
-                note.appendChild(document.createElement('br'));
-                note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_body', { target_name: aclDataCache.target_name })));
-                note.appendChild(document.createElement('br'));
-                a = document.createElement('a');
-                a.href = '#';
-                a.onclick = function() { opacity(this.parentNode.id, 100, 0, 1000); setTimeout('var div = document.getElementById("' + this.parentNode.id + '"); div.parentNode.removeChild(div);', 1100); return false; };
-                a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :'));
-                note.appendChild(a);
-                a = document.createElement('a');
-                a.href = '#';
-                a.onclick = function() { killACLManager(); return false; };
-                a.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]'));
-                note.appendChild(a);
-                document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild);
-                //fadeInfoBoxes();
+                // icon padding L + icon padding R + icon width + right padding + border width L + border width R
+                note.style.width = ($dynano(aclManagerID + '_main').Width() - ( 5 + 5 + 16 + 4 + 1 + 1 )) + 'px';
                 
+                // make tangible, then calculate height and position right above button panel
+                var panel = document.getElementById(aclManagerID + '_panel');
+                panel.parentNode.parentNode.appendChild(note);
+                note.style.top = '401px';
+                note.style.left = '0px';
+                
+                opacity(note, 0, 100, 500);
               }
             }, true);
             
@@ -664,7 +683,7 @@
 
 function __aclBuildGroupsHTML(groups)
 {
-  groups = groups.groups;
+  var groups = groups.groups;
   select = document.createElement('select');
   for(var i in groups)
   {
@@ -794,7 +813,7 @@
   }
   else
   {
-    setTimeout("document.getElementById('"+aclManagerID+"').style.display = 'block'; opacity('"+aclManagerID+"', 0, 100, 500); opacity('"+aclManagerID + '_panel'+"', 0, 100, 500);", 1000);
+    setTimeout("document.getElementById('"+aclManagerID+"').style.display = 'block'; opacity('"+aclManagerID+"', 0, 100, 250); opacity('"+aclManagerID + '_panel'+"', 0, 100, 250);", 500);
   }
 }
 
--- a/includes/clientside/static/fadefilter.js	Sat Jul 11 20:28:28 2009 -0400
+++ b/includes/clientside/static/fadefilter.js	Mon Jul 13 08:00:36 2009 -0400
@@ -5,6 +5,7 @@
  */
 
 var darkener_index = [];
+var FADE_TIME = 500; // in ms
 
 function darken(nofade, opacVal, layerid)
 {
@@ -28,14 +29,14 @@
       if ( document.getElementById(layerid).style.display != 'none' )
       {
         var currentOpac = document.getElementById(layerid).myOpacVal;
-        opacity(layerid, currentOpac, opacVal, 1000);
+        opacity(layerid, currentOpac, opacVal, FADE_TIME);
         document.getElementById(layerid).myOpacVal = opacVal;
       }
       else
       {
         document.getElementById(layerid).style.display = 'block';
         document.getElementById(layerid).myOpacVal = opacVal;
-        opacity(layerid, 0, opacVal, 1000);
+        opacity(layerid, 0, opacVal, FADE_TIME);
       }
     }
   }
@@ -86,7 +87,7 @@
       body = document.getElementsByTagName('body');
       body = body[0];
       body.appendChild(thediv);
-      opacity(layerid, 0, opacVal, 1000);
+      opacity(layerid, 0, opacVal, FADE_TIME);
     }
   }
   return document.getElementById(layerid);
@@ -116,7 +117,7 @@
     {
       document.getElementById(layerid).destroying = true;
       var from = document.getElementById(layerid).myOpacVal;
-      opacity(layerid, from, 0, 1000);
+      opacity(layerid, from, 0, FADE_TIME);
       setTimeout("var l = document.getElementById('" + layerid + "'); var b = document.getElementsByTagName('body')[0]; b.removeChild(l);", 1000);
     }
   }
--- a/language/english/admin.json	Sat Jul 11 20:28:28 2009 -0400
+++ b/language/english/admin.json	Mon Jul 13 08:00:36 2009 -0400
@@ -115,8 +115,7 @@
       lbl_deleterule: 'Delete this rule',
       lbl_save_success_title: 'Permissions updated',
       lbl_save_success_body: 'The permissions for %target_name% on this page have been updated successfully. If you changed permissions that affect your user account, you may not see changes until you reload the page.',
-      lbl_delete_success_title: 'Rule deleted',
-      lbl_delete_success_body: 'The access rules for %target_name% on this page have been deleted.',
+      lbl_delete_success: 'Rule deleted. ',
       lbl_preset_load_title: 'Load a preset',
       lbl_preset_load: 'Select a preset...',
       lbl_preset_save_title: 'Enter a name for this preset',
@@ -149,7 +148,7 @@
       msg_deleterule_confirm: 'Do you really want to delete this rule?',
       msg_closeacl_confirm_title: 'Close the ACL manager?',
       msg_closeacl_confirm_body: 'This will cancel any changes that you haven\'t saved.',
-      msg_deny_everyone_confirm: 'CAUTION: You are setting a Deny ruling for everyone on this site. This will block the selected actions from being performed at all. Do you really want to do this?\n\nPlease also note that the following core pages will not be blocked from being accessed: Special:Login, Special:Logout, and Special:LangExportJSON.',
+      msg_deny_everyone_confirm: 'CAUTION: You are setting a Deny ruling for everyone on this site. This will block the selected actions from being performed at all. Do you really want to do this?\n\nPlease also note that the following core pages cannot be blocked: Special:Login, Special:Logout, and Special:LangExportJSON.',
       
       msg_scale_intro_title: 'Existing ACL rules',
       msg_scale_intro_body: 'This is a list of all the existing ACL rules on your site. You can click an entry to edit it. Selecting the same criteria in the user and group selection page will also allow editing a rule.',
--- a/language/english/core.json	Sat Jul 11 20:28:28 2009 -0400
+++ b/language/english/core.json	Mon Jul 13 08:00:36 2009 -0400
@@ -503,7 +503,7 @@
       thmsel_msg_success: 'Theme changed',
       thmsel_btn_reload: 'Reload page',
       thmsel_btn_close: 'Close selector and reload later',
-      thmsel_btn_close_hint: 'You will see your new theme choice go into effect the next time you refresh this page.',
+      thmsel_btn_close_hint: 'You\'ll see your new theme on the next page reload.',
       
       badjson_title: 'The site encountered an error while processing your request.',
       badjson_body: 'We unexpectedly received the following response from the server. The response should have been in the JSON serialization format, but the response wasn\'t composed only of the JSON response. There are three possible triggers for this problem:',