includes/clientside/static/acl.js
author Dan
Fri, 21 Aug 2009 13:50:45 -0400
changeset 1091 bb8e04f74819
parent 1058 c4b057708436
child 1227 bdac73ed481e
permissions -rw-r--r--
JS: MessageBox: Fixed z-index calc
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
{
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
     9
  // touch these to make them available to child functions
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
    10
  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
    11
  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
    12
  
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
  // 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
    14
  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
    15
  {
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
    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
    17
    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
    18
      {
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
        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
    20
      }, 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
    21
    
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
    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
    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
  
787
b0d0d429d8cf Fixed: autocomplete got broken somehow
Dan
parents: 779
diff changeset
    25
  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
    26
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    27
  if(!page_id || !namespace)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    28
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    29
    var data = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    30
    var page_id = data[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    31
    var namespace = data[1];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    32
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    33
  var params = {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    34
      'mode' : 'listgroups',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    35
      'page_id' : page_id,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    36
      'namespace' : namespace
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    37
    };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    38
  params = toJSONString(params);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    39
  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
    40
  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
    41
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    42
      {
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    43
        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
    44
        if ( !check_json_response(response) )
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    45
        {
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    46
          handle_invalid_json(ajax.responseText);
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    47
          return false;
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    48
        }
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    49
        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
    50
          var groups = parseJSON(ajax.responseText);
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    51
        } catch(e) {
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    52
          handle_invalid_json(ajax.responseText);
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
    53
        }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    54
        __aclBuildWizardWindow();
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    55
        if ( groups.mode == 'error' )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    56
        {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    57
          alert(groups.error);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    58
          killACLManager();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    59
          return false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
    60
        }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    61
        aclDataCache = groups;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    62
        __aclBuildSelector(groups);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    63
      }
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
    64
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    65
  return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    66
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    67
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
    68
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
    69
{
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
    70
  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
    71
  
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
    72
  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
    73
    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
    74
    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
    75
  };
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
  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
    77
  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
    78
      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
    79
      {
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
        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
    81
        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
    82
        {
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
    83
          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
    84
          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
    85
        }
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
        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
    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
          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
    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
        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
    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
          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
    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
        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
    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
          __aclBuildWizardWindow();
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
    97
          var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
    98
          main.style.padding = '10px';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
    99
        }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   100
        else
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
          var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   103
          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
   104
        }
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
   105
        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
   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
          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
   108
          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
   109
          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
   110
        }
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
        aclDataCache = response;
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   112
        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
   113
      }
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
   114
    }, 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
   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
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   117
function ajaxACLSwitchToSelector()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   118
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   119
  params = {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   120
      'mode' : 'listgroups'
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   121
    };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   122
  if ( aclDataCache.page_id && aclDataCache.namespace )
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
    params.page_id   = aclDataCache.page_id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   125
    params.namespace = aclDataCache.namespace;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   126
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   127
  params = toJSONString(params);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   128
  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
   129
  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
   130
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   131
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   132
        document.getElementById(aclManagerID+'_main').innerHTML = '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   133
        document.getElementById(aclManagerID + '_back').style.display = 'none';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   134
        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
   135
        var groups = parseJSON(ajax.responseText);
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   136
        if ( groups.mode == 'error' )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   137
        {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   138
          alert(groups.error);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   139
          killACLManager();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   140
          return false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   141
        }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   142
        aclDataCache = groups;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   143
        thispage = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   144
        groups.page_id = thispage[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   145
        groups.namespace = thispage[1];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   146
        __aclBuildSelector(groups);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   147
      }
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
   148
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   149
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   150
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   151
function __aclBuildSelector(groups)
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
  thispage = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   154
  do_scopesel = ( thispage[0] == groups.page_id && thispage[1] == groups.namespace );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   155
  
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   156
  document.getElementById(aclManagerID + '_next').style.display = 'inline';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   157
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   158
  seed = Math.floor(Math.random() * 1000000);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   159
        
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   160
  main = document.getElementById(aclManagerID + '_main');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   161
  main.style.padding = '10px';
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   162
  main.style.backgroundImage = 'none';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   163
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   164
  // the "edit existing" button
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   165
  var editbtn_wrapper = document.createElement('div');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   166
  editbtn_wrapper.style.styleFloat = 'right';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   167
  editbtn_wrapper.style.cssFloat = 'right';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   168
  editbtn_wrapper.style.fontSize = 'smaller';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   169
  var editbtn = document.createElement('a');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   170
  editbtn.href = '#';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   171
  editbtn.innerHTML = $lang.get('acl_btn_show_existing');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   172
  editbtn_wrapper.appendChild(editbtn);
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   173
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   174
  // tracer button
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   175
  var tracebtn = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   176
  tracebtn.href = '#';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   177
  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
   178
  editbtn_wrapper.appendChild(document.createElement('br'));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   179
  editbtn_wrapper.appendChild(tracebtn);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   180
  
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   181
  main.appendChild(editbtn_wrapper);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   182
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   183
  editbtn.onclick = function()
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
    aclSetViewListExisting();
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   186
    return false;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   187
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   188
  
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   189
  tracebtn.onclick = function()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   190
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   191
    aclSetViewDebugTools();
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   192
    return false;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   193
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   194
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   195
  selector = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   196
  
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   197
  var grpsel = __aclBuildGroupsHTML(groups);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   198
  grpsel.name = 'group_id';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   199
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   200
  span = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   201
  span.id = "enACL_grpbox_"+seed+"";
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   202
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   203
  // Build the selector
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   204
  grpb = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   205
  grpb.type = 'radio';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   206
  grpb.name  = 'target_type';
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   207
  grpb.value = '1'; // ACL_TYPE_GROUP
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   208
  grpb.checked = 'checked';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   209
  grpb.className = seed;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   210
  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
   211
  lbl = document.createElement('label');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   212
  lbl.appendChild(grpb);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   213
  lbl.appendChild(document.createTextNode($lang.get('acl_radio_usergroup')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   214
  lbl.style.display = 'block';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   215
  span.appendChild(grpsel);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   216
  
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
   217
  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
   218
  anoninfo.className = 'info-box-mini';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   219
  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
   220
  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
   221
  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
   222
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   223
  usrb = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   224
  usrb.type = 'radio';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   225
  usrb.name  = 'target_type';
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   226
  usrb.value = '2'; // ACL_TYPE_USER
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   227
  usrb.className = seed;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   228
  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
   229
  lbl2 = document.createElement('label');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   230
  lbl2.appendChild(usrb);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   231
  lbl2.appendChild(document.createTextNode($lang.get('acl_radio_user')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   232
  lbl2.style.display = 'block';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   233
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   234
  usrsel = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   235
  usrsel.type = 'text';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   236
  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
   237
  usrsel.className = 'autofill username';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   238
  usrsel.id = 'userfield_' + aclManagerID;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   239
  try {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   240
    usrsel.setAttribute("autocomplete","off");
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   241
  } catch(e) {};
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   242
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   243
  span2 = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   244
  span2.id = "enACL_usrbox_"+seed+"";
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   245
  span2.style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   246
  span2.appendChild(usrsel);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   247
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   248
  // Scope selector
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   249
  if(do_scopesel)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   250
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   251
    scopediv1 = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   252
    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
   253
    scopediv3 = document.createElement('div');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   254
    scopeRadioPage = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   255
      scopeRadioPage.type = 'radio';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   256
      scopeRadioPage.name = 'scope';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   257
      scopeRadioPage.value = 'page';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   258
      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
   259
      scopeRadioPage.className = '1048576';
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   260
      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
   261
    scopeRadioGlobal = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   262
      scopeRadioGlobal.type = 'radio';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   263
      scopeRadioGlobal.name = 'scope';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   264
      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
   265
      scopeRadioGlobal.className = '1048576';
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   266
      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
   267
    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
   268
      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
   269
      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
   270
      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
   271
      scopeRadioGroup.className = '1048576';
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   272
      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
   273
    lblPage = document.createElement('label');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   274
      lblPage.style.display = 'block';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   275
      lblPage.appendChild(scopeRadioPage);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   276
      lblPage.appendChild(document.createTextNode($lang.get('acl_radio_scope_thispage')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   277
    lblGlobal = document.createElement('label');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   278
      lblGlobal.style.display = 'block';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   279
      lblGlobal.appendChild(scopeRadioGlobal);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   280
      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
   281
    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
   282
      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
   283
      lblGroup.appendChild(scopeRadioGroup);
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   284
      lblGroup.appendChild(document.createTextNode($lang.get('acl_radio_scope_pagegroup')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   285
    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
   286
    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
   287
    scopediv3.appendChild(lblGlobal);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   288
    
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   289
    scopedesc = document.createElement('p');
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   290
    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
   291
    
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
   292
    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
   293
    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
   294
    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
   295
    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
   296
    
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
    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
   298
    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
   299
    {
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
      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
   301
      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
   302
      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
   303
      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
   304
    }
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
    
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
    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
   307
    
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   308
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   309
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   310
  // Styles
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   311
  span.style.marginLeft = '13px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   312
  span.style.padding = '5px 0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   313
  span2.style.marginLeft = '13px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   314
  span2.style.padding = '5px 0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   315
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   316
  selector.appendChild(lbl);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   317
  selector.appendChild(span);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   318
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   319
  selector.appendChild(lbl2);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   320
  selector.appendChild(span2);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   321
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   322
  container = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   323
  container.style.margin = 'auto';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   324
  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
   325
  container.style.paddingTop = '50px';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   326
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   327
  head = document.createElement('h2');
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   328
  head.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_title')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   329
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   330
  desc = document.createElement('p');
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   331
  desc.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_body')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   332
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   333
  container.appendChild(head);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   334
  container.appendChild(desc);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   335
  container.appendChild(selector);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   336
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   337
  if(do_scopesel)
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
    container.appendChild(scopedesc);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   340
    container.appendChild(scopediv1);
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   341
    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
   342
    {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   343
      container.appendChild(scopediv2);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 74
diff changeset
   344
    }
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
   345
    container.appendChild(scopediv3);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   346
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   347
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   348
  main.appendChild(container);
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
  var mode = document.createElement('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   351
  mode.name = 'mode';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   352
  mode.type = 'hidden';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   353
  mode.id = aclManagerID + '_mode';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   354
  mode.value = 'seltarget';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   355
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   356
  var theform = document.getElementById(aclManagerID + '_formobj_id');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   357
  if ( !theform.mode )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   358
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   359
    theform.appendChild(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
  else
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
    theform.removeChild(theform.mode);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   364
    theform.appendChild(mode);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   365
  }
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
   366
  
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
   367
  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
   368
      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
   369
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   370
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   371
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   372
var aclDebugWin = false;
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
function aclDebug(text)
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
  if(!aclDebugWin)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   377
    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
   378
    setTimeout(function() {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   379
  aclDebugWin.pre = aclDebugWin.document.createElement('pre');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   380
  aclDebugWin.pre.appendChild(aclDebugWin.document.createTextNode(text));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   381
  aclDebugWin.b = aclDebugWin.document.getElementsByTagName('body')[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   382
    aclDebugWin.b.appendChild(aclDebugWin.pre);}, 1000);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   383
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   384
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   385
var pseudoWindows = new Object();
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
function pseudoWindowOpen(url, id)
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
  if(pseudoWindows[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
    document.getElementById('pseudowin_ifr_'+id).src = url;
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
  else
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
    win = document.createElement('iframe');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   396
    win.style.position='fixed';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   397
    win.style.width = '640px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   398
    win.style.height = '480px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   399
    win.style.top = '0px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   400
    win.style.left = '0px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   401
    win.style.zIndex = getHighestZ() + 1;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   402
    win.style.backgroundColor = '#FFFFFF';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   403
    win.name = 'pseudo_ifr_'+id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   404
    win.id = 'pseudowindow_ifr_'+id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   405
    win.src = url;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   406
    body = document.getElementsByTagName('body')[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   407
    body.appendChild(win);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   408
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   409
  win_obj = eval("( pseudo_ifr_"+id+" )");
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   410
  return win_obj;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   411
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   412
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   413
function __aclJSONSubmitAjaxHandler(params)
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
  params = toJSONString(params);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   416
  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
   417
  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
   418
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   419
      {
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   420
        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
   421
        if ( !check_json_response(response) )
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   422
        {
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   423
          handle_invalid_json(ajax.responseText);
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   424
          return false;
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   425
        }
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   426
        try
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   427
        {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   428
          var data = parseJSON(ajax.responseText);
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
        catch(e)
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   431
        {
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   432
          handle_invalid_json(ajax.responseText);
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   433
          return false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   434
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   435
        aclDataCache = data;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   436
        switch(data.mode)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   437
        {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   438
          case 'seltarget':
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
            // 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
   441
            aclBuildRuleEditor(data);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   442
            
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   443
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   444
          case 'success':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   445
            var note = document.createElement('div');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   446
            note.className = 'info-box';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   447
            note.style.marginLeft = '0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   448
            var b = document.createElement('b');
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   449
            b.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_title')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   450
            note.appendChild(b);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   451
            note.appendChild(document.createElement('br'));
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   452
            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
   453
            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
   454
            
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
   455
            /*
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   456
            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
   457
            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
   458
            a.id = aclManagerID + '_btn_dismiss';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   459
            a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   460
            note.appendChild(a);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   461
            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
   462
            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
   463
            a.id = aclManagerID + '_btn_close';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   464
            a2.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   465
            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
   466
            */
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
   467
            
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
            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
   469
            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
   470
            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
   471
            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
   472
            
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
   473
            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
   474
            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
   475
            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
   476
            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
   477
            
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
            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
   479
            
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
   480
            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
   481
            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
   482
            
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
   483
            if ( !document.getElementById(aclManagerID+'_deletelnk') )
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   484
            {
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   485
              var p = document.createElement('p');
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   486
              p.innerHTML = '<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>';
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   487
              p.id = aclManagerID + '_deletelnk';
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   488
              p.style.textAlign = 'right';
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   489
              
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   490
              document.getElementById(aclManagerID + '_main').appendChild(p);
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   491
            }
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
   492
            
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
   493
            document.getElementById(aclManagerID+'_main').scrollTop = 0;
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   494
            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
   495
                        
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
   496
            aclDataCache.mode = 'save_edit';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   497
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   498
          case 'delete':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   499
            
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   500
            params = {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   501
              'mode' : 'listgroups'
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
          params = toJSONString(params);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   504
          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
   505
          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
   506
              if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   507
              {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   508
                document.getElementById(aclManagerID+'_main').innerHTML = '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   509
                document.getElementById(aclManagerID + '_back').style.display = 'none';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   510
                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
   511
                ajaxACLSwitchToSelector();
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   512
                
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   513
                // note
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   514
                var note = document.createElement('div');
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   515
                note.className = 'info-box-mini';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   516
                note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success')));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   517
                
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   518
                // button: dismiss note
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   519
                var a_dismiss = document.createElement('a');
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   520
                a_dismiss.href = '#';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   521
                a_dismiss.onclick = function()
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   522
                {
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   523
                  var p = this.parentNode;
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   524
                  domOpacity(p, 100, 0, 500);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   525
                  window.setTimeout(function()
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   526
                    {
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   527
                      p.parentNode.removeChild(p);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   528
                    }, 600);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   529
                  return false;
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
                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
   532
                note.appendChild(a_dismiss);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   533
                // add a space
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   534
                note.appendChild(document.createTextNode(' / '));
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
                // button: dismiss note
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   537
                var a_close = document.createElement('a');
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   538
                a_close.href = '#';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   539
                a_close.onclick = function()
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   540
                {
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   541
                  killACLManager();
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   542
                  return false;
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   543
                }
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   544
                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
   545
                note.appendChild(a_close);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   546
                
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   547
                // style note
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   548
                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
   549
                note.style.position = 'absolute';
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   550
                // 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
   551
                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
   552
                
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   553
                // 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
   554
                var panel = document.getElementById(aclManagerID + '_panel');
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   555
                panel.parentNode.parentNode.appendChild(note);
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   556
                note.style.top = '401px';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   557
                note.style.left = '0px';
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   558
                
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   559
                opacity(note, 0, 100, 500);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   560
              }
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
   561
            }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   562
            
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   563
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   564
          case 'error':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   565
            alert("Server side processing error:\n"+data.error);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   566
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   567
          case 'debug':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   568
            aclDebug(data.text);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   569
            break;
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   570
          case 'list_existing':
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   571
            aclSetViewListExistingRespond(data);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   572
            break;
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   573
          case 'trace':
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   574
            aclDrawTraceWrapper(data);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   575
            break;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   576
          default:
327
c2f4c900c507 The merge of acl.js failed so re-merged manually
Dan
parents: 326
diff changeset
   577
            handle_invalid_json(ajax.responseText);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   578
            break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   579
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   580
      }
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
   581
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   582
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   583
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   584
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
   585
{
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
   586
  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
   587
  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
   588
  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
   589
  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
   590
  
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   591
  document.getElementById(aclManagerID + '_next').style.display = 'inline';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   592
  
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
   593
  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
   594
  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
   595
  
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   596
  // preset management
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   597
  var load_flags = 'href="#" onclick="aclShowPresetLoader(); return false;"';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   598
  var save_flags = 'href="#" onclick="aclShowPresetSave(); return false;"';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   599
  html += '<div style="float: right;">';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   600
  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
   601
  html += '</div>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   602
  html += '<div style="clear: both;"></div>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   603
  
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
   604
  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
   605
  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
   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 = '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
   608
  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
   609
  {
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(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
   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
      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
   613
      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
   614
      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
   615
      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
   616
      {
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
        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
   618
      }
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
      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
   620
      {
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_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
   622
      }
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_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
   624
      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
   625
      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
   626
      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
   627
      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
   628
      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
   629
      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
   630
      {
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
        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
   632
      }
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
      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
   634
      {
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
        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
   636
        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
   637
          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
   638
          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
   639
        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
   640
          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
   641
          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
   642
        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
   643
          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
   644
          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
   645
        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
   646
          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
   647
          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
   648
        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
   649
          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
   650
          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
   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
      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
   653
      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
   654
      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
   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
  }
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
  
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
  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
   659
  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
   660
  
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
  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
   662
    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
   663
  
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
   664
  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
   665
  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
   666
  
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
   667
  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
   668
  
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   669
  if ( from_direct )
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 = document.getElementById(aclManagerID + '_mode');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   672
    modeobj.value = 'save_edit';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   673
  }
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
   674
  else
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   675
  {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   676
    var modeobj = form_fetch_field(form, 'mode');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   677
    if ( modeobj )
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   678
      modeobj.value = 'save_' + data.type;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   679
    else
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   680
      alert('modeobj is invalid: '+modeobj);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
   681
  }
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
   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
  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
   684
  
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
   685
  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
   686
  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
   687
}
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
   688
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   689
function __aclBuildGroupsHTML(groups)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   690
{
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   691
  var groups = groups.groups;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   692
  select = document.createElement('select');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   693
  for(var i in groups)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   694
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   695
    if(typeof(groups[i]['name']) == 'string' && i != 'toJSONString')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   696
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   697
      o = document.createElement('option');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   698
      o.value = groups[i]['id'];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   699
      t = document.createTextNode(groups[i]['name']);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   700
      o.appendChild(t);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   701
      select.appendChild(o);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   702
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   703
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   704
  return select;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   705
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   706
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   707
function __aclBuildWizardWindow()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   708
{
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   709
  darken(aclDisableTransitionFX, 70, 'acldarkener');
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   710
  var box = document.createElement('div');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   711
  box.style.width = '640px'
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   712
  box.style.height = IE ? '500px' : '440px';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   713
  box.style.position = 'fixed';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   714
  width = getWidth();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   715
  height = getHeight();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   716
  box.style.left = ( width / 2 - 320 ) + 'px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   717
  box.style.top = ( height / 2 - 250 ) + 'px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   718
  box.style.backgroundColor = 'white';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   719
  box.style.zIndex = getHighestZ() + 1;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   720
  box.id = aclManagerID;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   721
  box.style.opacity = '0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   722
  box.style.filter = 'alpha(opacity=0)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   723
  box.style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   724
  
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   725
  var mainwin = document.createElement('div');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   726
  mainwin.id = aclManagerID + '_main';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   727
  mainwin.style.clip = 'rect(0px,640px,440px,0px)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   728
  mainwin.style.overflow = 'auto';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   729
  mainwin.style.width = '620px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   730
  mainwin.style.height = '420px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   731
  
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   732
  var panel = document.createElement('div');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   733
  panel.style.width = '620px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   734
  panel.style.padding = '10px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   735
  panel.style.lineHeight = '40px';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   736
  panel.style.textAlign = 'right';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   737
  panel.style.position = 'fixed';
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   738
  if ( IE )
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   739
  {
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   740
    panel.style.left = '0px';
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   741
    panel.style.top = '440px';
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   742
  }
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   743
  else
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   744
  {
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   745
    panel.style.left = ( width / 2 - 320 ) + 'px';
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   746
    panel.style.top = ( height / 2 + 190 ) + 'px';
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   747
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   748
  panel.style.backgroundColor = '#D0D0D0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   749
  panel.style.opacity = '0';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   750
  panel.style.filter = 'alpha(opacity=0)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   751
  panel.id = aclManagerID + '_panel';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   752
  
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   753
  var form = document.createElement('form');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   754
  form.method = 'post';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   755
  form.action = 'javascript:void(0)';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   756
  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
   757
  form.name = aclManagerID + '_formobj';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   758
  form.id   = aclManagerID + '_formobj_id';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   759
  
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   760
  var back = document.createElement('input');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   761
  back.type = 'button';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   762
  back.value = $lang.get('etc_wizard_back');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   763
  back.style.fontWeight = 'normal';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   764
  back.onclick = function() { ajaxACLSwitchToSelector(); return false; };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   765
  back.style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   766
  back.id = aclManagerID + '_back';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   767
  
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   768
  var saver = document.createElement('input');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   769
  saver.type = 'submit';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   770
  saver.value = $lang.get('etc_wizard_next');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   771
  saver.style.fontWeight = 'bold';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   772
  saver.id = aclManagerID + '_next';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   773
  
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   774
  var closer = document.createElement('input');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   775
  closer.type = 'button';
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   776
  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
   777
  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
   778
  {
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
    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
   780
      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
   781
      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
   782
      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
   783
        {
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
          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
   785
          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
   786
          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
   787
            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
   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
          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
   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
            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
   792
            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
   793
          }
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
   794
        },
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
   795
        {
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
   796
          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
   797
          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
   798
          {
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
   799
            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
   800
          }
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
   801
        }
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
   802
      ]
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
   803
    });
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
   804
    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
   805
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   806
  
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   807
  var spacer1 = document.createTextNode('  ');
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   808
  var spacer2 = document.createTextNode('  ');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   809
  
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   810
  panel.appendChild(back);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   811
  panel.appendChild(spacer1);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   812
  panel.appendChild(saver);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   813
  panel.appendChild(spacer2);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   814
  panel.appendChild(closer);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   815
  form.appendChild(mainwin);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   816
  form.appendChild(panel);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   817
  box.appendChild(form);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   818
  
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   819
  var body = document.getElementsByTagName('body')[0];
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   820
  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
   821
  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
   822
  {
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
   823
    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
   824
    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
   825
    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
   826
  }
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
   827
  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
   828
  {
1056
f21d6e75b469 ACL editor: finally fixed that annoying blank-window bug on rule deletion
Dan
parents: 907
diff changeset
   829
    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
   830
  }
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   831
  
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   832
  console.debug(panel);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   833
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   834
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   835
function killACLManager()
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
  el = document.getElementById(aclManagerID);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   838
  if(el)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   839
  {
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
   840
    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
   841
    {
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   842
      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
   843
      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
   844
    }
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
   845
    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
   846
    {
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
   847
      opacity(aclManagerID, 100, 0, 500);
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   848
      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
   849
    }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   850
  }
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
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   853
function __aclSubmitManager(form)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   854
{
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   855
  console.debug(form);
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   856
  var thefrm = form;
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
   857
  // var thefrm = document.forms[form.name];
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   858
  var modeobj = form_fetch_field(thefrm, 'mode');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   859
  if ( typeof(modeobj) == 'object' )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   860
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   861
    var mode = (thefrm.mode.value) ? thefrm.mode.value : 'cant_get';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   862
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   863
  else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   864
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   865
    var mode = '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   866
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   867
  switch(mode)
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
    case 'cant_get':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   870
      alert('BUG: can\'t get the state value from the form field.');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   871
      break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   872
    case 'seltarget':
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   873
      var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2']));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   874
      if(isNaN(target_type))
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   875
      {
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   876
        alert($lang.get('acl_err_pleaseselect_targettype'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   877
        return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   878
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   879
      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
   880
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   881
      obj = { 'mode' : mode, 'target_type' : target_type, 'target_id' : target_id };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   882
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   883
      thispage = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   884
      do_scopesel = ( thispage[0] == aclDataCache.page_id && thispage[1] == aclDataCache.namespace );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   885
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   886
      if(do_scopesel)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   887
      {
535
b31eb2b6c137 Fixed selector stage in ACL editor under Safari
Dan
parents: 513
diff changeset
   888
        scope = getRadioState(thefrm, 'scope', ['page', 'group', 'global']);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   889
        if(scope == 'page')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   890
        {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   891
          pageid = strToPageID(title);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   892
          obj['page_id'] = pageid[0];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   893
          obj['namespace'] = pageid[1];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   894
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   895
        else if(scope == 'global')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   896
        {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   897
          obj['page_id'] = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   898
          obj['namespace'] = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   899
        }
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
   900
        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
   901
        {
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
   902
          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
   903
          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
   904
        }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   905
        else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   906
        {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   907
          alert('Invalid scope');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   908
          return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   909
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   910
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   911
      else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   912
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   913
        obj['page_id'] = aclDataCache.page_id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   914
        obj['namespace'] = aclDataCache.namespace;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   915
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   916
      if(target_id == '')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   917
      {
218
e878bcf0227e Javascripted ACL editor interface localized
Dan
parents: 184
diff changeset
   918
        alert($lang.get('acl_err_pleaseselect_username'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   919
        return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   920
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   921
      __aclJSONSubmitAjaxHandler(obj);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   922
      break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   923
    case 'save_edit':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   924
    case 'save_new':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   925
      var form = document.forms[aclManagerID + '_formobj'];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   926
      selections = new Object();
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   927
      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
   928
      var warned_everyone = false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   929
      for(var i in aclPermList)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   930
      {
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
   931
        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
   932
        // 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
   933
        // 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
   934
        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
   935
        {
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
   936
          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
   937
          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
   938
          {
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
   939
            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
   940
          }
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
   941
        }
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   942
        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
   943
        if(!selections[aclPermList[i]])
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   944
        {
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   945
          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
   946
          return false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   947
        }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   948
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   949
      obj = new Object();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   950
      obj['perms'] = selections;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   951
      obj['mode'] = mode;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   952
      obj['target_type'] = aclDataCache.target_type;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   953
      obj['target_id'] = aclDataCache.target_id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   954
      obj['target_name'] = aclDataCache.target_name;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   955
      obj['page_id'] = aclDataCache.page_id;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   956
      obj['namespace'] = aclDataCache.namespace;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   957
      __aclJSONSubmitAjaxHandler(obj);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   958
      break;
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   959
    case 'trace':
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   960
      var params = {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   961
        mode: 'trace',
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   962
        user: document.getElementById(aclManagerID + 'trace_user').value,
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   963
        page: document.getElementById(aclManagerID + 'trace_page').value
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   964
      };
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   965
      __aclJSONSubmitAjaxHandler(params);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
   966
      break;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   967
    default:
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   968
      alert("JSON form submit: invalid mode string "+mode+", stopping execution");
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   969
      return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   970
      break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   971
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   972
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   973
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   974
function getRadioState(form, name, valArray)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   975
{
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   976
  // Konqueror/Safari fix
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   977
  if ( form[name] )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   978
  {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   979
    var formitem = form[name];
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   980
    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
   981
    {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   982
      var i = 0;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   983
      var radios = new Array();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   984
      var radioids = new Array();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   985
      while(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
        var elem = formitem[i];
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   988
        if ( !elem )
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   989
          break;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   990
        radios.push(elem);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   991
        if ( !elem.id )
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
          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
   994
        }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   995
        radioids.push(elem.id);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   996
        i++;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   997
      }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   998
      var cr;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
   999
      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
  1000
      {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1001
        cr = document.getElementById(radioids[i]);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1002
        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
  1003
        {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1004
          try {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1005
            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
  1006
          } catch(e) {
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1007
            // 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
  1008
            return false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1009
          }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1010
        }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1011
      }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1012
      return false;
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1013
    }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1014
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1015
  inputs = form.getElementsByTagName('input');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1016
  radios = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1017
  for(var i in inputs)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1018
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1019
    if(inputs[i]) if(inputs[i].type == 'radio')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1020
      radios.push(inputs[i]);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1021
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1022
  for(var i in radios)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1023
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1024
    if(radios[i].checked && radios[i].name == name)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1025
      return radios[i].value;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1026
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1027
  return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1028
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1029
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1030
function __aclSetAllRadios(val, valArray)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1031
{
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1032
  val = String(val);
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1033
  var form = document.forms[aclManagerID + '_formobj'];
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1034
  if (!form)
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1035
  {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1036
    return false;
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1037
  }
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1038
  var inputs = form.getElementsByTagName('input');
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1039
  var radios = new Array();
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1040
  var dbg = '';
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1041
  for(var i = 0; i < inputs.length; i++)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1042
  {
40
723bb7acf914 Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents: 1
diff changeset
  1043
    dbg += String(inputs[i]) + "\n";
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1044
    if(inputs[i].type == 'radio')
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1045
      radios.push(inputs[i]);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1046
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1047
  for(var i in radios)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1048
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1049
    if(radios[i].value == val)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1050
      radios[i].checked = true;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1051
    else
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1052
      radios[i].checked = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1053
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1054
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1055
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1056
function __aclDeleteRule()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1057
{
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
  1058
  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
  1059
  {
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
  1060
    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
  1061
    {
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
  1062
      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
  1063
    }
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
  1064
    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
  1065
  }
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
  1066
  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
  1067
  {
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
  1068
    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
  1069
    {
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
  1070
      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
  1071
    }
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
  1072
    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
  1073
  }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1074
  parms = {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1075
    'target_type' : aclDataCache.target_type,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1076
    'target_id' : aclDataCache.target_id,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1077
    'target_name' : aclDataCache.target_name,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1078
    'page_id' : aclDataCache.page_id,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1079
    'namespace' : aclDataCache.namespace,
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1080
    'mode' : 'delete'
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1081
  };
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1082
  __aclJSONSubmitAjaxHandler(parms);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1083
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1084
513
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1085
function aclSetViewListExisting()
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
  if ( !document.getElementById(aclManagerID) )
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
    return false;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1090
  }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1091
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1092
  var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1093
  main.innerHTML = '';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1094
  main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1095
  main.style.backgroundRepeat = 'no-repeat';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1096
  main.style.backgroundPosition = 'center center';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1097
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1098
  var parms = {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1099
    'mode' : 'list_existing'
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
  __aclJSONSubmitAjaxHandler(parms);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1102
}
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1103
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1104
function aclSetViewListExistingRespond(data)
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1105
{
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1106
  var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1107
  main.style.padding = '10px';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1108
  main.innerHTML = '';
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 heading = document.createElement('h3');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1111
  heading.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_title')));
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1112
  main.appendChild(heading);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1113
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1114
  var p = document.createElement('p');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1115
  p.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_body')));
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1116
  main.appendChild(p);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1117
  
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
  main.innerHTML += data.key;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1120
  main.style.backgroundImage = 'none';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1121
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1122
  document.getElementById(aclManagerID + '_back').style.display = 'inline';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1123
  document.getElementById(aclManagerID + '_next').style.display = 'none';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1124
  
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1125
  for ( var i = 0; i < data.rules.length; i++ )
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
    var rule = data.rules[i];
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1128
    // build the rule, this is just more boring DOM crap.
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1129
    var div = document.createElement('div');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1130
    div.style.padding = '5px 3px';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1131
    div.style.backgroundColor = '#' + rule.color;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1132
    div.style.cursor = 'pointer';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1133
    div.rule_id = rule.rule_id;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1134
    div.onclick = function()
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1135
    {
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1136
      var main = document.getElementById(aclManagerID + '_main');
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1137
      main.innerHTML = '';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1138
      main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)';
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1139
      ajaxOpenDirectACLRule(parseInt(this.rule_id));
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1140
    }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1141
    div.innerHTML = rule.score_string;
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1142
    main.appendChild(div);
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1143
  }
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1144
}
c15fbf197a54 AJAX interface for listing ACL rules implemented
Dan
parents: 512
diff changeset
  1145
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1146
function aclSetViewDebugTools()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1147
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1148
  // selection window for viewing effective permissions
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1149
  var main = document.getElementById(aclManagerID + '_main');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1150
  main.innerHTML = '';
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
  // set the submission handler to trace
1058
c4b057708436 ACL manager: started on IE support; button clicking not working. Other compatibility improvements and bugfixes.
Dan
parents: 1056
diff changeset
  1153
  var thefrm = document.forms[aclManagerID + '_formobj'];
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1154
  var modeobj = form_fetch_field(thefrm, 'mode');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1155
  modeobj.value = 'trace';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1156
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1157
  // show the back button
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1158
  document.getElementById(aclManagerID + '_back').style.display = 'inline';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1159
  
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
  // start building
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1162
  //
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1163
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1164
  // selection interface
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1165
  var selector = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1166
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1167
    var table = document.createElement('table');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1168
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1169
    // username
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1170
    var tr_user = document.createElement('tr');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1171
    var td_user_l = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1172
    var lbl_user = document.createElement('label');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1173
    lbl_user.setAttribute('for', aclManagerID + 'trace_user');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1174
    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
  1175
    td_user_l.appendChild(lbl_user);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1176
    tr_user.appendChild(td_user_l);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1177
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1178
    var td_user_i = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1179
    var i_user = document.createElement('input');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1180
    i_user.type = 'text';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1181
    i_user.id = aclManagerID + 'trace_user';
763
a03406756fdd [Minor] Enabled anonymous user autocompletion in ACL tracer
Dan
parents: 749
diff changeset
  1182
    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
  1183
    i_user.size = '20';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1184
    td_user_i.appendChild(i_user);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1185
    tr_user.appendChild(td_user_i);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1186
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1187
    table.appendChild(tr_user);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1188
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1189
    // page
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1190
    var tr_page = document.createElement('tr');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1191
    var td_page_l = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1192
    var lbl_page = document.createElement('label');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1193
    lbl_page.setAttribute('for', aclManagerID + 'trace_page');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1194
    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
  1195
    td_page_l.appendChild(lbl_page);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1196
    tr_page.appendChild(td_page_l);
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
    var td_page_i = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1199
    var i_page = document.createElement('input');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1200
    i_page.type = 'text';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1201
    i_page.id = aclManagerID + 'trace_page';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1202
    i_page.onkeyup = function() { new AutofillPage(this); };
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1203
    i_page.size = '20';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1204
    td_page_i.appendChild(i_page);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1205
    tr_page.appendChild(td_page_i);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1206
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1207
    table.appendChild(tr_page);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1208
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1209
    selector.appendChild(table);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1210
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1211
  // wrapper
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1212
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1213
  var container = document.createElement('div');
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
    container.style.margin = 'auto';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1216
    container.style.width = '360px';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1217
    container.style.paddingTop = '90px';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1218
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1219
    var head = document.createElement('h2');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1220
    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
  1221
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1222
    var desc = document.createElement('p');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1223
    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
  1224
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1225
    container.appendChild(head);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1226
    container.appendChild(desc);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1227
    container.appendChild(selector);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1228
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1229
  main.appendChild(container);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1230
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1231
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1232
function aclTraceKey()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1233
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1234
  var div = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1235
  $(div).addClass('tblholder');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1236
  var table = document.createElement('table');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1237
  $(table).attr('cellspacing', '1').attr('cellpadding', '4');
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
  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
  1240
  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
  1241
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1242
    var t = inherit_list[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1243
    var tr = document.createElement('tr');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1244
    var td_key = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1245
    $(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
  1246
    tr.appendChild(td_key);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1247
    var td_explain = document.createElement('td');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1248
    $(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
  1249
    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
  1250
    tr.appendChild(td_explain);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1251
    table.appendChild(tr);
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
  div.appendChild(table);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1254
  return div;
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
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1257
function aclTraceModalKey()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1258
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1259
  load_component('messagebox');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1260
  miniPrompt(function(parent)
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
      // heading
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1263
      var h3 = document.createElement('h3');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1264
      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
  1265
      parent.appendChild(h3);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1266
      
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1267
      var key = aclTraceKey();
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1268
      parent.appendChild(key);
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
      var p = document.createElement('p');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1271
      $(p).css('text-align', 'center');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1272
      
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1273
      var closer = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1274
      $(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
  1275
      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
  1276
      closer.href = '#';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1277
      $(closer).click(function(e)
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
          miniPromptDestroy(this);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1280
          return false;
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
      
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1283
      p.appendChild(closer);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1284
      parent.appendChild(p);
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
}
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
function aclDrawTraceWrapper(data)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1289
{
730
b09cb1dab505 [minor] fixed non-hidden next button in ACL trace view
Dan
parents: 729
diff changeset
  1290
  // hide the next button
b09cb1dab505 [minor] fixed non-hidden next button in ACL trace view
Dan
parents: 729
diff changeset
  1291
  document.getElementById(aclManagerID + '_next').style.display = 'none';
b09cb1dab505 [minor] fixed non-hidden next button in ACL trace view
Dan
parents: 729
diff changeset
  1292
  
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1293
  var trace_by_perm = aclDrawTraceByPerm(data);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1294
  var trace_by_rule = aclDrawTraceByRule(data);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1295
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1296
  trace_by_perm.id = 'aclDebugTraceViewPerm';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1297
  trace_by_rule.id = 'aclDebugTraceViewRule';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1298
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1299
  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
  1300
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1301
  if ( start_with_rule )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1302
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1303
    trace_by_perm.style.display = 'none';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1304
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1305
  else
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1306
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1307
    trace_by_rule.style.display = 'none';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1308
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1309
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1310
  // selection window for viewing effective permissions
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1311
  var main = document.getElementById(aclManagerID + '_main');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1312
  main.innerHTML = '';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1313
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1314
  var wrapper = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1315
  $(wrapper).css('padding-bottom', '20px');
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 floatlink = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1318
  $(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
  1319
  var a_toggle = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1320
  $(a_toggle).attr('id', 'aclDebugTraceViewToggle');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1321
  a_toggle.innerHTML = '&raquo; ';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1322
  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
  1323
  a_toggle.href = '#';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1324
  floatlink.appendChild(a_toggle);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1325
  floatlink.appendChild(document.createElement('br'));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1326
  var a_key = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1327
  $(a_key).css('font-size', 'smaller');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1328
  a_key.innerHTML = '&raquo; ';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1329
  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
  1330
  a_key.href = '#';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1331
  floatlink.appendChild(a_key);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1332
  wrapper.appendChild(floatlink);
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
  var h3 = document.createElement('h3');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1335
  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
  1336
  wrapper.appendChild(h3);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1337
  var p = document.createElement('p');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1338
  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
  1339
  wrapper.appendChild(p);
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
  wrapper.appendChild(trace_by_perm);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1342
  wrapper.appendChild(trace_by_rule);
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
  main.appendChild(wrapper);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1345
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1346
  $(a_toggle).click(function(e)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1347
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1348
      aclTraceToggleViews();
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1349
      return false;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1350
    });
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
  $(a_key).click(function(e)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1353
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1354
      aclTraceModalKey();
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1355
      return false;
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
}
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
function aclTraceToggleViews()
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
  var trace_by_perm = document.getElementById('aclDebugTraceViewPerm');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1362
  var trace_by_rule = document.getElementById('aclDebugTraceViewRule');
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
  var toggler = document.getElementById('aclDebugTraceViewToggle');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1365
  var newtext;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1366
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1367
  if ( trace_by_perm.style.display == 'none' )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1368
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1369
    newtext = $lang.get('acl_btn_sort_rule');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1370
    $(trace_by_rule).hide('blind', {}, 750, function()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1371
      {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1372
        $(trace_by_perm).show('blind', {}, 750);
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
    createCookie('acl_trace_view', 'perm');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1375
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1376
  else
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1377
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1378
    newtext = $lang.get('acl_btn_sort_perm');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1379
    $(trace_by_perm).hide('blind', {}, 750, function()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1380
      {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1381
        $(trace_by_rule).show('blind', {}, 750);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1382
      });
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1383
    createCookie('acl_trace_view', 'rule');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1384
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1385
  $(toggler).fadeOut(500, function()
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1386
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1387
      this.innerHTML = '&raquo; ' + newtext;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1388
      $(this).fadeIn(500);
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
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1391
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1392
function aclDrawTraceByPerm(data)
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1393
{
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1394
  var wrapper = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1395
  // wrapper.style.display = 'none';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1396
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1397
  // 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
  1398
  // var body = document.getElementsByTagName('body')[0];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1399
  // body.appendChild(wrapper);  
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
  for ( var i in data.perms )
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
    var perm = data.perms[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1404
    var item = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1405
    item.className = perm.divclass;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1406
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1407
    // first row - permission name + current setting
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1408
    // 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
  1409
    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
  1410
    item.appendChild(document.createElement('br'));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1411
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1412
    // second row - permission localized name + rule ID
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1413
    var sm = document.createElement('small');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1414
    sm.innerHTML = perm.perm_src;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1415
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1416
    item.appendChild(sm);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1417
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1418
    wrapper.appendChild(item);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1419
    
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1420
    // whole row is now in the document
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1421
    if ( perm.rule_id != -1 )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1422
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1423
      sm.innerHTML += ' [';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1424
      // rule is editable
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1425
      var editlink = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1426
      editlink.href = 'javascript:ajaxOpenDirectACLRule(' + perm.rule_id + ');';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1427
      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
  1428
      sm.appendChild(editlink);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1429
      sm.innerHTML += ']';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1430
    }
749
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
    if ( perm.bad_deps.length > 0 )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1433
    {
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1434
      var bd = document.createElement('span');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1435
      $(bd).addClass('acl_failed_deps');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1436
      var failed_deps = '';
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1437
      for ( var i = 0; i < perm.bad_deps.length; i++ )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1438
      {
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1439
        if ( i > 0 )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1440
          failed_deps += ', ';
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1441
        failed_deps += data.perms[perm.bad_deps[i]].perm_name;
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1442
      }
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1443
      var title = document.createElement('span');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1444
      $(title).addClass('title');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1445
      title.appendChild(document.createTextNode($lang.get('acl_msg_failed_deps')));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1446
      bd.appendChild(title);
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1447
      bd.appendChild(document.createTextNode(failed_deps));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1448
      
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1449
      item.appendChild(document.createElement('br'));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1450
      item.appendChild(bd);
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1451
    }
729
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
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1454
  // var ret = wrapper.cloneNode(true);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1455
  // body.removeChild(wrapper);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1456
  // wrapper = false;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1457
  // ret.style.display = 'block';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1458
  // console.debug(ret);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1459
  // return ret;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1460
  return wrapper;
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
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1463
function aclDrawTraceByRule(data)
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
  var wrapper = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1466
  var groupdata = {};
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 data.perms )
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 perm = data.perms[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1471
    if ( !groupdata[perm['rule_id']] )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1472
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1473
      groupdata[perm['rule_id']] = {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1474
        meta: {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1475
          divclass: perm.divclass,
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1476
          perm_src: perm.perm_src,
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1477
          rule_id: perm.rule_id
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1478
        },
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1479
        rules: {}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1480
      };
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1481
    }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1482
    groupdata[perm['rule_id']]['rules'][i] = perm;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1483
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1484
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1485
  for ( var i in groupdata )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1486
  {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1487
    var group = groupdata[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1488
    var grp = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1489
    var head = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1490
    head.className = group.meta.divclass;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1491
    var span = document.createElement('span');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1492
    span.style.fontSize = 'larger';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1493
    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
  1494
    head.appendChild(span);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1495
    if ( group.meta.rule_id != -1 )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1496
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1497
      head.innerHTML += ' [';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1498
      // rule is editable
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1499
      var editlink = document.createElement('a');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1500
      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
  1501
      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
  1502
      head.appendChild(editlink);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1503
      head.innerHTML += ']';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1504
    }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1505
    grp.appendChild(head);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1506
    for ( var i in group.rules )
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1507
    {
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1508
      var rule = group.rules[i];
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1509
      var rulediv = document.createElement('div');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1510
      rulediv.style.padding = '3px 12px';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1511
      rulediv.innerHTML += rule.perm_name + ': ';
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1512
      var b = document.createElement('strong');
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1513
      b.appendChild(document.createTextNode(rule.perm_value));
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1514
      rulediv.appendChild(b);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1515
      grp.appendChild(rulediv);
749
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
      if ( rule.bad_deps.length > 0 )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1518
      {
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1519
        var bd = document.createElement('span');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1520
        $(bd).addClass('acl_failed_deps');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1521
        var failed_deps = '';
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1522
        for ( var i = 0; i < rule.bad_deps.length; i++ )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1523
        {
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1524
          if ( i > 0 )
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1525
            failed_deps += ', ';
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1526
          failed_deps += data.perms[rule.bad_deps[i]].perm_name;
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1527
        }
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1528
        var title = document.createElement('span');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1529
        $(title).addClass('title');
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1530
        title.appendChild(document.createTextNode($lang.get('acl_msg_failed_deps')));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1531
        bd.appendChild(title);
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1532
        bd.appendChild(document.createTextNode(failed_deps));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1533
        
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1534
        rulediv.appendChild(document.createElement('br'));
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1535
        rulediv.appendChild(bd);
ea3045a3bcbd Added dependency checking in ACL tracer
Dan
parents: 730
diff changeset
  1536
      }
729
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1537
    }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1538
    wrapper.appendChild(grp);
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1539
  }
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1540
  
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1541
  return wrapper;
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1542
}
ebac7eeb89eb Merging in the past three months' work on ACL tracing tools.
Dan
parents: 694
diff changeset
  1543
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1544
function aclShowPresetLoader()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1545
{
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1546
  var prompt = miniPrompt(function(parent)
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
      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
  1549
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1550
  var request = toJSONString({
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1551
      mode: 'list_presets'
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1552
    });
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
  1553
  ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(request), function(ajax)
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1554
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1555
      if ( ajax.readyState == 4 && ajax.status == 200 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1556
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1557
        if ( !check_json_response(ajax.responseText) )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1558
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1559
          miniPromptDestroy(prompt);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1560
          return handle_invalid_json(ajax.responseText);
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 response = parseJSON(ajax.responseText);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1563
        if ( response.mode == 'error' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1564
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1565
          alert(response.error);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1566
          miniPromptDestroy(prompt);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1567
          return false;
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
        prompt = prompt.firstChild.nextSibling;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1570
        prompt.style.textAlign = 'center';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1571
        prompt.innerHTML = '<h3>' + $lang.get('acl_lbl_preset_load_title') + '</h3>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1572
        
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1573
        if ( response.presets.length > 0 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1574
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1575
          // selection box
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1576
          var para = document.createElement('p');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1577
          var select = document.createElement('select');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1578
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1579
          var option = document.createElement('option');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1580
          option.value = '0';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1581
          option.appendChild(document.createTextNode($lang.get('acl_lbl_preset_load')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1582
          select.appendChild(option);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1583
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1584
          for ( var i = 0; i < response.presets.length; i++ )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1585
          {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1586
            var preset = response.presets[i];
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1587
            var option = document.createElement('option');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1588
            option.value = preset.rule_id;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1589
            option.preset_data = preset;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1590
            option.appendChild(document.createTextNode($lang.get(preset.preset_name)));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1591
            select.appendChild(option);
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
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1594
          para.appendChild(select);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1595
          prompt.appendChild(para);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1596
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1597
          // buttons
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1598
          var buttons = document.createElement('p');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1599
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1600
          // load button
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1601
          var btn_load = document.createElement('a');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1602
          btn_load.className = 'abutton abutton_green';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1603
          btn_load.style.fontWeight = 'bold';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1604
          btn_load.appendChild(document.createTextNode($lang.get('acl_btn_load_preset')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1605
          btn_load.selectobj = select;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1606
          btn_load.onclick = function()
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
            if ( this.selectobj.value == '0' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1609
            {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1610
              alert($lang.get('acl_err_select_preset'));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1611
              return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1612
            }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1613
            // retrieve preset data
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1614
            for ( var i = 0; i < this.selectobj.childNodes.length; i++ )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1615
            {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1616
              if ( this.selectobj.childNodes[i].tagName == 'OPTION' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1617
              {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1618
                var node = this.selectobj.childNodes[i];
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1619
                if ( node.value == this.selectobj.value )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1620
                {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1621
                  aclSetRulesAbsolute(node.preset_data.rules);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1622
                  break;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1623
                }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1624
              }
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
            miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1627
            return false;
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
          btn_load.href = '#';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1630
          buttons.appendChild(btn_load);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1631
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1632
          buttons.appendChild(document.createTextNode(' '));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1633
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1634
          // cancel button
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1635
          var btn_cancel = document.createElement('a');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1636
          btn_cancel.className = 'abutton';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1637
          btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1638
          btn_cancel.onclick = function()
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
            miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1641
            return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1642
          }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1643
          btn_cancel.href = '#';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1644
          buttons.appendChild(btn_cancel);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1645
          
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1646
          prompt.appendChild(buttons);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1647
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1648
        else
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1649
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1650
          // "no presets"
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1651
          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
  1652
        }
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
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1655
}
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
function aclSetRulesAbsolute(rules)
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
  __aclSetAllRadios('i');
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
  var form = document.forms[aclManagerID + '_formobj'];
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1662
  if (!form)
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
    return false;
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
  var inputs = form.getElementsByTagName('input');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1667
  var radios = new Array();
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1668
  var dbg = '';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1669
  for(var i = 0; i < inputs.length; i++)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1670
  {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1671
    if(inputs[i].type == 'radio')
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1672
      radios.push(inputs[i]);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1673
  }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1674
  for(var i in radios)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1675
  {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1676
    if ( typeof(rules[ radios[i]['name'] ]) == 'number' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1677
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1678
      radios[i].checked = ( rules[radios[i]['name']] == radios[i].value );
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1679
    }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1680
  }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1681
}
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1682
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1683
function aclShowPresetSave()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1684
{
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1685
  miniPrompt(function(parent)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1686
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1687
      parent.style.textAlign = 'center';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1688
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1689
      parent.innerHTML = '<h3>' + $lang.get('acl_lbl_preset_save_title') + '</h3>';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1690
      var input = document.createElement('input');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1691
      input.id = aclManagerID + '_preset_save';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1692
      input.type = 'text';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1693
      input.size = '30';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1694
      input.onkeypress = function(e)
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1695
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1696
        // 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
  1697
        if ( e )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1698
        if ( e.keyCode )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1699
        if ( e.keyCode == 13 )
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
          if ( aclSavePreset() )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1702
          {
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
  1703
            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
  1704
            {
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
  1705
              // 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
  1706
              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
  1707
              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
  1708
                {
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
  1709
                  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
  1710
                }, 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
  1711
            }
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
  1712
            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
  1713
            {
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
  1714
              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
  1715
            }
679
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1716
          }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1717
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1718
        else if ( e.keyCode == 27 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1719
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1720
          miniPromptDestroy(this);
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
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1723
      var para = document.createElement('p');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1724
      para.appendChild(input);
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
      parent.appendChild(para);
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
      // buttons
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1729
      var buttons = document.createElement('p');
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
      // save button
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1732
      var btn_save = document.createElement('a');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1733
      btn_save.className = 'abutton abutton_green';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1734
      btn_save.style.fontWeight = 'bold';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1735
      btn_save.appendChild(document.createTextNode($lang.get('acl_btn_save_preset')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1736
      btn_save.selectobj = select;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1737
      btn_save.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
        if ( aclSavePreset() )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1740
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1741
          miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1742
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1743
        return false;
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
      btn_save.href = '#';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1746
      buttons.appendChild(btn_save);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1747
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1748
      buttons.appendChild(document.createTextNode(' '));
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
      // cancel button
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1751
      var btn_cancel = document.createElement('a');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1752
      btn_cancel.className = 'abutton';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1753
      btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel')));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1754
      btn_cancel.onclick = function()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1755
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1756
        miniPromptDestroy(this);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1757
        return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1758
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1759
      btn_cancel.href = '#';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1760
      buttons.appendChild(btn_cancel);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1761
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1762
      parent.appendChild(buttons);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1763
      
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1764
      var timeout = ( aclDisableTransitionFX ) ? 10 : 1000;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1765
      setTimeout(function()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1766
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1767
          input.focus();
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1768
        }, timeout);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1769
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1770
}
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1771
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1772
function aclSavePreset()
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1773
{
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1774
  var input = document.getElementById(aclManagerID + '_preset_save');
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1775
  if ( trim(input.value) == '' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1776
  {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1777
    alert($lang.get('acl_err_preset_name_empty'));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1778
    return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1779
  }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1780
  var form = document.forms[aclManagerID + '_formobj'], selections = {};
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1781
  var dbg = '';
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1782
  var warned_everyone = false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1783
  for(var i in aclPermList)
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
    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
  1786
    // 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
  1787
    // admin selected to deny privileges, give a stern warning about it.
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1788
    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
  1789
    {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1790
      warned_everyone = true;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1791
      if ( !confirm($lang.get('acl_msg_deny_everyone_confirm')) )
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
        return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1794
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1795
    }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1796
    dbg += aclPermList[i] + ': ' + selections[aclPermList[i]] + "\n";
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1797
    if(!selections[aclPermList[i]])
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
      alert("Invalid return from getRadioState: "+i+": "+selections[i]+" ("+typeof(selections[i])+")");
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1800
      return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1801
    }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1802
  }
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 packet = toJSONString({
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1805
      mode: 'save_preset',
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1806
      preset_name: input.value,
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1807
      perms: selections
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1808
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1809
  
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1810
  var whitey = whiteOutElement(document.getElementById(aclManagerID));
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1811
  
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
  1812
  ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(packet), function(ajax)
679
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
      if ( ajax.readyState == 4 && ajax.status == 200 )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1815
      {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1816
        if ( !check_json_response(ajax.responseText) )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1817
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1818
          whitey.parentNode.removeChild(whitey);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1819
          return handle_invalid_json(ajax.responseText);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1820
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1821
        var response = parseJSON(ajax.responseText);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1822
        if ( response.mode == 'error' )
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1823
        {
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1824
          whitey.parentNode.removeChild(whitey);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1825
          alert(response.error);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1826
          return false;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1827
        }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1828
        whiteOutReportSuccess(whitey);
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1829
      }
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1830
    });
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1831
  
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1832
  return true;
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1833
}
80bf9b8fe6aa Added preliminary support for ACL presets. Yay!
Dan
parents: 677
diff changeset
  1834
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1835
function array_keys(obj)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1836
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1837
  keys = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1838
  for(var i in obj)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1839
    keys.push(i);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1840
  return keys;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
  1841
}