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