author | Dan |
Mon, 11 Aug 2008 19:52:41 -0400 | |
changeset 679 | 80bf9b8fe6aa |
parent 677 | 2a263b598a2b |
child 694 | 43367c66d869 |
permissions | -rw-r--r-- |
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
35e91d16ecf5
Fixed javascript ACL manager and captcha not showing on ajax login lockout_captcha event
Dan
parents:
582
diff
changeset
|
11 |
|
586
234ddd896555
Made encryption work in form-based logon again; modified load_component() to fetch compressed versions when possible
Dan
parents:
585
diff
changeset
|
12 |
load_component('l10n'); |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
568
diff
changeset
|
13 |
load_component('messagebox'); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
568
diff
changeset
|
14 |
load_component('fadefilter'); |
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
568
diff
changeset
|
15 |
load_component('template-compiler'); |
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
16 |
load_component('autofill'); |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
568
diff
changeset
|
17 |
|
1 | 18 |
if(!page_id || !namespace) |
19 |
{ |
|
20 |
var data = strToPageID(title); |
|
21 |
var page_id = data[0]; |
|
22 |
var namespace = data[1]; |
|
23 |
} |
|
24 |
var params = { |
|
25 |
'mode' : 'listgroups', |
|
26 |
'page_id' : page_id, |
|
27 |
'namespace' : namespace |
|
28 |
}; |
|
29 |
params = toJSONString(params); |
|
30 |
params = ajaxEscape(params); |
|
31 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
|
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
377
diff
changeset
|
32 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 33 |
{ |
327 | 34 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
586
diff
changeset
|
35 |
if ( !check_json_response(response) ) |
327 | 36 |
{ |
37 |
handle_invalid_json(ajax.responseText); |
|
38 |
return false; |
|
39 |
} |
|
40 |
try { |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
41 |
var groups = parseJSON(ajax.responseText); |
327 | 42 |
} catch(e) { |
43 |
handle_invalid_json(ajax.responseText); |
|
44 |
} |
|
1 | 45 |
__aclBuildWizardWindow(); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
46 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
47 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
48 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
49 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
50 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
51 |
} |
1 | 52 |
aclDataCache = groups; |
53 |
__aclBuildSelector(groups); |
|
54 |
} |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
327
diff
changeset
|
55 |
}, true); |
1 | 56 |
return false; |
57 |
} |
|
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
parents:
511
diff
changeset
|
59 |
function ajaxOpenDirectACLRule(rule_id) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
60 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
61 |
var params = { |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
62 |
target_id: rule_id, |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
63 |
mode: 'seltarget_id' |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
64 |
}; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
65 |
params = ajaxEscape(toJSONString(params)); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
66 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
67 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
68 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
69 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
586
diff
changeset
|
70 |
if ( !check_json_response(response) ) |
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
71 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
72 |
handle_invalid_json(ajax.responseText); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
73 |
return false; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
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
parents:
511
diff
changeset
|
75 |
try |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
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
parents:
511
diff
changeset
|
77 |
response = parseJSON(response); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
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
parents:
511
diff
changeset
|
79 |
catch(e) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
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
parents:
511
diff
changeset
|
81 |
handle_invalid_json(response); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
82 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
83 |
if ( !document.getElementById(aclManagerID) ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
84 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
85 |
__aclBuildWizardWindow(); |
513 | 86 |
var main = document.getElementById(aclManagerID + '_main'); |
87 |
main.style.padding = '10px'; |
|
88 |
} |
|
89 |
else |
|
90 |
{ |
|
91 |
var main = document.getElementById(aclManagerID + '_main'); |
|
92 |
main.style.backgroundImage = 'none'; |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
93 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
94 |
if ( response.mode == 'error' ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
95 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
96 |
alert(response.error); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
97 |
killACLManager(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
98 |
return false; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
99 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
100 |
aclDataCache = response; |
513 | 101 |
aclBuildRuleEditor(response, true); |
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
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
parents:
511
diff
changeset
|
103 |
}, true); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
104 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
105 |
|
1 | 106 |
function ajaxACLSwitchToSelector() |
107 |
{ |
|
108 |
params = { |
|
109 |
'mode' : 'listgroups' |
|
110 |
}; |
|
111 |
if ( aclDataCache.page_id && aclDataCache.namespace ) |
|
112 |
{ |
|
113 |
params.page_id = aclDataCache.page_id; |
|
114 |
params.namespace = aclDataCache.namespace; |
|
115 |
} |
|
116 |
params = toJSONString(params); |
|
117 |
params = ajaxEscape(params); |
|
118 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
|
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
377
diff
changeset
|
119 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 120 |
{ |
121 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
122 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
218 | 123 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next'); |
1 | 124 |
groups = parseJSON(ajax.responseText); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
125 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
126 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
127 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
128 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
129 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
130 |
} |
1 | 131 |
aclDataCache = groups; |
132 |
thispage = strToPageID(title); |
|
133 |
groups.page_id = thispage[0]; |
|
134 |
groups.namespace = thispage[1]; |
|
135 |
__aclBuildSelector(groups); |
|
136 |
} |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
327
diff
changeset
|
137 |
}, true); |
1 | 138 |
} |
139 |
||
140 |
function __aclBuildSelector(groups) |
|
141 |
{ |
|
142 |
thispage = strToPageID(title); |
|
143 |
do_scopesel = ( thispage[0] == groups.page_id && thispage[1] == groups.namespace ); |
|
144 |
||
513 | 145 |
document.getElementById(aclManagerID + '_next').style.display = 'inline'; |
146 |
||
1 | 147 |
seed = Math.floor(Math.random() * 1000000); |
148 |
||
149 |
main = document.getElementById(aclManagerID + '_main'); |
|
150 |
main.style.padding = '10px'; |
|
513 | 151 |
main.style.backgroundImage = 'none'; |
152 |
||
153 |
// the "edit existing" button |
|
154 |
var editbtn_wrapper = document.createElement('div'); |
|
155 |
editbtn_wrapper.style.styleFloat = 'right'; |
|
156 |
editbtn_wrapper.style.cssFloat = 'right'; |
|
157 |
editbtn_wrapper.style.fontSize = 'smaller'; |
|
158 |
var editbtn = document.createElement('a'); |
|
159 |
editbtn.href = '#'; |
|
160 |
editbtn.innerHTML = $lang.get('acl_btn_show_existing'); |
|
161 |
editbtn_wrapper.appendChild(editbtn); |
|
162 |
main.appendChild(editbtn_wrapper); |
|
163 |
||
164 |
editbtn.onclick = function() |
|
165 |
{ |
|
166 |
aclSetViewListExisting(); |
|
167 |
return false; |
|
168 |
} |
|
1 | 169 |
|
170 |
selector = document.createElement('div'); |
|
171 |
||
172 |
grpsel = __aclBuildGroupsHTML(groups); |
|
173 |
grpsel.name = 'group_id'; |
|
174 |
||
175 |
span = document.createElement('div'); |
|
176 |
span.id = "enACL_grpbox_"+seed+""; |
|
177 |
||
178 |
// Build the selector |
|
179 |
grpb = document.createElement('input'); |
|
180 |
grpb.type = 'radio'; |
|
181 |
grpb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
182 |
grpb.value = '1'; // ACL_TYPE_GROUP |
1 | 183 |
grpb.checked = 'checked'; |
184 |
grpb.className = seed; |
|
185 |
grpb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'block'; document.getElementById('enACL_usrbox_'+seed).style.display = 'none'; }; |
|
186 |
lbl = document.createElement('label'); |
|
187 |
lbl.appendChild(grpb); |
|
218 | 188 |
lbl.appendChild(document.createTextNode($lang.get('acl_radio_usergroup'))); |
1 | 189 |
lbl.style.display = 'block'; |
190 |
span.appendChild(grpsel); |
|
191 |
||
42
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
192 |
anoninfo = document.createElement('div'); |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
193 |
anoninfo.className = 'info-box-mini'; |
218 | 194 |
anoninfo.appendChild(document.createTextNode($lang.get('acl_msg_guest_howto'))); |
42
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
195 |
span.appendChild(document.createElement('br')); |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
196 |
span.appendChild(anoninfo); |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
197 |
|
1 | 198 |
usrb = document.createElement('input'); |
199 |
usrb.type = 'radio'; |
|
200 |
usrb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
201 |
usrb.value = '2'; // ACL_TYPE_USER |
1 | 202 |
usrb.className = seed; |
203 |
usrb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'none'; document.getElementById('enACL_usrbox_'+seed).style.display = 'block'; }; |
|
204 |
lbl2 = document.createElement('label'); |
|
205 |
lbl2.appendChild(usrb); |
|
218 | 206 |
lbl2.appendChild(document.createTextNode($lang.get('acl_radio_user'))); |
1 | 207 |
lbl2.style.display = 'block'; |
208 |
||
209 |
usrsel = document.createElement('input'); |
|
210 |
usrsel.type = 'text'; |
|
211 |
usrsel.name = 'username'; |
|
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
212 |
usrsel.className = 'autofill username'; |
1 | 213 |
usrsel.id = 'userfield_' + aclManagerID; |
214 |
try { |
|
215 |
usrsel.setAttribute("autocomplete","off"); |
|
216 |
} catch(e) {}; |
|
217 |
||
218 |
span2 = document.createElement('div'); |
|
219 |
span2.id = "enACL_usrbox_"+seed+""; |
|
220 |
span2.style.display = 'none'; |
|
221 |
span2.appendChild(usrsel); |
|
222 |
||
223 |
// Scope selector |
|
224 |
if(do_scopesel) |
|
225 |
{ |
|
226 |
scopediv1 = document.createElement('div'); |
|
227 |
scopediv2 = document.createElement('div'); |
|
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
228 |
scopediv3 = document.createElement('div'); |
1 | 229 |
scopeRadioPage = document.createElement('input'); |
230 |
scopeRadioPage.type = 'radio'; |
|
231 |
scopeRadioPage.name = 'scope'; |
|
232 |
scopeRadioPage.value = 'page'; |
|
233 |
scopeRadioPage.checked = 'checked'; |
|
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
234 |
scopeRadioPage.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
235 |
if ( groups.page_groups.length > 0 ) scopeRadioPage.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; }; |
1 | 236 |
scopeRadioGlobal = document.createElement('input'); |
237 |
scopeRadioGlobal.type = 'radio'; |
|
238 |
scopeRadioGlobal.name = 'scope'; |
|
239 |
scopeRadioGlobal.value = 'global'; |
|
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
240 |
scopeRadioGlobal.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
241 |
if ( groups.page_groups.length > 0 ) scopeRadioGlobal.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; }; |
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
242 |
scopeRadioGroup = document.createElement('input'); |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
243 |
scopeRadioGroup.type = 'radio'; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
244 |
scopeRadioGroup.name = 'scope'; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
245 |
scopeRadioGroup.value = 'group'; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
246 |
scopeRadioGroup.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
247 |
if ( groups.page_groups.length > 0 ) scopeRadioGroup.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'block'; }; |
1 | 248 |
lblPage = document.createElement('label'); |
249 |
lblPage.style.display = 'block'; |
|
250 |
lblPage.appendChild(scopeRadioPage); |
|
218 | 251 |
lblPage.appendChild(document.createTextNode($lang.get('acl_radio_scope_thispage'))); |
1 | 252 |
lblGlobal = document.createElement('label'); |
253 |
lblGlobal.style.display = 'block'; |
|
254 |
lblGlobal.appendChild(scopeRadioGlobal); |
|
218 | 255 |
lblGlobal.appendChild(document.createTextNode($lang.get('acl_radio_scope_wholesite'))); |
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
256 |
lblGroup = document.createElement('label'); |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
257 |
lblGroup.style.display = 'block'; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
258 |
lblGroup.appendChild(scopeRadioGroup); |
218 | 259 |
lblGroup.appendChild(document.createTextNode($lang.get('acl_radio_scope_pagegroup'))); |
1 | 260 |
scopediv1.appendChild(lblPage); |
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
261 |
scopediv2.appendChild(lblGroup); |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
262 |
scopediv3.appendChild(lblGlobal); |
1 | 263 |
|
264 |
scopedesc = document.createElement('p'); |
|
218 | 265 |
scopedesc.appendChild(document.createTextNode($lang.get('acl_lbl_scope'))); |
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
266 |
|
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
267 |
scopePGrp = document.createElement('select'); |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
268 |
scopePGrp.style.marginLeft = '13px'; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
269 |
scopePGrp.style.display = 'none'; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
270 |
scopePGrp.id = "enACL_pgsel_1048576"; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
271 |
|
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
272 |
var opt; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
273 |
for ( var i = 0; i < groups.page_groups.length; i++ ) |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
274 |
{ |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
275 |
opt = document.createElement('option'); |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
276 |
opt.value = groups.page_groups[i].id; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
277 |
opt.appendChild(document.createTextNode(groups.page_groups[i].name)); |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
278 |
scopePGrp.appendChild(opt); |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
279 |
} |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
280 |
|
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
281 |
scopediv2.appendChild(scopePGrp); |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
282 |
|
1 | 283 |
} |
284 |
||
285 |
// Styles |
|
286 |
span.style.marginLeft = '13px'; |
|
287 |
span.style.padding = '5px 0'; |
|
288 |
span2.style.marginLeft = '13px'; |
|
289 |
span2.style.padding = '5px 0'; |
|
290 |
||
291 |
selector.appendChild(lbl); |
|
292 |
selector.appendChild(span); |
|
293 |
||
294 |
selector.appendChild(lbl2); |
|
295 |
selector.appendChild(span2); |
|
296 |
||
297 |
container = document.createElement('div'); |
|
298 |
container.style.margin = 'auto'; |
|
299 |
container.style.width = '360px'; |
|
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
300 |
container.style.paddingTop = '50px'; |
1 | 301 |
|
302 |
head = document.createElement('h2'); |
|
218 | 303 |
head.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_title'))); |
1 | 304 |
|
305 |
desc = document.createElement('p'); |
|
218 | 306 |
desc.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_body'))); |
1 | 307 |
|
308 |
container.appendChild(head); |
|
309 |
container.appendChild(desc); |
|
310 |
container.appendChild(selector); |
|
311 |
||
312 |
if(do_scopesel) |
|
313 |
{ |
|
314 |
container.appendChild(scopedesc); |
|
315 |
container.appendChild(scopediv1); |
|
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
316 |
if ( groups.page_groups.length > 0 ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
317 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
318 |
container.appendChild(scopediv2); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
319 |
} |
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
320 |
container.appendChild(scopediv3); |
1 | 321 |
} |
322 |
||
323 |
main.appendChild(container); |
|
324 |
||
325 |
var mode = document.createElement('input'); |
|
326 |
mode.name = 'mode'; |
|
327 |
mode.type = 'hidden'; |
|
328 |
mode.id = aclManagerID + '_mode'; |
|
329 |
mode.value = 'seltarget'; |
|
330 |
||
331 |
var theform = document.getElementById(aclManagerID + '_formobj_id'); |
|
332 |
if ( !theform.mode ) |
|
333 |
{ |
|
334 |
theform.appendChild(mode); |
|
335 |
} |
|
336 |
else |
|
337 |
{ |
|
338 |
theform.removeChild(theform.mode); |
|
339 |
theform.appendChild(mode); |
|
340 |
} |
|
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
341 |
|
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
342 |
autofill_init_element(usrsel, { |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
343 |
allow_anon: true |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
344 |
}); |
1 | 345 |
} |
346 |
||
347 |
var aclDebugWin = false; |
|
348 |
||
349 |
function aclDebug(text) |
|
350 |
{ |
|
351 |
if(!aclDebugWin) |
|
352 |
aclDebugWin = pseudoWindowOpen("data:text/html;plain,<html><head><title>debug win</title></head><body><h1>Debug window</h1></body></html>", "aclDebugWin"); |
|
353 |
setTimeout(function() { |
|
354 |
aclDebugWin.pre = aclDebugWin.document.createElement('pre'); |
|
355 |
aclDebugWin.pre.appendChild(aclDebugWin.document.createTextNode(text)); |
|
356 |
aclDebugWin.b = aclDebugWin.document.getElementsByTagName('body')[0]; |
|
357 |
aclDebugWin.b.appendChild(aclDebugWin.pre);}, 1000); |
|
358 |
} |
|
359 |
||
360 |
var pseudoWindows = new Object(); |
|
361 |
||
362 |
function pseudoWindowOpen(url, id) |
|
363 |
{ |
|
364 |
if(pseudoWindows[id]) |
|
365 |
{ |
|
366 |
document.getElementById('pseudowin_ifr_'+id).src = url; |
|
367 |
} |
|
368 |
else |
|
369 |
{ |
|
370 |
win = document.createElement('iframe'); |
|
371 |
win.style.position='fixed'; |
|
372 |
win.style.width = '640px'; |
|
373 |
win.style.height = '480px'; |
|
374 |
win.style.top = '0px'; |
|
375 |
win.style.left = '0px'; |
|
376 |
win.style.zIndex = getHighestZ() + 1; |
|
377 |
win.style.backgroundColor = '#FFFFFF'; |
|
378 |
win.name = 'pseudo_ifr_'+id; |
|
379 |
win.id = 'pseudowindow_ifr_'+id; |
|
380 |
win.src = url; |
|
381 |
body = document.getElementsByTagName('body')[0]; |
|
382 |
body.appendChild(win); |
|
383 |
} |
|
384 |
win_obj = eval("( pseudo_ifr_"+id+" )"); |
|
385 |
return win_obj; |
|
386 |
} |
|
387 |
||
388 |
function __aclJSONSubmitAjaxHandler(params) |
|
389 |
{ |
|
390 |
params = toJSONString(params); |
|
391 |
params = ajaxEscape(params); |
|
392 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
|
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
377
diff
changeset
|
393 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 394 |
{ |
327 | 395 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
586
diff
changeset
|
396 |
if ( !check_json_response(response) ) |
327 | 397 |
{ |
398 |
handle_invalid_json(ajax.responseText); |
|
399 |
return false; |
|
400 |
} |
|
513 | 401 |
try |
402 |
{ |
|
403 |
var data = parseJSON(ajax.responseText); |
|
404 |
} |
|
405 |
catch(e) |
|
406 |
{ |
|
327 | 407 |
handle_invalid_json(ajax.responseText); |
513 | 408 |
return false; |
1 | 409 |
} |
410 |
aclDataCache = data; |
|
411 |
switch(data.mode) |
|
412 |
{ |
|
413 |
case 'seltarget': |
|
414 |
||
415 |
// Build the ACL edit form |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
416 |
aclBuildRuleEditor(data); |
1 | 417 |
|
418 |
break; |
|
419 |
case 'success': |
|
420 |
var note = document.createElement('div'); |
|
421 |
note.className = 'info-box'; |
|
422 |
note.style.marginLeft = '0'; |
|
423 |
var b = document.createElement('b'); |
|
218 | 424 |
b.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_title'))); |
1 | 425 |
note.appendChild(b); |
426 |
note.appendChild(document.createElement('br')); |
|
218 | 427 |
note.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_body', { target_name: data.target_name }))); |
1 | 428 |
note.appendChild(document.createElement('br')); |
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
429 |
|
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
430 |
/* |
1 | 431 |
var a = document.createElement('a'); |
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
327
diff
changeset
|
432 |
a.href = '#'; |
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
407
diff
changeset
|
433 |
a.id = aclManagerID + '_btn_dismiss'; |
218 | 434 |
a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
1 | 435 |
note.appendChild(a); |
436 |
var a2 = document.createElement('a'); |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
327
diff
changeset
|
437 |
a2.href = '#'; |
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
407
diff
changeset
|
438 |
a.id = aclManagerID + '_btn_close'; |
218 | 439 |
a2.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
1 | 440 |
note.appendChild(a2); |
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
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
parents:
419
diff
changeset
|
442 |
|
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
443 |
var a_dismiss = document.createElement('a'); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
444 |
a_dismiss.href = '#'; |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
445 |
a_dismiss.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
446 |
note.appendChild(a_dismiss); |
42
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
447 |
|
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
448 |
var a_close = document.createElement('a'); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
449 |
a_close.href = '#'; |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
450 |
a_close.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
451 |
note.appendChild(a_close); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
452 |
|
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
453 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
407
diff
changeset
|
454 |
|
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
455 |
a_dismiss.setAttribute('onclick', 'var parent = this.parentNode.parentNode; parent.removeChild(this.parentNode); return false;'); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
456 |
a_close.setAttribute('onclick', 'killACLManager(); return false;'); |
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
407
diff
changeset
|
457 |
|
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
458 |
if ( !document.getElementById(aclManagerID+'_deletelnk') ) |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
459 |
document.getElementById(aclManagerID + '_main').innerHTML += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'' + $lang.get('acl_msg_deleterule_confirm') + '\')) __aclDeleteRule(); return false;" style="color: red;">' + $lang.get('acl_lbl_deleterule') + '</a></p>'; |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
460 |
|
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
461 |
document.getElementById(aclManagerID+'_main').scrollTop = 0; |
513 | 462 |
document.getElementById(aclManagerID+'_main').style.backgroundImage = 'none'; |
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
463 |
|
42
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
464 |
aclDataCache.mode = 'save_edit'; |
1 | 465 |
break; |
466 |
case 'delete': |
|
467 |
||
468 |
params = { |
|
469 |
'mode' : 'listgroups' |
|
470 |
}; |
|
471 |
params = toJSONString(params); |
|
472 |
params = ajaxEscape(params); |
|
473 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
|
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
377
diff
changeset
|
474 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 475 |
{ |
476 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
477 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
218 | 478 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next'); |
1 | 479 |
var thispage = strToPageID(title); |
480 |
groups.page_id = thispage[0]; |
|
481 |
groups.namespace = thispage[1]; |
|
482 |
__aclBuildSelector(groups); |
|
483 |
||
484 |
note = document.createElement('div'); |
|
485 |
note.className = 'info-box'; |
|
486 |
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
parents:
40
diff
changeset
|
487 |
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
parents:
40
diff
changeset
|
488 |
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
parents:
40
diff
changeset
|
489 |
note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000); |
1 | 490 |
b = document.createElement('b'); |
218 | 491 |
b.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title'))); |
1 | 492 |
note.appendChild(b); |
493 |
note.appendChild(document.createElement('br')); |
|
336
bfa2e9c23f03
Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents:
335
diff
changeset
|
494 |
note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_body', { target_name: aclDataCache.target_name }))); |
1 | 495 |
note.appendChild(document.createElement('br')); |
496 |
a = document.createElement('a'); |
|
497 |
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
parents:
40
diff
changeset
|
498 |
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 | 499 |
a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
1 | 500 |
note.appendChild(a); |
501 |
a = document.createElement('a'); |
|
502 |
a.href = '#'; |
|
503 |
a.onclick = function() { killACLManager(); return false; }; |
|
218 | 504 |
a.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
1 | 505 |
note.appendChild(a); |
506 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
|
507 |
//fadeInfoBoxes(); |
|
508 |
||
509 |
} |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
327
diff
changeset
|
510 |
}, true); |
1 | 511 |
|
512 |
break; |
|
513 |
case 'error': |
|
514 |
alert("Server side processing error:\n"+data.error); |
|
515 |
break; |
|
516 |
case 'debug': |
|
517 |
aclDebug(data.text); |
|
518 |
break; |
|
513 | 519 |
case 'list_existing': |
520 |
aclSetViewListExistingRespond(data); |
|
521 |
break; |
|
1 | 522 |
default: |
327 | 523 |
handle_invalid_json(ajax.responseText); |
1 | 524 |
break; |
525 |
} |
|
526 |
} |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
327
diff
changeset
|
527 |
}, true); |
1 | 528 |
} |
529 |
||
513 | 530 |
function aclBuildRuleEditor(data, from_direct) |
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
531 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
532 |
var act_desc = ( data.type == 'new' ) ? $lang.get('acl_lbl_editwin_title_create') : $lang.get('acl_lbl_editwin_title_edit'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
533 |
var target_type_t = ( data.target_type == 1 ) ? $lang.get('acl_target_type_group') : $lang.get('acl_target_type_user'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
534 |
var target_name_t = data.target_name; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
535 |
var scope_type = ( data.page_id == false && data.namespace == false ) ? $lang.get('acl_scope_type_wholesite') : ( data.namespace == '__PageGroup' ) ? $lang.get('acl_scope_type_pagegroup') : $lang.get('acl_scope_type_thispage'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
536 |
|
513 | 537 |
document.getElementById(aclManagerID + '_next').style.display = 'inline'; |
538 |
||
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
539 |
html = '<h2>'+act_desc+'</h2>'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
540 |
html += '<p>' + $lang.get('acl_lbl_editwin_body', { target_type: target_type_t, target: target_name_t, scope_type: scope_type }) + '</p>'; |
679 | 541 |
|
542 |
// preset management |
|
543 |
var load_flags = 'href="#" onclick="aclShowPresetLoader(); return false;"'; |
|
544 |
var save_flags = 'href="#" onclick="aclShowPresetSave(); return false;"'; |
|
545 |
html += '<div style="float: right;">'; |
|
546 |
html += $lang.get('acl_btn_edit_presets', { load_flags: load_flags, save_flags: save_flags }); |
|
547 |
html += '</div>'; |
|
548 |
html += '<div style="clear: both;"></div>'; |
|
549 |
||
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
550 |
parser = new templateParser(data.template.acl_field_begin); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
551 |
html += parser.run(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
552 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
553 |
cls = 'row2'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
554 |
for(var i in data.acl_types) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
555 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
556 |
if(typeof(data.acl_types[i]) == 'number') |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
557 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
558 |
cls = ( cls == 'row1' ) ? 'row2' : 'row1'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
559 |
p = new templateParser(data.template.acl_field_item); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
560 |
vars = new Object(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
561 |
if ( data.acl_descs[i].match(/^([a-z0-9_]+)$/) ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
562 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
563 |
vars['FIELD_DESC'] = $lang.get(data.acl_descs[i]); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
564 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
565 |
else |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
566 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
567 |
vars['FIELD_DESC'] = data.acl_descs[i]; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
568 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
569 |
vars['FIELD_INHERIT_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
570 |
vars['FIELD_DENY_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
571 |
vars['FIELD_DISALLOW_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
572 |
vars['FIELD_WIKIMODE_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
573 |
vars['FIELD_ALLOW_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
574 |
vars['FIELD_NAME'] = i; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
575 |
if ( !data.current_perms[i] ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
576 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
577 |
data.current_perms[i] = 'i'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
578 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
579 |
switch(data.current_perms[i]) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
580 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
581 |
case 'i': |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
582 |
default: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
583 |
vars['FIELD_INHERIT_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
584 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
585 |
case 1: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
586 |
vars['FIELD_DENY_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
587 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
588 |
case 2: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
589 |
vars['FIELD_DISALLOW_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
590 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
591 |
case 3: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
592 |
vars['FIELD_WIKIMODE_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
593 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
594 |
case 4: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
595 |
vars['FIELD_ALLOW_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
596 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
597 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
598 |
vars['ROW_CLASS'] = cls; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
599 |
p.assign_vars(vars); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
600 |
html += p.run(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
601 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
602 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
603 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
604 |
var parser = new templateParser(data.template.acl_field_end); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
605 |
html += parser.run(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
606 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
607 |
if(data.type == 'edit') |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
608 |
html += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'' + $lang.get('acl_msg_deleterule_confirm') + '\')) __aclDeleteRule(); return false;" style="color: red;">' + $lang.get('acl_lbl_deleterule') + '</a></p>'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
609 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
610 |
var main = document.getElementById(aclManagerID + '_main'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
611 |
main.innerHTML = html; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
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
parents:
511
diff
changeset
|
613 |
var form = document.getElementById(aclManagerID + '_formobj_id'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
614 |
|
513 | 615 |
if ( from_direct ) |
616 |
{ |
|
617 |
var modeobj = document.getElementById(aclManagerID + '_mode'); |
|
618 |
modeobj.value = 'save_edit'; |
|
619 |
} |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
620 |
else |
513 | 621 |
{ |
622 |
var modeobj = form_fetch_field(form, 'mode'); |
|
623 |
if ( modeobj ) |
|
624 |
modeobj.value = 'save_' + data.type; |
|
625 |
else |
|
626 |
alert('modeobj is invalid: '+modeobj); |
|
627 |
} |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
628 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
629 |
aclPermList = array_keys(data.acl_types); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
630 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
631 |
document.getElementById(aclManagerID + '_back').style.display = 'inline'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
632 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_save_changes'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
633 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
634 |
|
1 | 635 |
function __aclBuildGroupsHTML(groups) |
636 |
{ |
|
637 |
groups = groups.groups; |
|
638 |
select = document.createElement('select'); |
|
639 |
for(var i in groups) |
|
640 |
{ |
|
641 |
if(typeof(groups[i]['name']) == 'string' && i != 'toJSONString') |
|
642 |
{ |
|
643 |
o = document.createElement('option'); |
|
644 |
o.value = groups[i]['id']; |
|
645 |
t = document.createTextNode(groups[i]['name']); |
|
646 |
o.appendChild(t); |
|
647 |
select.appendChild(o); |
|
648 |
} |
|
649 |
} |
|
650 |
return select; |
|
651 |
} |
|
652 |
||
653 |
function __aclBuildWizardWindow() |
|
654 |
{ |
|
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
655 |
darken(aclDisableTransitionFX); |
1 | 656 |
box = document.createElement('div'); |
657 |
box.style.width = '640px' |
|
658 |
box.style.height = '440px'; |
|
659 |
box.style.position = 'fixed'; |
|
660 |
width = getWidth(); |
|
661 |
height = getHeight(); |
|
662 |
box.style.left = ( width / 2 - 320 ) + 'px'; |
|
663 |
box.style.top = ( height / 2 - 250 ) + 'px'; |
|
664 |
box.style.backgroundColor = 'white'; |
|
665 |
box.style.zIndex = getHighestZ() + 1; |
|
666 |
box.id = aclManagerID; |
|
667 |
box.style.opacity = '0'; |
|
668 |
box.style.filter = 'alpha(opacity=0)'; |
|
669 |
box.style.display = 'none'; |
|
670 |
||
671 |
mainwin = document.createElement('div'); |
|
672 |
mainwin.id = aclManagerID + '_main'; |
|
673 |
mainwin.style.clip = 'rect(0px,640px,440px,0px)'; |
|
674 |
mainwin.style.overflow = 'auto'; |
|
675 |
mainwin.style.width = '620px'; |
|
676 |
mainwin.style.height = '420px'; |
|
677 |
||
678 |
panel = document.createElement('div'); |
|
679 |
panel.style.width = '620px'; |
|
680 |
panel.style.padding = '10px'; |
|
681 |
panel.style.lineHeight = '40px'; |
|
682 |
panel.style.textAlign = 'right'; |
|
683 |
panel.style.position = 'fixed'; |
|
684 |
panel.style.left = ( width / 2 - 320 ) + 'px'; |
|
685 |
panel.style.top = ( height / 2 + 190 ) + 'px'; |
|
686 |
panel.style.backgroundColor = '#D0D0D0'; |
|
687 |
panel.style.opacity = '0'; |
|
688 |
panel.style.filter = 'alpha(opacity=0)'; |
|
689 |
panel.id = aclManagerID + '_panel'; |
|
690 |
||
691 |
form = document.createElement('form'); |
|
692 |
form.method = 'post'; |
|
693 |
form.action = 'javascript:void(0)'; |
|
694 |
form.onsubmit = function() { if(this.username && !submitAuthorized) return false; __aclSubmitManager(this); return false; }; |
|
695 |
form.name = aclManagerID + '_formobj'; |
|
696 |
form.id = aclManagerID + '_formobj_id'; |
|
697 |
||
698 |
back = document.createElement('input'); |
|
699 |
back.type = 'button'; |
|
218 | 700 |
back.value = $lang.get('etc_wizard_back'); |
1 | 701 |
back.style.fontWeight = 'normal'; |
702 |
back.onclick = function() { ajaxACLSwitchToSelector(); return false; }; |
|
703 |
back.style.display = 'none'; |
|
704 |
back.id = aclManagerID + '_back'; |
|
705 |
||
706 |
saver = document.createElement('input'); |
|
707 |
saver.type = 'submit'; |
|
218 | 708 |
saver.value = $lang.get('etc_wizard_next'); |
1 | 709 |
saver.style.fontWeight = 'bold'; |
710 |
saver.id = aclManagerID + '_next'; |
|
711 |
||
712 |
closer = document.createElement('input'); |
|
713 |
closer.type = 'button'; |
|
218 | 714 |
closer.value = $lang.get('etc_cancel_changes'); |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
715 |
closer.onclick = function() |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
716 |
{ |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
717 |
miniPromptMessage({ |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
718 |
title: $lang.get('acl_msg_closeacl_confirm_title'), |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
719 |
message: $lang.get('acl_msg_closeacl_confirm_body'), |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
720 |
buttons: [ |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
721 |
{ |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
722 |
text: $lang.get('acl_btn_close'), |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
723 |
color: 'red', |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
724 |
style: { |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
725 |
fontWeight: 'bold' |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
726 |
}, |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
727 |
onclick: function(e) |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
728 |
{ |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
729 |
killACLManager(); |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
730 |
miniPromptDestroy(this); |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
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
parents:
535
diff
changeset
|
732 |
}, |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
733 |
{ |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
734 |
text: $lang.get('etc_cancel'), |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
735 |
onclick: function(e) |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
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
parents:
535
diff
changeset
|
737 |
miniPromptDestroy(this); |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
738 |
} |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
739 |
} |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
740 |
] |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
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
parents:
535
diff
changeset
|
742 |
return false; |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
535
diff
changeset
|
743 |
} |
1 | 744 |
|
745 |
spacer1 = document.createTextNode(' '); |
|
746 |
spacer2 = document.createTextNode(' '); |
|
747 |
||
748 |
panel.appendChild(back); |
|
749 |
panel.appendChild(spacer1); |
|
750 |
panel.appendChild(saver); |
|
751 |
panel.appendChild(spacer2); |
|
752 |
panel.appendChild(closer); |
|
753 |
form.appendChild(mainwin); |
|
754 |
form.appendChild(panel); |
|
755 |
box.appendChild(form); |
|
756 |
||
757 |
body = document.getElementsByTagName('body')[0]; |
|
758 |
body.appendChild(box); |
|
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
759 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
760 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
761 |
document.getElementById(aclManagerID).style.display = 'block'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
762 |
changeOpac(100, aclManagerID); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
763 |
changeOpac(100, aclManagerID + '_panel'); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
764 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
765 |
else |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
766 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
767 |
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
parents:
76
diff
changeset
|
768 |
} |
1 | 769 |
} |
770 |
||
771 |
function killACLManager() |
|
772 |
{ |
|
773 |
el = document.getElementById(aclManagerID); |
|
774 |
if(el) |
|
775 |
{ |
|
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
776 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
777 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
778 |
enlighten(true); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
779 |
el.parentNode.removeChild(el); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
780 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
781 |
else |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
782 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
783 |
opacity(aclManagerID, 100, 0, 500); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
784 |
setTimeout('var el = document.getElementById(aclManagerID); el.parentNode.removeChild(el); enlighten();', 750); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
76
diff
changeset
|
785 |
} |
1 | 786 |
} |
787 |
} |
|
788 |
||
789 |
function __aclSubmitManager(form) |
|
790 |
{ |
|
791 |
var thefrm = document.forms[form.name]; |
|
792 |
var modeobj = form_fetch_field(thefrm, 'mode'); |
|
793 |
if ( typeof(modeobj) == 'object' ) |
|
794 |
{ |
|
795 |
var mode = (thefrm.mode.value) ? thefrm.mode.value : 'cant_get'; |
|
796 |
} |
|
797 |
else |
|
798 |
{ |
|
799 |
var mode = ''; |
|
800 |
} |
|
801 |
switch(mode) |
|
802 |
{ |
|
803 |
case 'cant_get': |
|
804 |
alert('BUG: can\'t get the state value from the form field.'); |
|
805 |
break; |
|
806 |
case 'seltarget': |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
807 |
var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2'])); |
1 | 808 |
if(isNaN(target_type)) |
809 |
{ |
|
218 | 810 |
alert($lang.get('acl_err_pleaseselect_targettype')); |
1 | 811 |
return false; |
812 |
} |
|
813 |
target_id = ( target_type == 1 ) ? parseInt(thefrm.group_id.value) : thefrm.username.value; |
|
814 |
||
815 |
obj = { 'mode' : mode, 'target_type' : target_type, 'target_id' : target_id }; |
|
816 |
||
817 |
thispage = strToPageID(title); |
|
818 |
do_scopesel = ( thispage[0] == aclDataCache.page_id && thispage[1] == aclDataCache.namespace ); |
|
819 |
||
820 |
if(do_scopesel) |
|
821 |
{ |
|
535 | 822 |
scope = getRadioState(thefrm, 'scope', ['page', 'group', 'global']); |
1 | 823 |
if(scope == 'page') |
824 |
{ |
|
825 |
pageid = strToPageID(title); |
|
826 |
obj['page_id'] = pageid[0]; |
|
827 |
obj['namespace'] = pageid[1]; |
|
828 |
} |
|
829 |
else if(scope == 'global') |
|
830 |
{ |
|
831 |
obj['page_id'] = false; |
|
832 |
obj['namespace'] = false; |
|
833 |
} |
|
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
834 |
else if(scope == 'group') |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
835 |
{ |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
836 |
obj['page_id'] = document.getElementById('enACL_pgsel_1048576').value; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
837 |
obj['namespace'] = '__PageGroup'; |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
838 |
} |
1 | 839 |
else |
840 |
{ |
|
841 |
alert('Invalid scope'); |
|
842 |
return false; |
|
843 |
} |
|
844 |
} |
|
845 |
else |
|
846 |
{ |
|
847 |
obj['page_id'] = aclDataCache.page_id; |
|
848 |
obj['namespace'] = aclDataCache.namespace; |
|
849 |
} |
|
850 |
if(target_id == '') |
|
851 |
{ |
|
218 | 852 |
alert($lang.get('acl_err_pleaseselect_username')); |
1 | 853 |
return false; |
854 |
} |
|
855 |
__aclJSONSubmitAjaxHandler(obj); |
|
856 |
break; |
|
857 |
case 'save_edit': |
|
858 |
case 'save_new': |
|
859 |
var form = document.forms[aclManagerID + '_formobj']; |
|
860 |
selections = new Object(); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
861 |
var dbg = ''; |
511
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
862 |
var warned_everyone = false; |
1 | 863 |
for(var i in aclPermList) |
864 |
{ |
|
679 | 865 |
selections[aclPermList[i]] = getRadioState(form, aclPermList[i], ['i', 1, 2, 3, 4]); |
511
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
866 |
// If we're editing permissions for everyone on the entire site and the |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
867 |
// admin selected to deny privileges, give a stern warning about it. |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
868 |
if ( selections[aclPermList[i]] == 1 && aclDataCache.target_type == 1 /* ACL_TYPE_GROUP */ && aclDataCache.target_id == 1 && !warned_everyone ) |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
869 |
{ |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
870 |
warned_everyone = true; |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
871 |
if ( !confirm($lang.get('acl_msg_deny_everyone_confirm')) ) |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
872 |
{ |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
873 |
return false; |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
874 |
} |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
875 |
} |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
876 |
dbg += aclPermList[i] + ': ' + selections[aclPermList[i]] + "\n"; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
877 |
if(!selections[aclPermList[i]]) |
1 | 878 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
879 |
alert("Invalid return from getRadioState: "+i+": "+selections[i]+" ("+typeof(selections[i])+")"); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
880 |
return false; |
1 | 881 |
} |
882 |
} |
|
883 |
obj = new Object(); |
|
884 |
obj['perms'] = selections; |
|
885 |
obj['mode'] = mode; |
|
886 |
obj['target_type'] = aclDataCache.target_type; |
|
887 |
obj['target_id'] = aclDataCache.target_id; |
|
888 |
obj['target_name'] = aclDataCache.target_name; |
|
889 |
obj['page_id'] = aclDataCache.page_id; |
|
890 |
obj['namespace'] = aclDataCache.namespace; |
|
891 |
__aclJSONSubmitAjaxHandler(obj); |
|
892 |
break; |
|
893 |
default: |
|
894 |
alert("JSON form submit: invalid mode string "+mode+", stopping execution"); |
|
895 |
return false; |
|
896 |
break; |
|
897 |
} |
|
898 |
} |
|
899 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
900 |
function getRadioState(form, name, valArray) |
1 | 901 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
902 |
// Konqueror/Safari fix |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
903 |
if ( form[name] ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
904 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
905 |
var formitem = form[name]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
906 |
if ( String(formitem) == '[object DOMNamedNodesCollection]' || is_Safari ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
907 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
908 |
var i = 0; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
909 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
910 |
var radioids = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
911 |
while(true) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
912 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
913 |
var elem = formitem[i]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
914 |
if ( !elem ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
915 |
break; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
916 |
radios.push(elem); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
917 |
if ( !elem.id ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
918 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
919 |
elem.id = 'autoRadioBtn_' + Math.floor(Math.random() * 1000000); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
920 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
921 |
radioids.push(elem.id); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
922 |
i++; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
923 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
924 |
var cr; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
925 |
for ( var i = 0; i < radios.length; i++ ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
926 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
927 |
cr = document.getElementById(radioids[i]); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
928 |
if ( cr.value == 'on' || cr.checked == true ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
929 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
930 |
try { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
931 |
return ( typeof ( valArray[i] ) != 'undefined' ) ? valArray[i] : false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
932 |
} catch(e) { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
933 |
// alert('Didn\'t get value for index: ' + i); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
934 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
935 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
936 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
937 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
938 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
939 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
940 |
} |
1 | 941 |
inputs = form.getElementsByTagName('input'); |
942 |
radios = new Array(); |
|
943 |
for(var i in inputs) |
|
944 |
{ |
|
945 |
if(inputs[i]) if(inputs[i].type == 'radio') |
|
946 |
radios.push(inputs[i]); |
|
947 |
} |
|
948 |
for(var i in radios) |
|
949 |
{ |
|
950 |
if(radios[i].checked && radios[i].name == name) |
|
951 |
return radios[i].value; |
|
952 |
} |
|
953 |
return false; |
|
954 |
} |
|
955 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
956 |
function __aclSetAllRadios(val, valArray) |
1 | 957 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
958 |
val = String(val); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
959 |
var form = document.forms[aclManagerID + '_formobj']; |
1 | 960 |
if (!form) |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
961 |
{ |
1 | 962 |
return false; |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
963 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
964 |
var inputs = form.getElementsByTagName('input'); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
965 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
966 |
var dbg = ''; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
967 |
for(var i = 0; i < inputs.length; i++) |
1 | 968 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
969 |
dbg += String(inputs[i]) + "\n"; |
1 | 970 |
if(inputs[i].type == 'radio') |
971 |
radios.push(inputs[i]); |
|
972 |
} |
|
973 |
for(var i in radios) |
|
974 |
{ |
|
975 |
if(radios[i].value == val) |
|
976 |
radios[i].checked = true; |
|
977 |
else |
|
978 |
radios[i].checked = false; |
|
979 |
} |
|
980 |
} |
|
981 |
||
982 |
function __aclDeleteRule() |
|
983 |
{ |
|
42
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
984 |
if(!aclDataCache) |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
985 |
{ |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
986 |
if ( window.console ) |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
987 |
{ |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
988 |
try{ console.error('ACL editor: can\'t load data cache on delete'); } catch(e) {}; |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
989 |
} |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
990 |
return false; |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
991 |
} |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
992 |
if(aclDataCache.mode != 'seltarget' && aclDataCache.mode != 'save_new' && aclDataCache.mode != 'save_edit') |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
993 |
{ |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
994 |
if ( window.console ) |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
995 |
{ |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
996 |
try{ console.error('ACL editor: wrong mode on aclDataCache: ' + aclDataCache.mode); } catch(e) {}; |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
997 |
} |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
998 |
return false; |
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
999 |
} |
1 | 1000 |
parms = { |
1001 |
'target_type' : aclDataCache.target_type, |
|
1002 |
'target_id' : aclDataCache.target_id, |
|
1003 |
'target_name' : aclDataCache.target_name, |
|
1004 |
'page_id' : aclDataCache.page_id, |
|
1005 |
'namespace' : aclDataCache.namespace, |
|
1006 |
'mode' : 'delete' |
|
1007 |
}; |
|
1008 |
__aclJSONSubmitAjaxHandler(parms); |
|
1009 |
} |
|
1010 |
||
513 | 1011 |
function aclSetViewListExisting() |
1012 |
{ |
|
1013 |
if ( !document.getElementById(aclManagerID) ) |
|
1014 |
{ |
|
1015 |
return false; |
|
1016 |
} |
|
1017 |
||
1018 |
var main = document.getElementById(aclManagerID + '_main'); |
|
1019 |
main.innerHTML = ''; |
|
1020 |
main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)'; |
|
1021 |
main.style.backgroundRepeat = 'no-repeat'; |
|
1022 |
main.style.backgroundPosition = 'center center'; |
|
1023 |
||
1024 |
var parms = { |
|
1025 |
'mode' : 'list_existing' |
|
1026 |
}; |
|
1027 |
__aclJSONSubmitAjaxHandler(parms); |
|
1028 |
} |
|
1029 |
||
1030 |
function aclSetViewListExistingRespond(data) |
|
1031 |
{ |
|
1032 |
var main = document.getElementById(aclManagerID + '_main'); |
|
1033 |
main.style.padding = '10px'; |
|
1034 |
main.innerHTML = ''; |
|
1035 |
||
1036 |
var heading = document.createElement('h3'); |
|
1037 |
heading.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_title'))); |
|
1038 |
main.appendChild(heading); |
|
1039 |
||
1040 |
var p = document.createElement('p'); |
|
1041 |
p.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_body'))); |
|
1042 |
main.appendChild(p); |
|
1043 |
||
1044 |
||
1045 |
main.innerHTML += data.key; |
|
1046 |
main.style.backgroundImage = 'none'; |
|
1047 |
||
1048 |
document.getElementById(aclManagerID + '_back').style.display = 'inline'; |
|
1049 |
document.getElementById(aclManagerID + '_next').style.display = 'none'; |
|
1050 |
||
1051 |
for ( var i = 0; i < data.rules.length; i++ ) |
|
1052 |
{ |
|
1053 |
var rule = data.rules[i]; |
|
1054 |
// build the rule, this is just more boring DOM crap. |
|
1055 |
var div = document.createElement('div'); |
|
1056 |
div.style.padding = '5px 3px'; |
|
1057 |
div.style.backgroundColor = '#' + rule.color; |
|
1058 |
div.style.cursor = 'pointer'; |
|
1059 |
div.rule_id = rule.rule_id; |
|
1060 |
div.onclick = function() |
|
1061 |
{ |
|
1062 |
var main = document.getElementById(aclManagerID + '_main'); |
|
1063 |
main.innerHTML = ''; |
|
1064 |
main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)'; |
|
1065 |
ajaxOpenDirectACLRule(parseInt(this.rule_id)); |
|
1066 |
} |
|
1067 |
div.innerHTML = rule.score_string; |
|
1068 |
main.appendChild(div); |
|
1069 |
} |
|
1070 |
} |
|
1071 |
||
679 | 1072 |
function aclShowPresetLoader() |
1073 |
{ |
|
1074 |
var prompt = miniPrompt(function(parent) |
|
1075 |
{ |
|
1076 |
parent.innerHTML = '<img style="display: block; margin: 0 auto;" src="' + cdnPath + '/images/loading-big.gif" />'; |
|
1077 |
}); |
|
1078 |
var request = toJSONString({ |
|
1079 |
mode: 'list_presets' |
|
1080 |
}); |
|
1081 |
ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(request), function() |
|
1082 |
{ |
|
1083 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
|
1084 |
{ |
|
1085 |
if ( !check_json_response(ajax.responseText) ) |
|
1086 |
{ |
|
1087 |
miniPromptDestroy(prompt); |
|
1088 |
return handle_invalid_json(ajax.responseText); |
|
1089 |
} |
|
1090 |
var response = parseJSON(ajax.responseText); |
|
1091 |
if ( response.mode == 'error' ) |
|
1092 |
{ |
|
1093 |
alert(response.error); |
|
1094 |
miniPromptDestroy(prompt); |
|
1095 |
return false; |
|
1096 |
} |
|
1097 |
prompt = prompt.firstChild.nextSibling; |
|
1098 |
prompt.style.textAlign = 'center'; |
|
1099 |
prompt.innerHTML = '<h3>' + $lang.get('acl_lbl_preset_load_title') + '</h3>'; |
|
1100 |
||
1101 |
if ( response.presets.length > 0 ) |
|
1102 |
{ |
|
1103 |
// selection box |
|
1104 |
var para = document.createElement('p'); |
|
1105 |
var select = document.createElement('select'); |
|
1106 |
||
1107 |
var option = document.createElement('option'); |
|
1108 |
option.value = '0'; |
|
1109 |
option.appendChild(document.createTextNode($lang.get('acl_lbl_preset_load'))); |
|
1110 |
select.appendChild(option); |
|
1111 |
||
1112 |
for ( var i = 0; i < response.presets.length; i++ ) |
|
1113 |
{ |
|
1114 |
var preset = response.presets[i]; |
|
1115 |
var option = document.createElement('option'); |
|
1116 |
option.value = preset.rule_id; |
|
1117 |
option.preset_data = preset; |
|
1118 |
option.appendChild(document.createTextNode($lang.get(preset.preset_name))); |
|
1119 |
select.appendChild(option); |
|
1120 |
} |
|
1121 |
||
1122 |
para.appendChild(select); |
|
1123 |
prompt.appendChild(para); |
|
1124 |
||
1125 |
// buttons |
|
1126 |
var buttons = document.createElement('p'); |
|
1127 |
||
1128 |
// load button |
|
1129 |
var btn_load = document.createElement('a'); |
|
1130 |
btn_load.className = 'abutton abutton_green'; |
|
1131 |
btn_load.style.fontWeight = 'bold'; |
|
1132 |
btn_load.appendChild(document.createTextNode($lang.get('acl_btn_load_preset'))); |
|
1133 |
btn_load.selectobj = select; |
|
1134 |
btn_load.onclick = function() |
|
1135 |
{ |
|
1136 |
if ( this.selectobj.value == '0' ) |
|
1137 |
{ |
|
1138 |
alert($lang.get('acl_err_select_preset')); |
|
1139 |
return false; |
|
1140 |
} |
|
1141 |
// retrieve preset data |
|
1142 |
for ( var i = 0; i < this.selectobj.childNodes.length; i++ ) |
|
1143 |
{ |
|
1144 |
if ( this.selectobj.childNodes[i].tagName == 'OPTION' ) |
|
1145 |
{ |
|
1146 |
var node = this.selectobj.childNodes[i]; |
|
1147 |
if ( node.value == this.selectobj.value ) |
|
1148 |
{ |
|
1149 |
aclSetRulesAbsolute(node.preset_data.rules); |
|
1150 |
break; |
|
1151 |
} |
|
1152 |
} |
|
1153 |
} |
|
1154 |
miniPromptDestroy(this); |
|
1155 |
return false; |
|
1156 |
} |
|
1157 |
btn_load.href = '#'; |
|
1158 |
buttons.appendChild(btn_load); |
|
1159 |
||
1160 |
buttons.appendChild(document.createTextNode(' ')); |
|
1161 |
||
1162 |
// cancel button |
|
1163 |
var btn_cancel = document.createElement('a'); |
|
1164 |
btn_cancel.className = 'abutton'; |
|
1165 |
btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel'))); |
|
1166 |
btn_cancel.onclick = function() |
|
1167 |
{ |
|
1168 |
miniPromptDestroy(this); |
|
1169 |
return false; |
|
1170 |
} |
|
1171 |
btn_cancel.href = '#'; |
|
1172 |
buttons.appendChild(btn_cancel); |
|
1173 |
||
1174 |
prompt.appendChild(buttons); |
|
1175 |
} |
|
1176 |
else |
|
1177 |
{ |
|
1178 |
// "no presets" |
|
1179 |
prompt.innerHTML += '<p>' + $lang.get('acl_msg_no_presets', { close_flags: 'href="#" onclick="miniPromptDestroy(this); return false;"' }) + '</p>'; |
|
1180 |
} |
|
1181 |
} |
|
1182 |
}); |
|
1183 |
} |
|
1184 |
||
1185 |
function aclSetRulesAbsolute(rules) |
|
1186 |
{ |
|
1187 |
__aclSetAllRadios('i'); |
|
1188 |
||
1189 |
var form = document.forms[aclManagerID + '_formobj']; |
|
1190 |
if (!form) |
|
1191 |
{ |
|
1192 |
return false; |
|
1193 |
} |
|
1194 |
var inputs = form.getElementsByTagName('input'); |
|
1195 |
var radios = new Array(); |
|
1196 |
var dbg = ''; |
|
1197 |
for(var i = 0; i < inputs.length; i++) |
|
1198 |
{ |
|
1199 |
if(inputs[i].type == 'radio') |
|
1200 |
radios.push(inputs[i]); |
|
1201 |
} |
|
1202 |
for(var i in radios) |
|
1203 |
{ |
|
1204 |
if ( typeof(rules[ radios[i]['name'] ]) == 'number' ) |
|
1205 |
{ |
|
1206 |
radios[i].checked = ( rules[radios[i]['name']] == radios[i].value ); |
|
1207 |
} |
|
1208 |
} |
|
1209 |
} |
|
1210 |
||
1211 |
function aclShowPresetSave() |
|
1212 |
{ |
|
1213 |
miniPrompt(function(parent) |
|
1214 |
{ |
|
1215 |
parent.style.textAlign = 'center'; |
|
1216 |
||
1217 |
parent.innerHTML = '<h3>' + $lang.get('acl_lbl_preset_save_title') + '</h3>'; |
|
1218 |
var input = document.createElement('input'); |
|
1219 |
input.id = aclManagerID + '_preset_save'; |
|
1220 |
input.type = 'text'; |
|
1221 |
input.size = '30'; |
|
1222 |
input.onkeypress = function(e) |
|
1223 |
{ |
|
1224 |
// javascript sucks. IE and several others throw myriad errors unless it's done this way. |
|
1225 |
if ( e ) |
|
1226 |
if ( e.keyCode ) |
|
1227 |
if ( e.keyCode == 13 ) |
|
1228 |
{ |
|
1229 |
if ( aclSavePreset() ) |
|
1230 |
{ |
|
1231 |
miniPromptDestroy(this); |
|
1232 |
} |
|
1233 |
} |
|
1234 |
else if ( e.keyCode == 27 ) |
|
1235 |
{ |
|
1236 |
miniPromptDestroy(this); |
|
1237 |
} |
|
1238 |
} |
|
1239 |
var para = document.createElement('p'); |
|
1240 |
para.appendChild(input); |
|
1241 |
||
1242 |
parent.appendChild(para); |
|
1243 |
||
1244 |
// buttons |
|
1245 |
var buttons = document.createElement('p'); |
|
1246 |
||
1247 |
// save button |
|
1248 |
var btn_save = document.createElement('a'); |
|
1249 |
btn_save.className = 'abutton abutton_green'; |
|
1250 |
btn_save.style.fontWeight = 'bold'; |
|
1251 |
btn_save.appendChild(document.createTextNode($lang.get('acl_btn_save_preset'))); |
|
1252 |
btn_save.selectobj = select; |
|
1253 |
btn_save.onclick = function() |
|
1254 |
{ |
|
1255 |
if ( aclSavePreset() ) |
|
1256 |
{ |
|
1257 |
miniPromptDestroy(this); |
|
1258 |
} |
|
1259 |
return false; |
|
1260 |
} |
|
1261 |
btn_save.href = '#'; |
|
1262 |
buttons.appendChild(btn_save); |
|
1263 |
||
1264 |
buttons.appendChild(document.createTextNode(' ')); |
|
1265 |
||
1266 |
// cancel button |
|
1267 |
var btn_cancel = document.createElement('a'); |
|
1268 |
btn_cancel.className = 'abutton'; |
|
1269 |
btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel'))); |
|
1270 |
btn_cancel.onclick = function() |
|
1271 |
{ |
|
1272 |
miniPromptDestroy(this); |
|
1273 |
return false; |
|
1274 |
} |
|
1275 |
btn_cancel.href = '#'; |
|
1276 |
buttons.appendChild(btn_cancel); |
|
1277 |
||
1278 |
parent.appendChild(buttons); |
|
1279 |
||
1280 |
var timeout = ( aclDisableTransitionFX ) ? 10 : 1000; |
|
1281 |
setTimeout(function() |
|
1282 |
{ |
|
1283 |
input.focus(); |
|
1284 |
}, timeout); |
|
1285 |
}); |
|
1286 |
} |
|
1287 |
||
1288 |
function aclSavePreset() |
|
1289 |
{ |
|
1290 |
var input = document.getElementById(aclManagerID + '_preset_save'); |
|
1291 |
if ( trim(input.value) == '' ) |
|
1292 |
{ |
|
1293 |
alert($lang.get('acl_err_preset_name_empty')); |
|
1294 |
return false; |
|
1295 |
} |
|
1296 |
var form = document.forms[aclManagerID + '_formobj'], selections = {}; |
|
1297 |
var dbg = ''; |
|
1298 |
var warned_everyone = false; |
|
1299 |
for(var i in aclPermList) |
|
1300 |
{ |
|
1301 |
selections[aclPermList[i]] = getRadioState(form, aclPermList[i], ['i', 1, 2, 3, 4]); |
|
1302 |
// If we're editing permissions for everyone on the entire site and the |
|
1303 |
// admin selected to deny privileges, give a stern warning about it. |
|
1304 |
if ( selections[aclPermList[i]] == 1 && aclDataCache.target_type == 1 /* ACL_TYPE_GROUP */ && aclDataCache.target_id == 1 && !warned_everyone ) |
|
1305 |
{ |
|
1306 |
warned_everyone = true; |
|
1307 |
if ( !confirm($lang.get('acl_msg_deny_everyone_confirm')) ) |
|
1308 |
{ |
|
1309 |
return false; |
|
1310 |
} |
|
1311 |
} |
|
1312 |
dbg += aclPermList[i] + ': ' + selections[aclPermList[i]] + "\n"; |
|
1313 |
if(!selections[aclPermList[i]]) |
|
1314 |
{ |
|
1315 |
alert("Invalid return from getRadioState: "+i+": "+selections[i]+" ("+typeof(selections[i])+")"); |
|
1316 |
return false; |
|
1317 |
} |
|
1318 |
} |
|
1319 |
||
1320 |
var packet = toJSONString({ |
|
1321 |
mode: 'save_preset', |
|
1322 |
preset_name: input.value, |
|
1323 |
perms: selections |
|
1324 |
}); |
|
1325 |
||
1326 |
var whitey = whiteOutElement(document.getElementById(aclManagerID)); |
|
1327 |
||
1328 |
ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(packet), function() |
|
1329 |
{ |
|
1330 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
|
1331 |
{ |
|
1332 |
if ( !check_json_response(ajax.responseText) ) |
|
1333 |
{ |
|
1334 |
whitey.parentNode.removeChild(whitey); |
|
1335 |
return handle_invalid_json(ajax.responseText); |
|
1336 |
} |
|
1337 |
var response = parseJSON(ajax.responseText); |
|
1338 |
if ( response.mode == 'error' ) |
|
1339 |
{ |
|
1340 |
whitey.parentNode.removeChild(whitey); |
|
1341 |
alert(response.error); |
|
1342 |
return false; |
|
1343 |
} |
|
1344 |
whiteOutReportSuccess(whitey); |
|
1345 |
} |
|
1346 |
}); |
|
1347 |
||
1348 |
return true; |
|
1349 |
} |
|
1350 |
||
1 | 1351 |
function array_keys(obj) |
1352 |
{ |
|
1353 |
keys = new Array(); |
|
1354 |
for(var i in obj) |
|
1355 |
keys.push(i); |
|
1356 |
return keys; |
|
1357 |
} |