includes/clientside/static/acl.js
author Dan
Mon, 13 Jul 2009 08:00:36 -0400
changeset 1056 f21d6e75b469
parent 907 44851d7e9bda
child 1058 c4b057708436
permissions -rw-r--r--
ACL editor: finally fixed that annoying blank-window bug on rule deletion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     1
// Javascript routines for the ACL editor
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     2
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     3
var aclManagerID = 'enano_aclmanager_' + Math.floor(Math.random() * 1000000);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     4
var aclPermList = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     5
var aclDataCache = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     6
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     7
function ajaxOpenACLManager(page_id, namespace)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     8
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     9
  if(IE)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    10
    return true;
585
35e91d16ecf5 Fixed javascript ACL manager and captcha not showing on ajax login lockout_captcha event
Dan
parents: 582
diff changeset
    11
  
907
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    12
  void(page_id);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    13
  void(namespace);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    14
  
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    15
  // require re-auth
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    16
  if ( auth_level <= USER_LEVEL_MEMBER )
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    17
  {
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    18
    load_component(['login', 'fadefilter', 'flyin', 'jquery', 'jquery-ui', 'crypto', 'messagebox']);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    19
    ajaxDynamicReauth(function(key)
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    20
      {
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    21
        ajaxOpenACLManager(page_id, namespace);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    22
      }, user_level);
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    23
    
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    24
    return false;
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    25
  }
44851d7e9bda Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents: 823
diff changeset
    26
  
787
b0d0d429d8cf Fixed: autocomplete got broken somehow
Dan
parents: 779
diff changeset
    27
  load_component(['l10n', 'messagebox', 'fadefilter', 'template-compiler', 'jquery', 'jquery-ui', 'autofill']);
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 568
diff changeset
    28
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    29
  if(!page_id || !namespace)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    30
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    31
    var data = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    32
    var page_id = data[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    33
    var namespace = data[1];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    34
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    35
  var params = {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    36
      'mode' : 'listgroups',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    37
      'page_id' : page_id,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    38
      'namespace' : namespace
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    39
    };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    40
  params = toJSONString(params);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    41
  params = ajaxEscape(params);
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 787
diff changeset
    42
  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 377
diff changeset
    43
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    44
      {
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    45
        var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 586
diff changeset
    46
        if ( !check_json_response(response) )
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    47
        {
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    48
          handle_invalid_json(ajax.responseText);
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    49
          return false;
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    50
        }
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    51
        try {
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    52
          var groups = parseJSON(ajax.responseText);
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    53
        } catch(e) {
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    54
          handle_invalid_json(ajax.responseText);
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    55
        }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    56
        __aclBuildWizardWindow();
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    57
        if ( groups.mode == 'error' )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    58
        {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    59
          alert(groups.error);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    60
          killACLManager();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    61
          return false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    62
        }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    63
        aclDataCache = groups;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    64
        __aclBuildSelector(groups);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    65
      }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 327
diff changeset
    66
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    67
  return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    68
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    69
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    70
function ajaxOpenDirectACLRule(rule_id)
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    71
{
779
609e35845ec3 load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents: 763
diff changeset
    72
  load_component(['l10n', 'messagebox', 'fadefilter', 'template-compiler', 'autofill']);
694
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
    73
  
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    74
  var params = {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    75
    target_id: rule_id,
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    76
    mode: 'seltarget_id'
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    77
  };
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    78
  params = ajaxEscape(toJSONString(params));
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 787
diff changeset
    79
  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    80
      if ( ajax.readyState == 4 && ajax.status == 200 )
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    81
      {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    82
        var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 586
diff changeset
    83
        if ( !check_json_response(response) )
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    84
        {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    85
          handle_invalid_json(ajax.responseText);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    86
          return false;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    87
        }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    88
        try
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    89
        {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    90
          response = parseJSON(response);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    91
        }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    92
        catch(e)
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    93
        {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    94
          handle_invalid_json(response);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    95
        }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    96
        if ( !document.getElementById(aclManagerID) )
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    97
        {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
    98
          __aclBuildWizardWindow();
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
    99
          var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   100
          main.style.padding = '10px';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   101
        }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   102
        else
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   103
        {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   104
          var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   105
          main.style.backgroundImage = 'none';
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   106
        }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   107
        if ( response.mode == 'error' )
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   108
        {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   109
          alert(response.error);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   110
          killACLManager();
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   111
          return false;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   112
        }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   113
        aclDataCache = response;
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   114
        aclBuildRuleEditor(response, true);
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   115
      }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   116
    }, true);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   117
}
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   118
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   119
function ajaxACLSwitchToSelector()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   120
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   121
  params = {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   122
      'mode' : 'listgroups'
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   123
    };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   124
  if ( aclDataCache.page_id && aclDataCache.namespace )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   125
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   126
    params.page_id   = aclDataCache.page_id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   127
    params.namespace = aclDataCache.namespace;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   128
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   129
  params = toJSONString(params);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   130
  params = ajaxEscape(params);
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 787
diff changeset
   131
  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 377
diff changeset
   132
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   133
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   134
        document.getElementById(aclManagerID+'_main').innerHTML = '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   135
        document.getElementById(aclManagerID + '_back').style.display = 'none';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   136
        document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next');
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   137
        var groups = parseJSON(ajax.responseText);
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   138
        if ( groups.mode == 'error' )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   139
        {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   140
          alert(groups.error);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   141
          killACLManager();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   142
          return false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   143
        }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   144
        aclDataCache = groups;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   145
        thispage = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   146
        groups.page_id = thispage[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   147
        groups.namespace = thispage[1];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   148
        __aclBuildSelector(groups);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   149
      }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 327
diff changeset
   150
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   151
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   152
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   153
function __aclBuildSelector(groups)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   154
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   155
  thispage = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   156
  do_scopesel = ( thispage[0] == groups.page_id && thispage[1] == groups.namespace );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   157
  
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   158
  document.getElementById(aclManagerID + '_next').style.display = 'inline';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   159
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   160
  seed = Math.floor(Math.random() * 1000000);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   161
        
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   162
  main = document.getElementById(aclManagerID + '_main');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   163
  main.style.padding = '10px';
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   164
  main.style.backgroundImage = 'none';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   165
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   166
  // the "edit existing" button
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   167
  var editbtn_wrapper = document.createElement('div');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   168
  editbtn_wrapper.style.styleFloat = 'right';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   169
  editbtn_wrapper.style.cssFloat = 'right';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   170
  editbtn_wrapper.style.fontSize = 'smaller';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   171
  var editbtn = document.createElement('a');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   172
  editbtn.href = '#';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   173
  editbtn.innerHTML = $lang.get('acl_btn_show_existing');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   174
  editbtn_wrapper.appendChild(editbtn);
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   175
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   176
  // tracer button
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   177
  var tracebtn = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   178
  tracebtn.href = '#';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   179
  tracebtn.innerHTML = $lang.get('acl_btn_view_effective');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   180
  editbtn_wrapper.appendChild(document.createElement('br'));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   181
  editbtn_wrapper.appendChild(tracebtn);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   182
  
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   183
  main.appendChild(editbtn_wrapper);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   184
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   185
  editbtn.onclick = function()
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   186
  {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   187
    aclSetViewListExisting();
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   188
    return false;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   189
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   190
  
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   191
  tracebtn.onclick = function()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   192
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   193
    aclSetViewDebugTools();
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   194
    return false;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   195
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   196
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   197
  selector = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   198
  
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   199
  var grpsel = __aclBuildGroupsHTML(groups);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   200
  grpsel.name = 'group_id';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   201
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   202
  span = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   203
  span.id = "enACL_grpbox_"+seed+"";
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   204
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   205
  // Build the selector
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   206
  grpb = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   207
  grpb.type = 'radio';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   208
  grpb.name  = 'target_type';
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   209
  grpb.value = '1'; // ACL_TYPE_GROUP
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   210
  grpb.checked = 'checked';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   211
  grpb.className = seed;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   212
  grpb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'block'; document.getElementById('enACL_usrbox_'+seed).style.display = 'none'; };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   213
  lbl = document.createElement('label');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   214
  lbl.appendChild(grpb);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   215
  lbl.appendChild(document.createTextNode($lang.get('acl_radio_usergroup')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   216
  lbl.style.display = 'block';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   217
  span.appendChild(grpsel);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   218
  
42
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
   219
  anoninfo = document.createElement('div');
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
   220
  anoninfo.className = 'info-box-mini';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   221
  anoninfo.appendChild(document.createTextNode($lang.get('acl_msg_guest_howto')));
42
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
   222
  span.appendChild(document.createElement('br'));
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
   223
  span.appendChild(anoninfo);
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
   224
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   225
  usrb = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   226
  usrb.type = 'radio';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   227
  usrb.name  = 'target_type';
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   228
  usrb.value = '2'; // ACL_TYPE_USER
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   229
  usrb.className = seed;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   230
  usrb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'none'; document.getElementById('enACL_usrbox_'+seed).style.display = 'block'; };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   231
  lbl2 = document.createElement('label');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   232
  lbl2.appendChild(usrb);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   233
  lbl2.appendChild(document.createTextNode($lang.get('acl_radio_user')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   234
  lbl2.style.display = 'block';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   235
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   236
  usrsel = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   237
  usrsel.type = 'text';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   238
  usrsel.name = 'username';
677
2a263b598a2b Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents: 651
diff changeset
   239
  usrsel.className = 'autofill username';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   240
  usrsel.id = 'userfield_' + aclManagerID;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   241
  try {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   242
    usrsel.setAttribute("autocomplete","off");
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   243
  } catch(e) {};
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   244
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   245
  span2 = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   246
  span2.id = "enACL_usrbox_"+seed+"";
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   247
  span2.style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   248
  span2.appendChild(usrsel);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   249
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   250
  // Scope selector
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   251
  if(do_scopesel)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   252
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   253
    scopediv1 = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   254
    scopediv2 = document.createElement('div');
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   255
    scopediv3 = document.createElement('div');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   256
    scopeRadioPage = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   257
      scopeRadioPage.type = 'radio';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   258
      scopeRadioPage.name = 'scope';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   259
      scopeRadioPage.value = 'page';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   260
      scopeRadioPage.checked = 'checked';
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   261
      scopeRadioPage.className = '1048576';
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   262
      if ( groups.page_groups.length > 0 ) scopeRadioPage.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; };
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   263
    scopeRadioGlobal = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   264
      scopeRadioGlobal.type = 'radio';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   265
      scopeRadioGlobal.name = 'scope';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   266
      scopeRadioGlobal.value = 'global';
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   267
      scopeRadioGlobal.className = '1048576';
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   268
      if ( groups.page_groups.length > 0 ) scopeRadioGlobal.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; };
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   269
    scopeRadioGroup = document.createElement('input');
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   270
      scopeRadioGroup.type = 'radio';
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   271
      scopeRadioGroup.name = 'scope';
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   272
      scopeRadioGroup.value = 'group';
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   273
      scopeRadioGroup.className = '1048576';
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   274
      if ( groups.page_groups.length > 0 ) scopeRadioGroup.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'block'; };
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   275
    lblPage = document.createElement('label');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   276
      lblPage.style.display = 'block';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   277
      lblPage.appendChild(scopeRadioPage);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   278
      lblPage.appendChild(document.createTextNode($lang.get('acl_radio_scope_thispage')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   279
    lblGlobal = document.createElement('label');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   280
      lblGlobal.style.display = 'block';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   281
      lblGlobal.appendChild(scopeRadioGlobal);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   282
      lblGlobal.appendChild(document.createTextNode($lang.get('acl_radio_scope_wholesite')));
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   283
    lblGroup = document.createElement('label');
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   284
      lblGroup.style.display = 'block';
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   285
      lblGroup.appendChild(scopeRadioGroup);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   286
      lblGroup.appendChild(document.createTextNode($lang.get('acl_radio_scope_pagegroup')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   287
    scopediv1.appendChild(lblPage);
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   288
    scopediv2.appendChild(lblGroup);
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   289
    scopediv3.appendChild(lblGlobal);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   290
    
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   291
    scopedesc = document.createElement('p');
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   292
    scopedesc.appendChild(document.createTextNode($lang.get('acl_lbl_scope')));
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   293
    
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   294
    scopePGrp = document.createElement('select');
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   295
    scopePGrp.style.marginLeft = '13px';
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   296
    scopePGrp.style.display = 'none';
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   297
    scopePGrp.id = "enACL_pgsel_1048576";
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   298
    
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   299
    var opt;
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   300
    for ( var i = 0; i < groups.page_groups.length; i++ )
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   301
    {
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   302
      opt = document.createElement('option');
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   303
      opt.value = groups.page_groups[i].id;
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   304
      opt.appendChild(document.createTextNode(groups.page_groups[i].name));
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   305
      scopePGrp.appendChild(opt);
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   306
    }
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   307
    
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   308
    scopediv2.appendChild(scopePGrp);
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   309
    
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   310
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   311
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   312
  // Styles
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   313
  span.style.marginLeft = '13px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   314
  span.style.padding = '5px 0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   315
  span2.style.marginLeft = '13px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   316
  span2.style.padding = '5px 0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   317
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   318
  selector.appendChild(lbl);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   319
  selector.appendChild(span);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   320
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   321
  selector.appendChild(lbl2);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   322
  selector.appendChild(span2);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   323
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   324
  container = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   325
  container.style.margin = 'auto';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   326
  container.style.width = '360px';
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   327
  container.style.paddingTop = '50px';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   328
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   329
  head = document.createElement('h2');
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   330
  head.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_title')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   331
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   332
  desc = document.createElement('p');
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   333
  desc.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_body')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   334
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   335
  container.appendChild(head);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   336
  container.appendChild(desc);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   337
  container.appendChild(selector);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   338
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   339
  if(do_scopesel)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   340
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   341
    container.appendChild(scopedesc);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   342
    container.appendChild(scopediv1);
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   343
    if ( groups.page_groups.length > 0 )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   344
    {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   345
      container.appendChild(scopediv2);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   346
    }
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   347
    container.appendChild(scopediv3);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   348
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   349
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   350
  main.appendChild(container);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   351
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   352
  var mode = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   353
  mode.name = 'mode';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   354
  mode.type = 'hidden';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   355
  mode.id = aclManagerID + '_mode';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   356
  mode.value = 'seltarget';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   357
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   358
  var theform = document.getElementById(aclManagerID + '_formobj_id');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   359
  if ( !theform.mode )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   360
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   361
    theform.appendChild(mode);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   362
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   363
  else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   364
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   365
    theform.removeChild(theform.mode);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   366
    theform.appendChild(mode);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   367
  }
677
2a263b598a2b Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents: 651
diff changeset
   368
  
2a263b598a2b Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents: 651
diff changeset
   369
  autofill_init_element(usrsel, {
2a263b598a2b Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents: 651
diff changeset
   370
      allow_anon: true
2a263b598a2b Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents: 651
diff changeset
   371
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   372
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   373
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   374
var aclDebugWin = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   375
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   376
function aclDebug(text)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   377
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   378
  if(!aclDebugWin)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   379
    aclDebugWin = pseudoWindowOpen("data:text/html;plain,<html><head><title>debug win</title></head><body><h1>Debug window</h1></body></html>", "aclDebugWin");
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   380
    setTimeout(function() {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   381
  aclDebugWin.pre = aclDebugWin.document.createElement('pre');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   382
  aclDebugWin.pre.appendChild(aclDebugWin.document.createTextNode(text));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   383
  aclDebugWin.b = aclDebugWin.document.getElementsByTagName('body')[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   384
    aclDebugWin.b.appendChild(aclDebugWin.pre);}, 1000);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   385
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   386
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   387
var pseudoWindows = new Object();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   388
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   389
function pseudoWindowOpen(url, id)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   390
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   391
  if(pseudoWindows[id])
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   392
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   393
    document.getElementById('pseudowin_ifr_'+id).src = url;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   394
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   395
  else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   396
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   397
    win = document.createElement('iframe');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   398
    win.style.position='fixed';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   399
    win.style.width = '640px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   400
    win.style.height = '480px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   401
    win.style.top = '0px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   402
    win.style.left = '0px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   403
    win.style.zIndex = getHighestZ() + 1;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   404
    win.style.backgroundColor = '#FFFFFF';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   405
    win.name = 'pseudo_ifr_'+id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   406
    win.id = 'pseudowindow_ifr_'+id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   407
    win.src = url;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   408
    body = document.getElementsByTagName('body')[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   409
    body.appendChild(win);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   410
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   411
  win_obj = eval("( pseudo_ifr_"+id+" )");
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   412
  return win_obj;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   413
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   414
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   415
function __aclJSONSubmitAjaxHandler(params)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   416
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   417
  params = toJSONString(params);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   418
  params = ajaxEscape(params);
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 787
diff changeset
   419
  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 377
diff changeset
   420
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   421
      {
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   422
        var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 586
diff changeset
   423
        if ( !check_json_response(response) )
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   424
        {
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   425
          handle_invalid_json(ajax.responseText);
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   426
          return false;
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   427
        }
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   428
        try
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   429
        {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   430
          var data = parseJSON(ajax.responseText);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   431
        }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   432
        catch(e)
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   433
        {
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   434
          handle_invalid_json(ajax.responseText);
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   435
          return false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   436
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   437
        aclDataCache = data;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   438
        switch(data.mode)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   439
        {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   440
          case 'seltarget':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   441
            
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   442
            // Build the ACL edit form
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   443
            aclBuildRuleEditor(data);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   444
            
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   445
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   446
          case 'success':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   447
            var note = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   448
            note.className = 'info-box';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   449
            note.style.marginLeft = '0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   450
            var b = document.createElement('b');
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   451
            b.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_title')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   452
            note.appendChild(b);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   453
            note.appendChild(document.createElement('br'));
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   454
            note.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_body', { target_name: data.target_name })));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   455
            note.appendChild(document.createElement('br'));
472
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   456
            
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   457
            /*
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   458
            var a = document.createElement('a');
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 327
diff changeset
   459
            a.href = '#';
419
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 407
diff changeset
   460
            a.id = aclManagerID + '_btn_dismiss';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   461
            a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   462
            note.appendChild(a);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   463
            var a2 = document.createElement('a');
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 327
diff changeset
   464
            a2.href = '#';
419
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 407
diff changeset
   465
            a.id = aclManagerID + '_btn_close';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   466
            a2.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   467
            note.appendChild(a2);
472
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   468
            */
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   469
            
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   470
            var a_dismiss = document.createElement('a');
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   471
            a_dismiss.href = '#';
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   472
            a_dismiss.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :'));
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   473
            note.appendChild(a_dismiss);
42
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
   474
            
472
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   475
            var a_close = document.createElement('a');
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   476
            a_close.href = '#';
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   477
            a_close.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]'));
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   478
            note.appendChild(a_close);
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   479
            
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   480
            document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild);
419
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 407
diff changeset
   481
            
472
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   482
            a_dismiss.setAttribute('onclick', 'var parent = this.parentNode.parentNode; parent.removeChild(this.parentNode); return false;');
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   483
            a_close.setAttribute('onclick', 'killACLManager(); return false;');
419
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 407
diff changeset
   484
            
472
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   485
            if ( !document.getElementById(aclManagerID+'_deletelnk') )
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   486
              document.getElementById(aclManagerID + '_main').innerHTML += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'' + $lang.get('acl_msg_deleterule_confirm') + '\')) __aclDeleteRule(); return false;" style="color: red;">' + $lang.get('acl_lbl_deleterule') + '</a></p>';
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   487
            
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   488
            document.getElementById(aclManagerID+'_main').scrollTop = 0;
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   489
            document.getElementById(aclManagerID+'_main').style.backgroundImage = 'none';
472
bc4b58034f4d Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents: 419
diff changeset
   490
                        
42
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
   491
            aclDataCache.mode = 'save_edit';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   492
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   493
          case 'delete':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   494
            
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   495
            params = {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   496
              'mode' : 'listgroups'
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   497
            };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   498
          params = toJSONString(params);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   499
          params = ajaxEscape(params);
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 787
diff changeset
   500
          ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 377
diff changeset
   501
              if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   502
              {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   503
                document.getElementById(aclManagerID+'_main').innerHTML = '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   504
                document.getElementById(aclManagerID + '_back').style.display = 'none';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   505
                document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next');
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   506
                ajaxACLSwitchToSelector();
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   507
                
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   508
                // note
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   509
                var note = document.createElement('div');
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   510
                note.className = 'info-box-mini';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   511
                note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   512
                
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   513
                // button: dismiss note
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   514
                var a_dismiss = document.createElement('a');
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   515
                a_dismiss.href = '#';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   516
                a_dismiss.onclick = function()
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   517
                {
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   518
                  var p = this.parentNode;
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   519
                  domOpacity(p, 100, 0, 500);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   520
                  window.setTimeout(function()
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   521
                    {
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   522
                      p.parentNode.removeChild(p);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   523
                    }, 600);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   524
                  return false;
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   525
                }
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   526
                a_dismiss.appendChild(document.createTextNode($lang.get('acl_btn_success_dismiss')));
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   527
                note.appendChild(a_dismiss);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   528
                // add a space
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   529
                note.appendChild(document.createTextNode(' / '));
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   530
                
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   531
                // button: dismiss note
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   532
                var a_close = document.createElement('a');
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   533
                a_close.href = '#';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   534
                a_close.onclick = function()
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   535
                {
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   536
                  killACLManager();
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   537
                  return false;
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   538
                }
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   539
                a_close.appendChild(document.createTextNode($lang.get('acl_btn_success_close')));
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   540
                note.appendChild(a_close);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   541
                
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   542
                // style note
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   543
                domObjChangeOpac(note, 0);
42
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
   544
                note.style.position = 'absolute';
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   545
                // icon padding L + icon padding R + icon width + right padding + border width L + border width R
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   546
                note.style.width = ($dynano(aclManagerID + '_main').Width() - ( 5 + 5 + 16 + 4 + 1 + 1 )) + 'px';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   547
                
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   548
                // make tangible, then calculate height and position right above button panel
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   549
                var panel = document.getElementById(aclManagerID + '_panel');
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   550
                panel.parentNode.parentNode.appendChild(note);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   551
                note.style.top = '401px';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   552
                note.style.left = '0px';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   553
                
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   554
                opacity(note, 0, 100, 500);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   555
              }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 327
diff changeset
   556
            }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   557
            
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   558
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   559
          case 'error':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   560
            alert("Server side processing error:\n"+data.error);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   561
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   562
          case 'debug':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   563
            aclDebug(data.text);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   564
            break;
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   565
          case 'list_existing':
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   566
            aclSetViewListExistingRespond(data);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   567
            break;
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   568
          case 'trace':
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   569
            aclDrawTraceWrapper(data);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   570
            break;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   571
          default:
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   572
            handle_invalid_json(ajax.responseText);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   573
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   574
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   575
      }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 327
diff changeset
   576
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   577
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   578
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   579
function aclBuildRuleEditor(data, from_direct)
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   580
{
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   581
  var act_desc = ( data.type == 'new' ) ? $lang.get('acl_lbl_editwin_title_create') : $lang.get('acl_lbl_editwin_title_edit');
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   582
  var target_type_t = ( data.target_type == 1 ) ? $lang.get('acl_target_type_group') : $lang.get('acl_target_type_user');
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   583
  var target_name_t = data.target_name;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   584
  var scope_type = ( data.page_id == false && data.namespace == false ) ? $lang.get('acl_scope_type_wholesite') : ( data.namespace == '__PageGroup' ) ? $lang.get('acl_scope_type_pagegroup') : $lang.get('acl_scope_type_thispage');
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   585
  
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   586
  document.getElementById(aclManagerID + '_next').style.display = 'inline';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   587
  
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   588
  html = '<h2>'+act_desc+'</h2>';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   589
  html += '<p>' + $lang.get('acl_lbl_editwin_body', { target_type: target_type_t, target: target_name_t, scope_type: scope_type }) + '</p>';
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   590
  
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   591
  // preset management
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   592
  var load_flags = 'href="#" onclick="aclShowPresetLoader(); return false;"';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   593
  var save_flags = 'href="#" onclick="aclShowPresetSave(); return false;"';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   594
  html += '<div style="float: right;">';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   595
  html += $lang.get('acl_btn_edit_presets', { load_flags: load_flags, save_flags: save_flags });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   596
  html += '</div>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   597
  html += '<div style="clear: both;"></div>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   598
  
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   599
  parser = new templateParser(data.template.acl_field_begin);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   600
  html += parser.run();
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   601
  
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   602
  cls = 'row2';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   603
  for(var i in data.acl_types)
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   604
  {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   605
    if(typeof(data.acl_types[i]) == 'number')
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   606
    {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   607
      cls = ( cls == 'row1' ) ? 'row2' : 'row1';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   608
      p = new templateParser(data.template.acl_field_item);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   609
      vars = new Object();
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   610
      if ( data.acl_descs[i].match(/^([a-z0-9_]+)$/) )
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   611
      {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   612
        vars['FIELD_DESC'] = $lang.get(data.acl_descs[i]);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   613
      }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   614
      else
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   615
      {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   616
        vars['FIELD_DESC'] = data.acl_descs[i];
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   617
      }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   618
      vars['FIELD_INHERIT_CHECKED'] = '';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   619
      vars['FIELD_DENY_CHECKED'] = '';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   620
      vars['FIELD_DISALLOW_CHECKED'] = '';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   621
      vars['FIELD_WIKIMODE_CHECKED'] = '';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   622
      vars['FIELD_ALLOW_CHECKED'] = '';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   623
      vars['FIELD_NAME'] = i;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   624
      if ( !data.current_perms[i] )
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   625
      {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   626
        data.current_perms[i] = 'i';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   627
      }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   628
      switch(data.current_perms[i])
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   629
      {
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   630
        case 'i':
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   631
        default:
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   632
          vars['FIELD_INHERIT_CHECKED'] = 'checked="checked"';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   633
          break;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   634
        case 1:
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   635
          vars['FIELD_DENY_CHECKED'] = 'checked="checked"';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   636
          break;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   637
        case 2:
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   638
          vars['FIELD_DISALLOW_CHECKED'] = 'checked="checked"';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   639
          break;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   640
        case 3:
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   641
          vars['FIELD_WIKIMODE_CHECKED'] = 'checked="checked"';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   642
          break;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   643
        case 4:
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   644
          vars['FIELD_ALLOW_CHECKED'] = 'checked="checked"';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   645
          break;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   646
      }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   647
      vars['ROW_CLASS'] = cls;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   648
      p.assign_vars(vars);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   649
      html += p.run();
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   650
    }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   651
  }
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   652
  
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   653
  var parser = new templateParser(data.template.acl_field_end);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   654
  html += parser.run();
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   655
  
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   656
  if(data.type == 'edit')
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   657
    html += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'' + $lang.get('acl_msg_deleterule_confirm') + '\')) __aclDeleteRule(); return false;" style="color: red;">' + $lang.get('acl_lbl_deleterule') + '</a></p>';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   658
  
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   659
  var main = document.getElementById(aclManagerID + '_main');
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   660
  main.innerHTML = html;
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   661
  
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   662
  var form = document.getElementById(aclManagerID + '_formobj_id');
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   663
  
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   664
  if ( from_direct )
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   665
  {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   666
    var modeobj = document.getElementById(aclManagerID + '_mode');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   667
    modeobj.value = 'save_edit';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   668
  }
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   669
  else
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   670
  {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   671
    var modeobj = form_fetch_field(form, 'mode');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   672
    if ( modeobj )
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   673
      modeobj.value = 'save_' + data.type;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   674
    else
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   675
      alert('modeobj is invalid: '+modeobj);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   676
  }
512
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   677
  
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   678
  aclPermList = array_keys(data.acl_types);
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   679
  
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   680
  document.getElementById(aclManagerID + '_back').style.display = 'inline';
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   681
  document.getElementById(aclManagerID + '_next').value = $lang.get('etc_save_changes');
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   682
}
13532b0a223f ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents: 511
diff changeset
   683
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   684
function __aclBuildGroupsHTML(groups)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   685
{
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   686
  var groups = groups.groups;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   687
  select = document.createElement('select');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   688
  for(var i in groups)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   689
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   690
    if(typeof(groups[i]['name']) == 'string' && i != 'toJSONString')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   691
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   692
      o = document.createElement('option');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   693
      o.value = groups[i]['id'];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   694
      t = document.createTextNode(groups[i]['name']);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   695
      o.appendChild(t);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   696
      select.appendChild(o);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   697
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   698
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   699
  return select;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   700
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   701
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   702
function __aclBuildWizardWindow()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   703
{
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   704
  darken(aclDisableTransitionFX, 70, 'acldarkener');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   705
  box = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   706
  box.style.width = '640px'
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   707
  box.style.height = '440px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   708
  box.style.position = 'fixed';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   709
  width = getWidth();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   710
  height = getHeight();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   711
  box.style.left = ( width / 2 - 320 ) + 'px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   712
  box.style.top = ( height / 2 - 250 ) + 'px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   713
  box.style.backgroundColor = 'white';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   714
  box.style.zIndex = getHighestZ() + 1;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   715
  box.id = aclManagerID;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   716
  box.style.opacity = '0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   717
  box.style.filter = 'alpha(opacity=0)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   718
  box.style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   719
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   720
  mainwin = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   721
  mainwin.id = aclManagerID + '_main';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   722
  mainwin.style.clip = 'rect(0px,640px,440px,0px)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   723
  mainwin.style.overflow = 'auto';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   724
  mainwin.style.width = '620px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   725
  mainwin.style.height = '420px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   726
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   727
  panel = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   728
  panel.style.width = '620px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   729
  panel.style.padding = '10px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   730
  panel.style.lineHeight = '40px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   731
  panel.style.textAlign = 'right';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   732
  panel.style.position = 'fixed';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   733
  panel.style.left = ( width / 2 - 320 ) + 'px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   734
  panel.style.top = ( height / 2 + 190 ) + 'px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   735
  panel.style.backgroundColor = '#D0D0D0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   736
  panel.style.opacity = '0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   737
  panel.style.filter = 'alpha(opacity=0)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   738
  panel.id = aclManagerID + '_panel';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   739
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   740
  form = document.createElement('form');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   741
  form.method = 'post';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   742
  form.action = 'javascript:void(0)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   743
  form.onsubmit = function() { if(this.username && !submitAuthorized) return false; __aclSubmitManager(this); return false; };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   744
  form.name = aclManagerID + '_formobj';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   745
  form.id   = aclManagerID + '_formobj_id';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   746
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   747
  back = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   748
  back.type = 'button';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   749
  back.value = $lang.get('etc_wizard_back');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   750
  back.style.fontWeight = 'normal';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   751
  back.onclick = function() { ajaxACLSwitchToSelector(); return false; };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   752
  back.style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   753
  back.id = aclManagerID + '_back';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   754
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   755
  saver = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   756
  saver.type = 'submit';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   757
  saver.value = $lang.get('etc_wizard_next');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   758
  saver.style.fontWeight = 'bold';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   759
  saver.id = aclManagerID + '_next';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   760
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   761
  closer = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   762
  closer.type = 'button';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   763
  closer.value = $lang.get('etc_cancel_changes');
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   764
  closer.onclick = function()
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   765
  {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   766
    miniPromptMessage({
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   767
      title: $lang.get('acl_msg_closeacl_confirm_title'),
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   768
      message: $lang.get('acl_msg_closeacl_confirm_body'),
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   769
      buttons: [
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   770
        {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   771
          text: $lang.get('acl_btn_close'),
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   772
          color: 'red',
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   773
          style: {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   774
            fontWeight: 'bold'
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   775
          },
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   776
          onclick: function(e)
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   777
          {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   778
            killACLManager();
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   779
            miniPromptDestroy(this);
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   780
          }
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   781
        },
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   782
        {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   783
          text: $lang.get('etc_cancel'),
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   784
          onclick: function(e)
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   785
          {
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   786
            miniPromptDestroy(this);
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   787
          }
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   788
        }
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   789
      ]
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   790
    });
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   791
    return false;
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 535
diff changeset
   792
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   793
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   794
  spacer1 = document.createTextNode('  ');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   795
  spacer2 = document.createTextNode('  ');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   796
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   797
  panel.appendChild(back);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   798
  panel.appendChild(spacer1);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   799
  panel.appendChild(saver);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   800
  panel.appendChild(spacer2);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   801
  panel.appendChild(closer);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   802
  form.appendChild(mainwin);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   803
  form.appendChild(panel);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   804
  box.appendChild(form);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   805
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   806
  body = document.getElementsByTagName('body')[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   807
  body.appendChild(box);
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   808
  if ( aclDisableTransitionFX )
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   809
  {
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   810
    document.getElementById(aclManagerID).style.display = 'block';
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   811
    changeOpac(100, aclManagerID);
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   812
    changeOpac(100, aclManagerID + '_panel');
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   813
  }
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   814
  else
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   815
  {
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   816
    setTimeout("document.getElementById('"+aclManagerID+"').style.display = 'block'; opacity('"+aclManagerID+"', 0, 100, 250); opacity('"+aclManagerID + '_panel'+"', 0, 100, 250);", 500);
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   817
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   818
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   819
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   820
function killACLManager()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   821
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   822
  el = document.getElementById(aclManagerID);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   823
  if(el)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   824
  {
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   825
    if ( aclDisableTransitionFX )
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   826
    {
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   827
      enlighten(true, 'acldarkener');
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   828
      el.parentNode.removeChild(el);
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   829
    }
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   830
    else
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   831
    {
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   832
      opacity(aclManagerID, 100, 0, 500);
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   833
      setTimeout('var el = document.getElementById(aclManagerID); el.parentNode.removeChild(el); enlighten(false, "acldarkener");', 750);
151
824821224153 Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents: 76
diff changeset
   834
    }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   835
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   836
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   837
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   838
function __aclSubmitManager(form)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   839
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   840
  var thefrm = document.forms[form.name];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   841
  var modeobj = form_fetch_field(thefrm, 'mode');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   842
  if ( typeof(modeobj) == 'object' )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   843
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   844
    var mode = (thefrm.mode.value) ? thefrm.mode.value : 'cant_get';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   845
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   846
  else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   847
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   848
    var mode = '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   849
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   850
  switch(mode)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   851
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   852
    case 'cant_get':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   853
      alert('BUG: can\'t get the state value from the form field.');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   854
      break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   855
    case 'seltarget':
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   856
      var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2']));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   857
      if(isNaN(target_type))
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   858
      {
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   859
        alert($lang.get('acl_err_pleaseselect_targettype'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   860
        return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   861
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   862
      target_id = ( target_type == 1 ) ? parseInt(thefrm.group_id.value) : thefrm.username.value;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   863
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   864
      obj = { 'mode' : mode, 'target_type' : target_type, 'target_id' : target_id };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   865
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   866
      thispage = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   867
      do_scopesel = ( thispage[0] == aclDataCache.page_id && thispage[1] == aclDataCache.namespace );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   868
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   869
      if(do_scopesel)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   870
      {
535
b31eb2b6c137 Fixed selector stage in ACL editor under Safari
Dan
parents: 513
diff changeset
   871
        scope = getRadioState(thefrm, 'scope', ['page', 'group', 'global']);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   872
        if(scope == 'page')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   873
        {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   874
          pageid = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   875
          obj['page_id'] = pageid[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   876
          obj['namespace'] = pageid[1];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   877
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   878
        else if(scope == 'global')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   879
        {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   880
          obj['page_id'] = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   881
          obj['namespace'] = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   882
        }
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   883
        else if(scope == 'group')
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   884
        {
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   885
          obj['page_id'] = document.getElementById('enACL_pgsel_1048576').value;
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   886
          obj['namespace'] = '__PageGroup';
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 42
diff changeset
   887
        }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   888
        else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   889
        {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   890
          alert('Invalid scope');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   891
          return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   892
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   893
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   894
      else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   895
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   896
        obj['page_id'] = aclDataCache.page_id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   897
        obj['namespace'] = aclDataCache.namespace;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   898
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   899
      if(target_id == '')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   900
      {
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   901
        alert($lang.get('acl_err_pleaseselect_username'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   902
        return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   903
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   904
      __aclJSONSubmitAjaxHandler(obj);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   905
      break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   906
    case 'save_edit':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   907
    case 'save_new':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   908
      var form = document.forms[aclManagerID + '_formobj'];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   909
      selections = new Object();
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   910
      var dbg = '';
511
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   911
      var warned_everyone = false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   912
      for(var i in aclPermList)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   913
      {
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   914
        selections[aclPermList[i]] = getRadioState(form, aclPermList[i], ['i', 1, 2, 3, 4]);
511
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   915
        // If we're editing permissions for everyone on the entire site and the
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   916
        // admin selected to deny privileges, give a stern warning about it.
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   917
        if ( selections[aclPermList[i]] == 1 && aclDataCache.target_type == 1 /* ACL_TYPE_GROUP */ && aclDataCache.target_id == 1 && !warned_everyone )
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   918
        {
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   919
          warned_everyone = true;
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   920
          if ( !confirm($lang.get('acl_msg_deny_everyone_confirm')) )
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   921
          {
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   922
            return false;
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   923
          }
f88c8c79d784 Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents: 472
diff changeset
   924
        }
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   925
        dbg += aclPermList[i] + ': ' + selections[aclPermList[i]] + "\n";
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   926
        if(!selections[aclPermList[i]])
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   927
        {
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   928
          alert("Invalid return from getRadioState: "+i+": "+selections[i]+" ("+typeof(selections[i])+")");
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   929
          return false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   930
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   931
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   932
      obj = new Object();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   933
      obj['perms'] = selections;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   934
      obj['mode'] = mode;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   935
      obj['target_type'] = aclDataCache.target_type;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   936
      obj['target_id'] = aclDataCache.target_id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   937
      obj['target_name'] = aclDataCache.target_name;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   938
      obj['page_id'] = aclDataCache.page_id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   939
      obj['namespace'] = aclDataCache.namespace;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   940
      __aclJSONSubmitAjaxHandler(obj);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   941
      break;
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   942
    case 'trace':
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   943
      var params = {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   944
        mode: 'trace',
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   945
        user: document.getElementById(aclManagerID + 'trace_user').value,
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   946
        page: document.getElementById(aclManagerID + 'trace_page').value
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   947
      };
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   948
      __aclJSONSubmitAjaxHandler(params);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   949
      break;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   950
    default:
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   951
      alert("JSON form submit: invalid mode string "+mode+", stopping execution");
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   952
      return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   953
      break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   954
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   955
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   956
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   957
function getRadioState(form, name, valArray)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   958
{
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   959
  // Konqueror/Safari fix
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   960
  if ( form[name] )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   961
  {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   962
    var formitem = form[name];
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   963
    if ( String(formitem) == '[object DOMNamedNodesCollection]' || is_Safari )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   964
    {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   965
      var i = 0;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   966
      var radios = new Array();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   967
      var radioids = new Array();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   968
      while(true)
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   969
      {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   970
        var elem = formitem[i];
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   971
        if ( !elem )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   972
          break;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   973
        radios.push(elem);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   974
        if ( !elem.id )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   975
        {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   976
          elem.id = 'autoRadioBtn_' + Math.floor(Math.random() * 1000000);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   977
        }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   978
        radioids.push(elem.id);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   979
        i++;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   980
      }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   981
      var cr;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   982
      for ( var i = 0; i < radios.length; i++ )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   983
      {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   984
        cr = document.getElementById(radioids[i]);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   985
        if ( cr.value == 'on' || cr.checked == true )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   986
        {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   987
          try {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   988
            return ( typeof ( valArray[i] ) != 'undefined' ) ? valArray[i] : false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   989
          } catch(e) {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   990
            // alert('Didn\'t get value for index: ' + i);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   991
            return false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   992
          }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   993
        }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   994
      }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   995
      return false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   996
    }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   997
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   998
  inputs = form.getElementsByTagName('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   999
  radios = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1000
  for(var i in inputs)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1001
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1002
    if(inputs[i]) if(inputs[i].type == 'radio')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1003
      radios.push(inputs[i]);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1004
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1005
  for(var i in radios)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1006
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1007
    if(radios[i].checked && radios[i].name == name)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1008
      return radios[i].value;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1009
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1010
  return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1011
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1012
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1013
function __aclSetAllRadios(val, valArray)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1014
{
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1015
  val = String(val);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1016
  var form = document.forms[aclManagerID + '_formobj'];
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1017
  if (!form)
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1018
  {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1019
    return false;
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1020
  }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1021
  var inputs = form.getElementsByTagName('input');
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1022
  var radios = new Array();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1023
  var dbg = '';
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1024
  for(var i = 0; i < inputs.length; i++)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1025
  {
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1026
    dbg += String(inputs[i]) + "\n";
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1027
    if(inputs[i].type == 'radio')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1028
      radios.push(inputs[i]);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1029
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1030
  for(var i in radios)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1031
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1032
    if(radios[i].value == val)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1033
      radios[i].checked = true;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1034
    else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1035
      radios[i].checked = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1036
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1037
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1038
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1039
function __aclDeleteRule()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1040
{
42
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1041
  if(!aclDataCache) 
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1042
  {
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1043
    if ( window.console )
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1044
    {
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1045
      try{ console.error('ACL editor: can\'t load data cache on delete'); } catch(e) {};
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1046
    }
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1047
    return false;
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1048
  }
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1049
  if(aclDataCache.mode != 'seltarget' && aclDataCache.mode != 'save_new' && aclDataCache.mode != 'save_edit')
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1050
  {
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1051
    if ( window.console )
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1052
    {
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1053
      try{ console.error('ACL editor: wrong mode on aclDataCache: ' + aclDataCache.mode); } catch(e) {};
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1054
    }
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1055
    return false;
45ebe475ff75 I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents: 40
diff changeset
  1056
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1057
  parms = {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1058
    'target_type' : aclDataCache.target_type,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1059
    'target_id' : aclDataCache.target_id,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1060
    'target_name' : aclDataCache.target_name,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1061
    'page_id' : aclDataCache.page_id,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1062
    'namespace' : aclDataCache.namespace,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1063
    'mode' : 'delete'
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1064
  };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1065
  __aclJSONSubmitAjaxHandler(parms);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1066
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1067
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1068
function aclSetViewListExisting()
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1069
{
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1070
  if ( !document.getElementById(aclManagerID) )
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1071
  {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1072
    return false;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1073
  }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1074
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1075
  var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1076
  main.innerHTML = '';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1077
  main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1078
  main.style.backgroundRepeat = 'no-repeat';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1079
  main.style.backgroundPosition = 'center center';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1080
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1081
  var parms = {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1082
    'mode' : 'list_existing'
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1083
  };
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1084
  __aclJSONSubmitAjaxHandler(parms);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1085
}
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1086
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1087
function aclSetViewListExistingRespond(data)
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1088
{
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1089
  var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1090
  main.style.padding = '10px';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1091
  main.innerHTML = '';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1092
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1093
  var heading = document.createElement('h3');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1094
  heading.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_title')));
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1095
  main.appendChild(heading);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1096
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1097
  var p = document.createElement('p');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1098
  p.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_body')));
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1099
  main.appendChild(p);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1100
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1101
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1102
  main.innerHTML += data.key;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1103
  main.style.backgroundImage = 'none';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1104
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1105
  document.getElementById(aclManagerID + '_back').style.display = 'inline';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1106
  document.getElementById(aclManagerID + '_next').style.display = 'none';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1107
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1108
  for ( var i = 0; i < data.rules.length; i++ )
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1109
  {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1110
    var rule = data.rules[i];
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1111
    // build the rule, this is just more boring DOM crap.
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1112
    var div = document.createElement('div');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1113
    div.style.padding = '5px 3px';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1114
    div.style.backgroundColor = '#' + rule.color;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1115
    div.style.cursor = 'pointer';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1116
    div.rule_id = rule.rule_id;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1117
    div.onclick = function()
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1118
    {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1119
      var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1120
      main.innerHTML = '';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1121
      main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1122
      ajaxOpenDirectACLRule(parseInt(this.rule_id));
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1123
    }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1124
    div.innerHTML = rule.score_string;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1125
    main.appendChild(div);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1126
  }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1127
}
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1128
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1129
function aclSetViewDebugTools()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1130
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1131
  // selection window for viewing effective permissions
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1132
  var main = document.getElementById(aclManagerID + '_main');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1133
  main.innerHTML = '';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1134
 
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1135
  // set the submission handler to trace
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1136
  var thefrm = document.forms[form.name];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1137
  var modeobj = form_fetch_field(thefrm, 'mode');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1138
  modeobj.value = 'trace';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1139
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1140
  // show the back button
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1141
  document.getElementById(aclManagerID + '_back').style.display = 'inline';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1142
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1143
  //
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1144
  // start building
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1145
  //
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1146
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1147
  // selection interface
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1148
  var selector = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1149
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1150
    var table = document.createElement('table');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1151
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1152
    // username
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1153
    var tr_user = document.createElement('tr');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1154
    var td_user_l = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1155
    var lbl_user = document.createElement('label');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1156
    lbl_user.setAttribute('for', aclManagerID + 'trace_user');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1157
    lbl_user.appendChild(document.createTextNode($lang.get('acl_lbl_trace_user')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1158
    td_user_l.appendChild(lbl_user);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1159
    tr_user.appendChild(td_user_l);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1160
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1161
    var td_user_i = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1162
    var i_user = document.createElement('input');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1163
    i_user.type = 'text';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1164
    i_user.id = aclManagerID + 'trace_user';
763
a03406756fdd [Minor] Enabled anonymous user autocompletion in ACL tracer
Dan
parents: 749
diff changeset
  1165
    i_user.onkeyup = function() { new AutofillUsername(this, true); };
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1166
    i_user.size = '20';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1167
    td_user_i.appendChild(i_user);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1168
    tr_user.appendChild(td_user_i);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1169
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1170
    table.appendChild(tr_user);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1171
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1172
    // page
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1173
    var tr_page = document.createElement('tr');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1174
    var td_page_l = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1175
    var lbl_page = document.createElement('label');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1176
    lbl_page.setAttribute('for', aclManagerID + 'trace_page');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1177
    lbl_page.appendChild(document.createTextNode($lang.get('acl_lbl_trace_page')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1178
    td_page_l.appendChild(lbl_page);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1179
    tr_page.appendChild(td_page_l);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1180
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1181
    var td_page_i = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1182
    var i_page = document.createElement('input');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1183
    i_page.type = 'text';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1184
    i_page.id = aclManagerID + 'trace_page';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1185
    i_page.onkeyup = function() { new AutofillPage(this); };
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1186
    i_page.size = '20';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1187
    td_page_i.appendChild(i_page);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1188
    tr_page.appendChild(td_page_i);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1189
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1190
    table.appendChild(tr_page);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1191
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1192
    selector.appendChild(table);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1193
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1194
  // wrapper
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1195
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1196
  var container = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1197
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1198
    container.style.margin = 'auto';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1199
    container.style.width = '360px';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1200
    container.style.paddingTop = '90px';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1201
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1202
    var head = document.createElement('h2');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1203
    head.appendChild(document.createTextNode($lang.get('acl_lbl_trace_title')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1204
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1205
    var desc = document.createElement('p');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1206
    desc.innerHTML = $lang.get('acl_lbl_trace_body');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1207
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1208
    container.appendChild(head);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1209
    container.appendChild(desc);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1210
    container.appendChild(selector);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1211
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1212
  main.appendChild(container);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1213
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1214
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1215
function aclTraceKey()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1216
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1217
  var div = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1218
  $(div).addClass('tblholder');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1219
  var table = document.createElement('table');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1220
  $(table).attr('cellspacing', '1').attr('cellpadding', '4');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1221
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1222
  var inherit_list = ['enano_default', 'global_everyone', 'global_group', 'global_user', 'pg_everyone', 'pg_group', 'pg_user', 'local_everyone', 'local_group', 'local_user'];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1223
  for ( var i = 0; i < inherit_list.length; i++ )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1224
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1225
    var t = inherit_list[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1226
    var tr = document.createElement('tr');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1227
    var td_key = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1228
    $(td_key).addClass('acl_' + t).addClass('acl_inherit_key');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1229
    tr.appendChild(td_key);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1230
    var td_explain = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1231
    $(td_explain).addClass(i % 2 == 0 ? 'row1' : 'row2');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1232
    td_explain.appendChild(document.createTextNode($lang.get('acl_inherit_key_' + t)));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1233
    tr.appendChild(td_explain);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1234
    table.appendChild(tr);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1235
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1236
  div.appendChild(table);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1237
  return div;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1238
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1239
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1240
function aclTraceModalKey()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1241
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1242
  load_component('messagebox');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1243
  miniPrompt(function(parent)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1244
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1245
      // heading
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1246
      var h3 = document.createElement('h3');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1247
      h3.appendChild(document.createTextNode($lang.get('acl_msg_trace_key')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1248
      parent.appendChild(h3);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1249
      
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1250
      var key = aclTraceKey();
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1251
      parent.appendChild(key);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1252
      
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1253
      var p = document.createElement('p');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1254
      $(p).css('text-align', 'center');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1255
      
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1256
      var closer = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1257
      $(closer).addClass('abutton').addClass('abutton_red').css('font-weight', 'bold');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1258
      closer.appendChild(document.createTextNode($lang.get('etc_close')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1259
      closer.href = '#';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1260
      $(closer).click(function(e)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1261
        {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1262
          miniPromptDestroy(this);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1263
          return false;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1264
        });
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1265
      
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1266
      p.appendChild(closer);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1267
      parent.appendChild(p);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1268
    });
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1269
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1270
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1271
function aclDrawTraceWrapper(data)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1272
{
730
b09cb1dab505 [minor] fixed non-hidden next button in ACL trace view
Dan
parents: 729
diff changeset
  1273
  // hide the next button
b09cb1dab505 [minor] fixed non-hidden next button in ACL trace view
Dan
parents: 729
diff changeset
  1274
  document.getElementById(aclManagerID + '_next').style.display = 'none';
b09cb1dab505 [minor] fixed non-hidden next button in ACL trace view
Dan
parents: 729
diff changeset
  1275
  
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1276
  var trace_by_perm = aclDrawTraceByPerm(data);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1277
  var trace_by_rule = aclDrawTraceByRule(data);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1278
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1279
  trace_by_perm.id = 'aclDebugTraceViewPerm';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1280
  trace_by_rule.id = 'aclDebugTraceViewRule';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1281
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1282
  var start_with_rule = ( readCookie('acl_trace_view') == 'rule' );
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1283
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1284
  if ( start_with_rule )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1285
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1286
    trace_by_perm.style.display = 'none';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1287
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1288
  else
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1289
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1290
    trace_by_rule.style.display = 'none';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1291
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1292
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1293
  // selection window for viewing effective permissions
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1294
  var main = document.getElementById(aclManagerID + '_main');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1295
  main.innerHTML = '';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1296
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1297
  var wrapper = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1298
  $(wrapper).css('padding-bottom', '20px');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1299
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1300
  var floatlink = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1301
  $(floatlink).css('float', 'right').css('margin-left', '20px').css('margin-bottom', '20px').css('text-align', 'right');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1302
  var a_toggle = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1303
  $(a_toggle).attr('id', 'aclDebugTraceViewToggle');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1304
  a_toggle.innerHTML = '&raquo; ';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1305
  a_toggle.innerHTML += start_with_rule ? $lang.get('acl_btn_sort_perm') : $lang.get('acl_btn_sort_rule');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1306
  a_toggle.href = '#';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1307
  floatlink.appendChild(a_toggle);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1308
  floatlink.appendChild(document.createElement('br'));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1309
  var a_key = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1310
  $(a_key).css('font-size', 'smaller');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1311
  a_key.innerHTML = '&raquo; ';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1312
  a_key.innerHTML += $lang.get('acl_btn_view_key');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1313
  a_key.href = '#';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1314
  floatlink.appendChild(a_key);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1315
  wrapper.appendChild(floatlink);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1316
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1317
  var h3 = document.createElement('h3');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1318
  h3.appendChild(document.createTextNode($lang.get('acl_msg_debug_main_title')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1319
  wrapper.appendChild(h3);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1320
  var p = document.createElement('p');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1321
  p.appendChild(document.createTextNode($lang.get('acl_msg_debug_main_body')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1322
  wrapper.appendChild(p);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1323
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1324
  wrapper.appendChild(trace_by_perm);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1325
  wrapper.appendChild(trace_by_rule);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1326
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1327
  main.appendChild(wrapper);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1328
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1329
  $(a_toggle).click(function(e)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1330
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1331
      aclTraceToggleViews();
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1332
      return false;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1333
    });
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1334
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1335
  $(a_key).click(function(e)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1336
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1337
      aclTraceModalKey();
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1338
      return false;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1339
    });
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1340
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1341
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1342
function aclTraceToggleViews()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1343
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1344
  var trace_by_perm = document.getElementById('aclDebugTraceViewPerm');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1345
  var trace_by_rule = document.getElementById('aclDebugTraceViewRule');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1346
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1347
  var toggler = document.getElementById('aclDebugTraceViewToggle');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1348
  var newtext;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1349
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1350
  if ( trace_by_perm.style.display == 'none' )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1351
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1352
    newtext = $lang.get('acl_btn_sort_rule');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1353
    $(trace_by_rule).hide('blind', {}, 750, function()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1354
      {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1355
        $(trace_by_perm).show('blind', {}, 750);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1356
      });
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1357
    createCookie('acl_trace_view', 'perm');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1358
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1359
  else
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1360
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1361
    newtext = $lang.get('acl_btn_sort_perm');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1362
    $(trace_by_perm).hide('blind', {}, 750, function()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1363
      {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1364
        $(trace_by_rule).show('blind', {}, 750);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1365
      });
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1366
    createCookie('acl_trace_view', 'rule');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1367
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1368
  $(toggler).fadeOut(500, function()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1369
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1370
      this.innerHTML = '&raquo; ' + newtext;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1371
      $(this).fadeIn(500);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1372
    });
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1373
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1374
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1375
function aclDrawTraceByPerm(data)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1376
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1377
  var wrapper = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1378
  // wrapper.style.display = 'none';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1379
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1380
  // temporarily append wrapper to body to allow onclick to work
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1381
  // var body = document.getElementsByTagName('body')[0];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1382
  // body.appendChild(wrapper);  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1383
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1384
  for ( var i in data.perms )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1385
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1386
    var perm = data.perms[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1387
    var item = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1388
    item.className = perm.divclass;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1389
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1390
    // first row - permission name + current setting
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1391
    // use innerHTML here to allow for HTML in localized permission types
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1392
    item.innerHTML += '<b>' + perm.perm_name + ' - ' + perm.perm_value + '</b>';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1393
    item.appendChild(document.createElement('br'));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1394
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1395
    // second row - permission localized name + rule ID
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1396
    var sm = document.createElement('small');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1397
    sm.innerHTML = perm.perm_src;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1398
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1399
    item.appendChild(sm);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1400
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1401
    wrapper.appendChild(item);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1402
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1403
    // whole row is now in the document
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1404
    if ( perm.rule_id != -1 )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1405
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1406
      sm.innerHTML += ' [';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1407
      // rule is editable
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1408
      var editlink = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1409
      editlink.href = 'javascript:ajaxOpenDirectACLRule(' + perm.rule_id + ');';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1410
      editlink.appendChild(document.createTextNode($lang.get('acl_btn_edit_rule')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1411
      sm.appendChild(editlink);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1412
      sm.innerHTML += ']';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1413
    }
749
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1414
    
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1415
    if ( perm.bad_deps.length > 0 )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1416
    {
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1417
      var bd = document.createElement('span');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1418
      $(bd).addClass('acl_failed_deps');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1419
      var failed_deps = '';
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1420
      for ( var i = 0; i < perm.bad_deps.length; i++ )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1421
      {
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1422
        if ( i > 0 )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1423
          failed_deps += ', ';
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1424
        failed_deps += data.perms[perm.bad_deps[i]].perm_name;
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1425
      }
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1426
      var title = document.createElement('span');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1427
      $(title).addClass('title');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1428
      title.appendChild(document.createTextNode($lang.get('acl_msg_failed_deps')));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1429
      bd.appendChild(title);
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1430
      bd.appendChild(document.createTextNode(failed_deps));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1431
      
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1432
      item.appendChild(document.createElement('br'));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1433
      item.appendChild(bd);
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1434
    }
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1435
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1436
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1437
  // var ret = wrapper.cloneNode(true);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1438
  // body.removeChild(wrapper);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1439
  // wrapper = false;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1440
  // ret.style.display = 'block';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1441
  // console.debug(ret);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1442
  // return ret;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1443
  return wrapper;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1444
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1445
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1446
function aclDrawTraceByRule(data)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1447
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1448
  var wrapper = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1449
  var groupdata = {};
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1450
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1451
  for ( var i in data.perms )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1452
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1453
    var perm = data.perms[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1454
    if ( !groupdata[perm['rule_id']] )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1455
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1456
      groupdata[perm['rule_id']] = {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1457
        meta: {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1458
          divclass: perm.divclass,
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1459
          perm_src: perm.perm_src,
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1460
          rule_id: perm.rule_id
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1461
        },
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1462
        rules: {}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1463
      };
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1464
    }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1465
    groupdata[perm['rule_id']]['rules'][i] = perm;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1466
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1467
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1468
  for ( var i in groupdata )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1469
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1470
    var group = groupdata[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1471
    var grp = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1472
    var head = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1473
    head.className = group.meta.divclass;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1474
    var span = document.createElement('span');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1475
    span.style.fontSize = 'larger';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1476
    span.appendChild(document.createTextNode(group.meta.perm_src));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1477
    head.appendChild(span);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1478
    if ( group.meta.rule_id != -1 )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1479
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1480
      head.innerHTML += ' [';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1481
      // rule is editable
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1482
      var editlink = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1483
      editlink.href = 'javascript:ajaxOpenDirectACLRule(' + group.meta.rule_id + ');';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1484
      editlink.appendChild(document.createTextNode($lang.get('acl_btn_edit_rule')));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1485
      head.appendChild(editlink);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1486
      head.innerHTML += ']';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1487
    }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1488
    grp.appendChild(head);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1489
    for ( var i in group.rules )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1490
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1491
      var rule = group.rules[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1492
      var rulediv = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1493
      rulediv.style.padding = '3px 12px';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1494
      rulediv.innerHTML += rule.perm_name + ': ';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1495
      var b = document.createElement('strong');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1496
      b.appendChild(document.createTextNode(rule.perm_value));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1497
      rulediv.appendChild(b);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1498
      grp.appendChild(rulediv);
749
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1499
      
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1500
      if ( rule.bad_deps.length > 0 )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1501
      {
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1502
        var bd = document.createElement('span');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1503
        $(bd).addClass('acl_failed_deps');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1504
        var failed_deps = '';
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1505
        for ( var i = 0; i < rule.bad_deps.length; i++ )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1506
        {
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1507
          if ( i > 0 )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1508
            failed_deps += ', ';
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1509
          failed_deps += data.perms[rule.bad_deps[i]].perm_name;
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1510
        }
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1511
        var title = document.createElement('span');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1512
        $(title).addClass('title');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1513
        title.appendChild(document.createTextNode($lang.get('acl_msg_failed_deps')));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1514
        bd.appendChild(title);
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1515
        bd.appendChild(document.createTextNode(failed_deps));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1516
        
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1517
        rulediv.appendChild(document.createElement('br'));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1518
        rulediv.appendChild(bd);
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1519
      }
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1520
    }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1521
    wrapper.appendChild(grp);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1522
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1523
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1524
  return wrapper;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1525
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1526
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1527
function aclShowPresetLoader()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1528
{
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1529
  var prompt = miniPrompt(function(parent)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1530
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1531
      parent.innerHTML = '<img style="display: block; margin: 0 auto;" src="' + cdnPath + '/images/loading-big.gif" />';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1532
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1533
  var request = toJSONString({
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1534
      mode: 'list_presets'
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1535
    });
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 787
diff changeset
  1536
  ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(request), function(ajax)
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1537
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1538
      if ( ajax.readyState == 4 && ajax.status == 200 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1539
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1540
        if ( !check_json_response(ajax.responseText) )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1541
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1542
          miniPromptDestroy(prompt);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1543
          return handle_invalid_json(ajax.responseText);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1544
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1545
        var response = parseJSON(ajax.responseText);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1546
        if ( response.mode == 'error' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1547
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1548
          alert(response.error);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1549
          miniPromptDestroy(prompt);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1550
          return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1551
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1552
        prompt = prompt.firstChild.nextSibling;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1553
        prompt.style.textAlign = 'center';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1554
        prompt.innerHTML = '<h3>' + $lang.get('acl_lbl_preset_load_title') + '</h3>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1555
        
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1556
        if ( response.presets.length > 0 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1557
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1558
          // selection box
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1559
          var para = document.createElement('p');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1560
          var select = document.createElement('select');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1561
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1562
          var option = document.createElement('option');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1563
          option.value = '0';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1564
          option.appendChild(document.createTextNode($lang.get('acl_lbl_preset_load')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1565
          select.appendChild(option);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1566
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1567
          for ( var i = 0; i < response.presets.length; i++ )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1568
          {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1569
            var preset = response.presets[i];
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1570
            var option = document.createElement('option');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1571
            option.value = preset.rule_id;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1572
            option.preset_data = preset;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1573
            option.appendChild(document.createTextNode($lang.get(preset.preset_name)));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1574
            select.appendChild(option);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1575
          }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1576
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1577
          para.appendChild(select);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1578
          prompt.appendChild(para);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1579
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1580
          // buttons
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1581
          var buttons = document.createElement('p');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1582
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1583
          // load button
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1584
          var btn_load = document.createElement('a');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1585
          btn_load.className = 'abutton abutton_green';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1586
          btn_load.style.fontWeight = 'bold';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1587
          btn_load.appendChild(document.createTextNode($lang.get('acl_btn_load_preset')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1588
          btn_load.selectobj = select;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1589
          btn_load.onclick = function()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1590
          {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1591
            if ( this.selectobj.value == '0' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1592
            {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1593
              alert($lang.get('acl_err_select_preset'));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1594
              return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1595
            }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1596
            // retrieve preset data
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1597
            for ( var i = 0; i < this.selectobj.childNodes.length; i++ )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1598
            {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1599
              if ( this.selectobj.childNodes[i].tagName == 'OPTION' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1600
              {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1601
                var node = this.selectobj.childNodes[i];
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1602
                if ( node.value == this.selectobj.value )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1603
                {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1604
                  aclSetRulesAbsolute(node.preset_data.rules);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1605
                  break;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1606
                }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1607
              }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1608
            }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1609
            miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1610
            return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1611
          }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1612
          btn_load.href = '#';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1613
          buttons.appendChild(btn_load);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1614
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1615
          buttons.appendChild(document.createTextNode(' '));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1616
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1617
          // cancel button
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1618
          var btn_cancel = document.createElement('a');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1619
          btn_cancel.className = 'abutton';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1620
          btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1621
          btn_cancel.onclick = function()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1622
          {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1623
            miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1624
            return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1625
          }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1626
          btn_cancel.href = '#';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1627
          buttons.appendChild(btn_cancel);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1628
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1629
          prompt.appendChild(buttons);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1630
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1631
        else
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1632
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1633
          // "no presets"
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1634
          prompt.innerHTML += '<p>' + $lang.get('acl_msg_no_presets', { close_flags: 'href="#" onclick="miniPromptDestroy(this); return false;"' }) + '</p>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1635
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1636
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1637
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1638
}
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1639
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1640
function aclSetRulesAbsolute(rules)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1641
{
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1642
  __aclSetAllRadios('i');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1643
  
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1644
  var form = document.forms[aclManagerID + '_formobj'];
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1645
  if (!form)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1646
  {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1647
    return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1648
  }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1649
  var inputs = form.getElementsByTagName('input');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1650
  var radios = new Array();
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1651
  var dbg = '';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1652
  for(var i = 0; i < inputs.length; i++)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1653
  {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1654
    if(inputs[i].type == 'radio')
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1655
      radios.push(inputs[i]);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1656
  }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1657
  for(var i in radios)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1658
  {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1659
    if ( typeof(rules[ radios[i]['name'] ]) == 'number' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1660
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1661
      radios[i].checked = ( rules[radios[i]['name']] == radios[i].value );
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1662
    }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1663
  }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1664
}
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1665
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1666
function aclShowPresetSave()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1667
{
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1668
  miniPrompt(function(parent)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1669
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1670
      parent.style.textAlign = 'center';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1671
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1672
      parent.innerHTML = '<h3>' + $lang.get('acl_lbl_preset_save_title') + '</h3>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1673
      var input = document.createElement('input');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1674
      input.id = aclManagerID + '_preset_save';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1675
      input.type = 'text';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1676
      input.size = '30';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1677
      input.onkeypress = function(e)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1678
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1679
        // javascript sucks. IE and several others throw myriad errors unless it's done this way.
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1680
        if ( e )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1681
        if ( e.keyCode )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1682
        if ( e.keyCode == 13 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1683
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1684
          if ( aclSavePreset() )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1685
          {
694
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1686
            if ( window.opera )
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1687
            {
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1688
              // damn weird opera bug.
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1689
              var input = this;
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1690
              setTimeout(function()
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1691
                {
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1692
                  miniPromptDestroy(input);
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1693
                }, 10);
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1694
            }
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1695
            else
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1696
            {
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1697
              miniPromptDestroy(this);
43367c66d869 Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents: 679
diff changeset
  1698
            }
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1699
          }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1700
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1701
        else if ( e.keyCode == 27 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1702
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1703
          miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1704
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1705
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1706
      var para = document.createElement('p');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1707
      para.appendChild(input);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1708
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1709
      parent.appendChild(para);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1710
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1711
      // buttons
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1712
      var buttons = document.createElement('p');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1713
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1714
      // save button
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1715
      var btn_save = document.createElement('a');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1716
      btn_save.className = 'abutton abutton_green';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1717
      btn_save.style.fontWeight = 'bold';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1718
      btn_save.appendChild(document.createTextNode($lang.get('acl_btn_save_preset')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1719
      btn_save.selectobj = select;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1720
      btn_save.onclick = function()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1721
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1722
        if ( aclSavePreset() )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1723
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1724
          miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1725
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1726
        return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1727
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1728
      btn_save.href = '#';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1729
      buttons.appendChild(btn_save);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1730
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1731
      buttons.appendChild(document.createTextNode(' '));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1732
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1733
      // cancel button
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1734
      var btn_cancel = document.createElement('a');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1735
      btn_cancel.className = 'abutton';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1736
      btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1737
      btn_cancel.onclick = function()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1738
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1739
        miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1740
        return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1741
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1742
      btn_cancel.href = '#';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1743
      buttons.appendChild(btn_cancel);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1744
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1745
      parent.appendChild(buttons);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1746
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1747
      var timeout = ( aclDisableTransitionFX ) ? 10 : 1000;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1748
      setTimeout(function()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1749
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1750
          input.focus();
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1751
        }, timeout);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1752
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1753
}
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1754
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1755
function aclSavePreset()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1756
{
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1757
  var input = document.getElementById(aclManagerID + '_preset_save');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1758
  if ( trim(input.value) == '' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1759
  {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1760
    alert($lang.get('acl_err_preset_name_empty'));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1761
    return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1762
  }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1763
  var form = document.forms[aclManagerID + '_formobj'], selections = {};
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1764
  var dbg = '';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1765
  var warned_everyone = false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1766
  for(var i in aclPermList)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1767
  {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1768
    selections[aclPermList[i]] = getRadioState(form, aclPermList[i], ['i', 1, 2, 3, 4]);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1769
    // If we're editing permissions for everyone on the entire site and the
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1770
    // admin selected to deny privileges, give a stern warning about it.
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1771
    if ( selections[aclPermList[i]] == 1 && aclDataCache.target_type == 1 /* ACL_TYPE_GROUP */ && aclDataCache.target_id == 1 && !warned_everyone )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1772
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1773
      warned_everyone = true;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1774
      if ( !confirm($lang.get('acl_msg_deny_everyone_confirm')) )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1775
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1776
        return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1777
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1778
    }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1779
    dbg += aclPermList[i] + ': ' + selections[aclPermList[i]] + "\n";
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1780
    if(!selections[aclPermList[i]])
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1781
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1782
      alert("Invalid return from getRadioState: "+i+": "+selections[i]+" ("+typeof(selections[i])+")");
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1783
      return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1784
    }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1785
  }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1786
  
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1787
  var packet = toJSONString({
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1788
      mode: 'save_preset',
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1789
      preset_name: input.value,
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1790
      perms: selections
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1791
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1792
  
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1793
  var whitey = whiteOutElement(document.getElementById(aclManagerID));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1794
  
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 787
diff changeset
  1795
  ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(packet), function(ajax)
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1796
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1797
      if ( ajax.readyState == 4 && ajax.status == 200 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1798
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1799
        if ( !check_json_response(ajax.responseText) )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1800
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1801
          whitey.parentNode.removeChild(whitey);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1802
          return handle_invalid_json(ajax.responseText);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1803
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1804
        var response = parseJSON(ajax.responseText);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1805
        if ( response.mode == 'error' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1806
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1807
          whitey.parentNode.removeChild(whitey);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1808
          alert(response.error);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1809
          return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1810
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1811
        whiteOutReportSuccess(whitey);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1812
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1813
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1814
  
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1815
  return true;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1816
}
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1817
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1818
function array_keys(obj)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1819
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1820
  keys = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1821
  for(var i in obj)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1822
    keys.push(i);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1823
  return keys;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1824
}