author | Dan |
Wed, 11 Jul 2007 13:08:34 -0400 | |
changeset 63 | 2c57d3018a88 |
parent 42 | 45ebe475ff75 |
child 73 | 0a74676a2f2f |
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; |
|
11 |
if(!page_id || !namespace) |
|
12 |
{ |
|
13 |
var data = strToPageID(title); |
|
14 |
var page_id = data[0]; |
|
15 |
var namespace = data[1]; |
|
16 |
} |
|
17 |
var params = { |
|
18 |
'mode' : 'listgroups', |
|
19 |
'page_id' : page_id, |
|
20 |
'namespace' : namespace |
|
21 |
}; |
|
22 |
params = toJSONString(params); |
|
23 |
params = ajaxEscape(params); |
|
24 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
|
25 |
if(ajax.readyState == 4) |
|
26 |
{ |
|
27 |
__aclBuildWizardWindow(); |
|
28 |
groups = parseJSON(ajax.responseText); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
29 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
30 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
31 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
32 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
33 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
34 |
} |
1 | 35 |
aclDataCache = groups; |
36 |
__aclBuildSelector(groups); |
|
37 |
} |
|
38 |
}); |
|
39 |
return false; |
|
40 |
} |
|
41 |
||
42 |
function ajaxACLSwitchToSelector() |
|
43 |
{ |
|
44 |
params = { |
|
45 |
'mode' : 'listgroups' |
|
46 |
}; |
|
47 |
if ( aclDataCache.page_id && aclDataCache.namespace ) |
|
48 |
{ |
|
49 |
params.page_id = aclDataCache.page_id; |
|
50 |
params.namespace = aclDataCache.namespace; |
|
51 |
} |
|
52 |
params = toJSONString(params); |
|
53 |
params = ajaxEscape(params); |
|
54 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
|
55 |
if(ajax.readyState == 4) |
|
56 |
{ |
|
57 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
58 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
59 |
document.getElementById(aclManagerID + '_next').value = 'Next >'; |
|
60 |
groups = parseJSON(ajax.responseText); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
61 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
62 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
63 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
64 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
65 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
66 |
} |
1 | 67 |
aclDataCache = groups; |
68 |
thispage = strToPageID(title); |
|
69 |
groups.page_id = thispage[0]; |
|
70 |
groups.namespace = thispage[1]; |
|
71 |
__aclBuildSelector(groups); |
|
72 |
} |
|
73 |
}); |
|
74 |
} |
|
75 |
||
76 |
function __aclBuildSelector(groups) |
|
77 |
{ |
|
78 |
thispage = strToPageID(title); |
|
79 |
do_scopesel = ( thispage[0] == groups.page_id && thispage[1] == groups.namespace ); |
|
80 |
||
81 |
seed = Math.floor(Math.random() * 1000000); |
|
82 |
||
83 |
main = document.getElementById(aclManagerID + '_main'); |
|
84 |
main.style.padding = '10px'; |
|
85 |
||
86 |
selector = document.createElement('div'); |
|
87 |
||
88 |
grpsel = __aclBuildGroupsHTML(groups); |
|
89 |
grpsel.name = 'group_id'; |
|
90 |
||
91 |
span = document.createElement('div'); |
|
92 |
span.id = "enACL_grpbox_"+seed+""; |
|
93 |
||
94 |
// Build the selector |
|
95 |
grpb = document.createElement('input'); |
|
96 |
grpb.type = 'radio'; |
|
97 |
grpb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
98 |
grpb.value = '1'; // ACL_TYPE_GROUP |
1 | 99 |
grpb.checked = 'checked'; |
100 |
grpb.className = seed; |
|
101 |
grpb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'block'; document.getElementById('enACL_usrbox_'+seed).style.display = 'none'; }; |
|
102 |
lbl = document.createElement('label'); |
|
103 |
lbl.appendChild(grpb); |
|
104 |
lbl.appendChild(document.createTextNode('A usergroup')); |
|
105 |
lbl.style.display = 'block'; |
|
106 |
span.appendChild(grpsel); |
|
107 |
||
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
|
108 |
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
|
109 |
anoninfo.className = 'info-box-mini'; |
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
|
110 |
anoninfo.appendChild(document.createTextNode('To edit permissions for guests, select "a specific user", and enter Anonymous as the username.')); |
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
|
111 |
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
|
112 |
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
|
113 |
|
1 | 114 |
usrb = document.createElement('input'); |
115 |
usrb.type = 'radio'; |
|
116 |
usrb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
117 |
usrb.value = '2'; // ACL_TYPE_USER |
1 | 118 |
usrb.className = seed; |
119 |
usrb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'none'; document.getElementById('enACL_usrbox_'+seed).style.display = 'block'; }; |
|
120 |
lbl2 = document.createElement('label'); |
|
121 |
lbl2.appendChild(usrb); |
|
122 |
lbl2.appendChild(document.createTextNode('A specific user')); |
|
123 |
lbl2.style.display = 'block'; |
|
124 |
||
125 |
usrsel = document.createElement('input'); |
|
126 |
usrsel.type = 'text'; |
|
127 |
usrsel.name = 'username'; |
|
128 |
usrsel.onkeyup = function() { ajaxUserNameComplete(this); }; |
|
129 |
usrsel.id = 'userfield_' + aclManagerID; |
|
130 |
try { |
|
131 |
usrsel.setAttribute("autocomplete","off"); |
|
132 |
} catch(e) {}; |
|
133 |
||
134 |
span2 = document.createElement('div'); |
|
135 |
span2.id = "enACL_usrbox_"+seed+""; |
|
136 |
span2.style.display = 'none'; |
|
137 |
span2.appendChild(usrsel); |
|
138 |
||
139 |
// Scope selector |
|
140 |
if(do_scopesel) |
|
141 |
{ |
|
142 |
scopediv1 = document.createElement('div'); |
|
143 |
scopediv2 = document.createElement('div'); |
|
144 |
scopeRadioPage = document.createElement('input'); |
|
145 |
scopeRadioPage.type = 'radio'; |
|
146 |
scopeRadioPage.name = 'scope'; |
|
147 |
scopeRadioPage.value = 'page'; |
|
148 |
scopeRadioPage.checked = 'checked'; |
|
149 |
scopeRadioGlobal = document.createElement('input'); |
|
150 |
scopeRadioGlobal.type = 'radio'; |
|
151 |
scopeRadioGlobal.name = 'scope'; |
|
152 |
scopeRadioGlobal.value = 'global'; |
|
153 |
lblPage = document.createElement('label'); |
|
154 |
lblPage.style.display = 'block'; |
|
155 |
lblPage.appendChild(scopeRadioPage); |
|
156 |
lblPage.appendChild(document.createTextNode('Only this page')); |
|
157 |
lblGlobal = document.createElement('label'); |
|
158 |
lblGlobal.style.display = 'block'; |
|
159 |
lblGlobal.appendChild(scopeRadioGlobal); |
|
160 |
lblGlobal.appendChild(document.createTextNode('The entire website')); |
|
161 |
scopediv1.appendChild(lblPage); |
|
162 |
scopediv2.appendChild(lblGlobal); |
|
163 |
||
164 |
scopedesc = document.createElement('p'); |
|
165 |
scopedesc.appendChild(document.createTextNode('What should this access rule control?')); |
|
166 |
} |
|
167 |
||
168 |
// Styles |
|
169 |
span.style.marginLeft = '13px'; |
|
170 |
span.style.padding = '5px 0'; |
|
171 |
span2.style.marginLeft = '13px'; |
|
172 |
span2.style.padding = '5px 0'; |
|
173 |
||
174 |
selector.appendChild(lbl); |
|
175 |
selector.appendChild(span); |
|
176 |
||
177 |
selector.appendChild(lbl2); |
|
178 |
selector.appendChild(span2); |
|
179 |
||
180 |
container = document.createElement('div'); |
|
181 |
container.style.margin = 'auto'; |
|
182 |
container.style.width = '360px'; |
|
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
|
183 |
container.style.paddingTop = '100px'; |
1 | 184 |
|
185 |
head = document.createElement('h2'); |
|
186 |
head.appendChild(document.createTextNode('Manage page access')); |
|
187 |
||
188 |
desc = document.createElement('p'); |
|
189 |
desc.appendChild(document.createTextNode('Please select who should be affected by this access rule.')); |
|
190 |
||
191 |
container.appendChild(head); |
|
192 |
container.appendChild(desc); |
|
193 |
container.appendChild(selector); |
|
194 |
||
195 |
if(do_scopesel) |
|
196 |
{ |
|
197 |
container.appendChild(scopedesc); |
|
198 |
container.appendChild(scopediv1); |
|
199 |
container.appendChild(scopediv2); |
|
200 |
} |
|
201 |
||
202 |
main.appendChild(container); |
|
203 |
||
204 |
var mode = document.createElement('input'); |
|
205 |
mode.name = 'mode'; |
|
206 |
mode.type = 'hidden'; |
|
207 |
mode.id = aclManagerID + '_mode'; |
|
208 |
mode.value = 'seltarget'; |
|
209 |
||
210 |
var theform = document.getElementById(aclManagerID + '_formobj_id'); |
|
211 |
if ( !theform.mode ) |
|
212 |
{ |
|
213 |
theform.appendChild(mode); |
|
214 |
} |
|
215 |
else |
|
216 |
{ |
|
217 |
theform.removeChild(theform.mode); |
|
218 |
theform.appendChild(mode); |
|
219 |
} |
|
220 |
} |
|
221 |
||
222 |
var aclDebugWin = false; |
|
223 |
||
224 |
function aclDebug(text) |
|
225 |
{ |
|
226 |
if(!aclDebugWin) |
|
227 |
aclDebugWin = pseudoWindowOpen("data:text/html;plain,<html><head><title>debug win</title></head><body><h1>Debug window</h1></body></html>", "aclDebugWin"); |
|
228 |
setTimeout(function() { |
|
229 |
aclDebugWin.pre = aclDebugWin.document.createElement('pre'); |
|
230 |
aclDebugWin.pre.appendChild(aclDebugWin.document.createTextNode(text)); |
|
231 |
aclDebugWin.b = aclDebugWin.document.getElementsByTagName('body')[0]; |
|
232 |
aclDebugWin.b.appendChild(aclDebugWin.pre);}, 1000); |
|
233 |
} |
|
234 |
||
235 |
var pseudoWindows = new Object(); |
|
236 |
||
237 |
function pseudoWindowOpen(url, id) |
|
238 |
{ |
|
239 |
if(pseudoWindows[id]) |
|
240 |
{ |
|
241 |
document.getElementById('pseudowin_ifr_'+id).src = url; |
|
242 |
} |
|
243 |
else |
|
244 |
{ |
|
245 |
win = document.createElement('iframe'); |
|
246 |
win.style.position='fixed'; |
|
247 |
win.style.width = '640px'; |
|
248 |
win.style.height = '480px'; |
|
249 |
win.style.top = '0px'; |
|
250 |
win.style.left = '0px'; |
|
251 |
win.style.zIndex = getHighestZ() + 1; |
|
252 |
win.style.backgroundColor = '#FFFFFF'; |
|
253 |
win.name = 'pseudo_ifr_'+id; |
|
254 |
win.id = 'pseudowindow_ifr_'+id; |
|
255 |
win.src = url; |
|
256 |
body = document.getElementsByTagName('body')[0]; |
|
257 |
body.appendChild(win); |
|
258 |
} |
|
259 |
win_obj = eval("( pseudo_ifr_"+id+" )"); |
|
260 |
return win_obj; |
|
261 |
} |
|
262 |
||
263 |
function __aclJSONSubmitAjaxHandler(params) |
|
264 |
{ |
|
265 |
params = toJSONString(params); |
|
266 |
params = ajaxEscape(params); |
|
267 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
|
268 |
if(ajax.readyState == 4) |
|
269 |
{ |
|
270 |
try { |
|
271 |
data = parseJSON(ajax.responseText); |
|
272 |
} catch(e) { |
|
273 |
aclDebug(e+"\n\nResponse:\n"+ajax.responseText); |
|
274 |
} |
|
275 |
aclDataCache = data; |
|
276 |
switch(data.mode) |
|
277 |
{ |
|
278 |
case 'seltarget': |
|
279 |
||
280 |
// Build the ACL edit form |
|
281 |
// try { |
|
282 |
act_desc = ( data.type == 'new' ) ? 'Create access rule' : 'Editing permissions'; |
|
283 |
target_type_t = ( data.target_type == 1 ) ? 'group' : 'user'; |
|
284 |
target_name_t = data.target_name; |
|
285 |
var scope_type = ( data.page_id == false && data.namespace == false ) ? 'this entire site' : 'this page'; |
|
286 |
html = '<h2>'+act_desc+'</h2><p>This panel allows you to edit what the '+target_type_t+' "<b>'+target_name_t+'</b>" can do on <b>' + scope_type + '</b>. Unless you set a permission to "Deny", these permissions may be overridden by other rules.</p>'; |
|
287 |
parser = new templateParser(data.template.acl_field_begin); |
|
288 |
html += parser.run(); |
|
289 |
||
290 |
cls = 'row2'; |
|
291 |
for(var i in data.acl_types) |
|
292 |
{ |
|
293 |
if(typeof(data.acl_types[i]) == 'number') |
|
294 |
{ |
|
295 |
cls = ( cls == 'row1' ) ? 'row2' : 'row1'; |
|
296 |
p = new templateParser(data.template.acl_field_item); |
|
297 |
vars = new Object(); |
|
298 |
vars['FIELD_DESC'] = data.acl_descs[i]; |
|
299 |
vars['FIELD_DENY_CHECKED'] = ''; |
|
300 |
vars['FIELD_DISALLOW_CHECKED'] = ''; |
|
301 |
vars['FIELD_WIKIMODE_CHECKED'] = ''; |
|
302 |
vars['FIELD_ALLOW_CHECKED'] = ''; |
|
303 |
vars['FIELD_NAME'] = i; |
|
304 |
switch(data.current_perms[i]) |
|
305 |
{ |
|
306 |
case 1: |
|
307 |
vars['FIELD_DENY_CHECKED'] = 'checked="checked"'; |
|
308 |
break; |
|
309 |
case 2: |
|
310 |
default: |
|
311 |
vars['FIELD_DISALLOW_CHECKED'] = 'checked="checked"'; |
|
312 |
break; |
|
313 |
case 3: |
|
314 |
vars['FIELD_WIKIMODE_CHECKED'] = 'checked="checked"'; |
|
315 |
break; |
|
316 |
case 4: |
|
317 |
vars['FIELD_ALLOW_CHECKED'] = 'checked="checked"'; |
|
318 |
break; |
|
319 |
} |
|
320 |
vars['ROW_CLASS'] = cls; |
|
321 |
p.assign_vars(vars); |
|
322 |
html += p.run(); |
|
323 |
} |
|
324 |
} |
|
325 |
||
326 |
var parser = new templateParser(data.template.acl_field_end); |
|
327 |
html += parser.run(); |
|
328 |
||
329 |
if(data.type == 'edit') |
|
330 |
html += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'Do you really want to delete this rule?\')) __aclDeleteRule(); return false;" style="color: red;">Delete this rule</a></p>'; |
|
331 |
||
332 |
var main = document.getElementById(aclManagerID + '_main'); |
|
333 |
main.innerHTML = html; |
|
334 |
||
335 |
var form = document.getElementById(aclManagerID + '_formobj_id'); |
|
336 |
||
337 |
var modeobj = form_fetch_field(form, 'mode'); |
|
338 |
if ( modeobj ) |
|
339 |
modeobj.value = 'save_' + data.type; |
|
340 |
else |
|
341 |
alert('modeobj is invalid: '+modeobj); |
|
342 |
||
343 |
aclPermList = array_keys(data.acl_types); |
|
344 |
||
345 |
document.getElementById(aclManagerID + '_back').style.display = 'inline'; |
|
346 |
document.getElementById(aclManagerID + '_next').value = 'Save Changes'; |
|
347 |
||
348 |
// } catch(e) { alert(e); aclDebug(ajax.responseText); } |
|
349 |
||
350 |
break; |
|
351 |
case 'success': |
|
352 |
var note = document.createElement('div'); |
|
353 |
note.className = 'info-box'; |
|
354 |
note.style.marginLeft = '0'; |
|
355 |
var b = document.createElement('b'); |
|
356 |
b.appendChild(document.createTextNode('Permissions updated')); |
|
357 |
note.appendChild(b); |
|
358 |
note.appendChild(document.createElement('br')); |
|
359 |
note.appendChild(document.createTextNode('The permissions for '+data.target_name+' on this page have been updated successfully.')); |
|
360 |
note.appendChild(document.createElement('br')); |
|
361 |
var a = document.createElement('a'); |
|
362 |
a.href = 'javascript:void(0);'; |
|
363 |
a.onclick = function() { this.parentNode.parentNode.removeChild(this.parentNode); return false; }; |
|
364 |
a.appendChild(document.createTextNode('[ dismiss :')); |
|
365 |
note.appendChild(a); |
|
366 |
var a2 = document.createElement('a'); |
|
367 |
a2.href = 'javascript:void(0);'; |
|
368 |
a2.onclick = function() { killACLManager(); return false; }; |
|
369 |
a2.appendChild(document.createTextNode(': close manager ]')); |
|
370 |
note.appendChild(a2); |
|
371 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
|
372 |
if(!document.getElementById(aclManagerID+'_deletelnk')) |
|
373 |
document.getElementById(aclManagerID + '_main').innerHTML += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'Do you really want to delete this rule?\')) __aclDeleteRule(); return false;" style="color: red;">Delete this rule</a></p>'; |
|
374 |
//fadeInfoBoxes(); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
375 |
document.getElementById(aclManagerID+'_main').scrollTop = 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
|
376 |
|
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
|
377 |
aclDataCache.mode = 'save_edit'; |
1 | 378 |
break; |
379 |
case 'delete': |
|
380 |
||
381 |
params = { |
|
382 |
'mode' : 'listgroups' |
|
383 |
}; |
|
384 |
params = toJSONString(params); |
|
385 |
params = ajaxEscape(params); |
|
386 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
|
387 |
if(ajax.readyState == 4) |
|
388 |
{ |
|
389 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
390 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
391 |
document.getElementById(aclManagerID + '_next').value = 'Next >'; |
|
392 |
var thispage = strToPageID(title); |
|
393 |
groups.page_id = thispage[0]; |
|
394 |
groups.namespace = thispage[1]; |
|
395 |
__aclBuildSelector(groups); |
|
396 |
||
397 |
note = document.createElement('div'); |
|
398 |
note.className = 'info-box'; |
|
399 |
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
|
400 |
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
|
401 |
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
|
402 |
note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000); |
1 | 403 |
b = document.createElement('b'); |
404 |
b.appendChild(document.createTextNode('Entry deleted')); |
|
405 |
note.appendChild(b); |
|
406 |
note.appendChild(document.createElement('br')); |
|
407 |
note.appendChild(document.createTextNode('The access rules for '+aclDataCache.target_name+' on this page have been deleted.')); |
|
408 |
note.appendChild(document.createElement('br')); |
|
409 |
a = document.createElement('a'); |
|
410 |
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
|
411 |
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; }; |
1 | 412 |
a.appendChild(document.createTextNode('[ dismiss :')); |
413 |
note.appendChild(a); |
|
414 |
a = document.createElement('a'); |
|
415 |
a.href = '#'; |
|
416 |
a.onclick = function() { killACLManager(); return false; }; |
|
417 |
a.appendChild(document.createTextNode(': close manager ]')); |
|
418 |
note.appendChild(a); |
|
419 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
|
420 |
//fadeInfoBoxes(); |
|
421 |
||
422 |
} |
|
423 |
}); |
|
424 |
||
425 |
break; |
|
426 |
case 'error': |
|
427 |
alert("Server side processing error:\n"+data.error); |
|
428 |
break; |
|
429 |
case 'debug': |
|
430 |
aclDebug(data.text); |
|
431 |
break; |
|
432 |
default: |
|
433 |
alert("Invalid JSON response from server\nMode: "+data.mode+"\nJSON string: "+ajax.responseText); |
|
434 |
break; |
|
435 |
} |
|
436 |
} |
|
437 |
}); |
|
438 |
} |
|
439 |
||
440 |
function __aclBuildGroupsHTML(groups) |
|
441 |
{ |
|
442 |
groups = groups.groups; |
|
443 |
select = document.createElement('select'); |
|
444 |
for(var i in groups) |
|
445 |
{ |
|
446 |
if(typeof(groups[i]['name']) == 'string' && i != 'toJSONString') |
|
447 |
{ |
|
448 |
o = document.createElement('option'); |
|
449 |
o.value = groups[i]['id']; |
|
450 |
t = document.createTextNode(groups[i]['name']); |
|
451 |
o.appendChild(t); |
|
452 |
select.appendChild(o); |
|
453 |
} |
|
454 |
} |
|
455 |
return select; |
|
456 |
} |
|
457 |
||
458 |
function __aclBuildWizardWindow() |
|
459 |
{ |
|
460 |
darken(); |
|
461 |
box = document.createElement('div'); |
|
462 |
box.style.width = '640px' |
|
463 |
box.style.height = '440px'; |
|
464 |
box.style.position = 'fixed'; |
|
465 |
width = getWidth(); |
|
466 |
height = getHeight(); |
|
467 |
box.style.left = ( width / 2 - 320 ) + 'px'; |
|
468 |
box.style.top = ( height / 2 - 250 ) + 'px'; |
|
469 |
box.style.backgroundColor = 'white'; |
|
470 |
box.style.zIndex = getHighestZ() + 1; |
|
471 |
box.id = aclManagerID; |
|
472 |
box.style.opacity = '0'; |
|
473 |
box.style.filter = 'alpha(opacity=0)'; |
|
474 |
box.style.display = 'none'; |
|
475 |
||
476 |
mainwin = document.createElement('div'); |
|
477 |
mainwin.id = aclManagerID + '_main'; |
|
478 |
mainwin.style.clip = 'rect(0px,640px,440px,0px)'; |
|
479 |
mainwin.style.overflow = 'auto'; |
|
480 |
mainwin.style.width = '620px'; |
|
481 |
mainwin.style.height = '420px'; |
|
482 |
||
483 |
panel = document.createElement('div'); |
|
484 |
panel.style.width = '620px'; |
|
485 |
panel.style.padding = '10px'; |
|
486 |
panel.style.lineHeight = '40px'; |
|
487 |
panel.style.textAlign = 'right'; |
|
488 |
panel.style.position = 'fixed'; |
|
489 |
panel.style.left = ( width / 2 - 320 ) + 'px'; |
|
490 |
panel.style.top = ( height / 2 + 190 ) + 'px'; |
|
491 |
panel.style.backgroundColor = '#D0D0D0'; |
|
492 |
panel.style.opacity = '0'; |
|
493 |
panel.style.filter = 'alpha(opacity=0)'; |
|
494 |
panel.id = aclManagerID + '_panel'; |
|
495 |
||
496 |
form = document.createElement('form'); |
|
497 |
form.method = 'post'; |
|
498 |
form.action = 'javascript:void(0)'; |
|
499 |
form.onsubmit = function() { if(this.username && !submitAuthorized) return false; __aclSubmitManager(this); return false; }; |
|
500 |
form.name = aclManagerID + '_formobj'; |
|
501 |
form.id = aclManagerID + '_formobj_id'; |
|
502 |
||
503 |
back = document.createElement('input'); |
|
504 |
back.type = 'button'; |
|
505 |
back.value = '< Back'; |
|
506 |
back.style.fontWeight = 'normal'; |
|
507 |
back.onclick = function() { ajaxACLSwitchToSelector(); return false; }; |
|
508 |
back.style.display = 'none'; |
|
509 |
back.id = aclManagerID + '_back'; |
|
510 |
||
511 |
saver = document.createElement('input'); |
|
512 |
saver.type = 'submit'; |
|
513 |
saver.value = 'Next >'; |
|
514 |
saver.style.fontWeight = 'bold'; |
|
515 |
saver.id = aclManagerID + '_next'; |
|
516 |
||
517 |
closer = document.createElement('input'); |
|
518 |
closer.type = 'button'; |
|
519 |
closer.value = 'Cancel Changes'; |
|
520 |
closer.onclick = function() { if(!confirm('Do you really want to close the ACL manager?')) return false; killACLManager(); return false; } |
|
521 |
||
522 |
spacer1 = document.createTextNode(' '); |
|
523 |
spacer2 = document.createTextNode(' '); |
|
524 |
||
525 |
panel.appendChild(back); |
|
526 |
panel.appendChild(spacer1); |
|
527 |
panel.appendChild(saver); |
|
528 |
panel.appendChild(spacer2); |
|
529 |
panel.appendChild(closer); |
|
530 |
form.appendChild(mainwin); |
|
531 |
form.appendChild(panel); |
|
532 |
box.appendChild(form); |
|
533 |
||
534 |
body = document.getElementsByTagName('body')[0]; |
|
535 |
body.appendChild(box); |
|
536 |
setTimeout("document.getElementById('"+aclManagerID+"').style.display = 'block'; opacity('"+aclManagerID+"', 0, 100, 500); opacity('"+aclManagerID + '_panel'+"', 0, 100, 500);", 1000); |
|
537 |
} |
|
538 |
||
539 |
function killACLManager() |
|
540 |
{ |
|
541 |
el = document.getElementById(aclManagerID); |
|
542 |
if(el) |
|
543 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
544 |
opacity(aclManagerID, 100, 0, 500); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
545 |
setTimeout('var el = document.getElementById(aclManagerID); el.parentNode.removeChild(el); enlighten();', 750); |
1 | 546 |
} |
547 |
} |
|
548 |
||
549 |
function __aclSubmitManager(form) |
|
550 |
{ |
|
551 |
var thefrm = document.forms[form.name]; |
|
552 |
var modeobj = form_fetch_field(thefrm, 'mode'); |
|
553 |
if ( typeof(modeobj) == 'object' ) |
|
554 |
{ |
|
555 |
var mode = (thefrm.mode.value) ? thefrm.mode.value : 'cant_get'; |
|
556 |
} |
|
557 |
else |
|
558 |
{ |
|
559 |
var mode = ''; |
|
560 |
} |
|
561 |
switch(mode) |
|
562 |
{ |
|
563 |
case 'cant_get': |
|
564 |
alert('BUG: can\'t get the state value from the form field.'); |
|
565 |
break; |
|
566 |
case 'seltarget': |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
567 |
var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2'])); |
1 | 568 |
if(isNaN(target_type)) |
569 |
{ |
|
570 |
alert('Please select a target type.'); |
|
571 |
return false; |
|
572 |
} |
|
573 |
target_id = ( target_type == 1 ) ? parseInt(thefrm.group_id.value) : thefrm.username.value; |
|
574 |
||
575 |
obj = { 'mode' : mode, 'target_type' : target_type, 'target_id' : target_id }; |
|
576 |
||
577 |
thispage = strToPageID(title); |
|
578 |
do_scopesel = ( thispage[0] == aclDataCache.page_id && thispage[1] == aclDataCache.namespace ); |
|
579 |
||
580 |
if(do_scopesel) |
|
581 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
582 |
scope = getRadioState(thefrm, 'scope', ['page', 'global']); |
1 | 583 |
if(scope == 'page') |
584 |
{ |
|
585 |
pageid = strToPageID(title); |
|
586 |
obj['page_id'] = pageid[0]; |
|
587 |
obj['namespace'] = pageid[1]; |
|
588 |
} |
|
589 |
else if(scope == 'global') |
|
590 |
{ |
|
591 |
obj['page_id'] = false; |
|
592 |
obj['namespace'] = false; |
|
593 |
} |
|
594 |
else |
|
595 |
{ |
|
596 |
alert('Invalid scope'); |
|
597 |
return false; |
|
598 |
} |
|
599 |
} |
|
600 |
else |
|
601 |
{ |
|
602 |
obj['page_id'] = aclDataCache.page_id; |
|
603 |
obj['namespace'] = aclDataCache.namespace; |
|
604 |
} |
|
605 |
if(target_id == '') |
|
606 |
{ |
|
607 |
alert('Please enter a username.'); |
|
608 |
return false; |
|
609 |
} |
|
610 |
__aclJSONSubmitAjaxHandler(obj); |
|
611 |
break; |
|
612 |
case 'save_edit': |
|
613 |
case 'save_new': |
|
614 |
var form = document.forms[aclManagerID + '_formobj']; |
|
615 |
selections = new Object(); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
616 |
var dbg = ''; |
1 | 617 |
for(var i in aclPermList) |
618 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
619 |
selections[aclPermList[i]] = getRadioState(form, aclPermList[i], [1, 2, 3, 4]); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
620 |
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
|
621 |
if(!selections[aclPermList[i]]) |
1 | 622 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
623 |
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
|
624 |
return false; |
1 | 625 |
} |
626 |
} |
|
627 |
obj = new Object(); |
|
628 |
obj['perms'] = selections; |
|
629 |
obj['mode'] = mode; |
|
630 |
obj['target_type'] = aclDataCache.target_type; |
|
631 |
obj['target_id'] = aclDataCache.target_id; |
|
632 |
obj['target_name'] = aclDataCache.target_name; |
|
633 |
obj['page_id'] = aclDataCache.page_id; |
|
634 |
obj['namespace'] = aclDataCache.namespace; |
|
635 |
__aclJSONSubmitAjaxHandler(obj); |
|
636 |
break; |
|
637 |
default: |
|
638 |
alert("JSON form submit: invalid mode string "+mode+", stopping execution"); |
|
639 |
return false; |
|
640 |
break; |
|
641 |
} |
|
642 |
} |
|
643 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
644 |
function getRadioState(form, name, valArray) |
1 | 645 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
646 |
// Konqueror/Safari fix |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
647 |
if ( form[name] ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
648 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
649 |
var formitem = form[name]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
650 |
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
|
651 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
652 |
var i = 0; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
653 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
654 |
var radioids = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
655 |
while(true) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
656 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
657 |
var elem = formitem[i]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
658 |
if ( !elem ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
659 |
break; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
660 |
radios.push(elem); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
661 |
if ( !elem.id ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
662 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
663 |
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
|
664 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
665 |
radioids.push(elem.id); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
666 |
i++; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
667 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
668 |
var cr; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
669 |
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
|
670 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
671 |
cr = document.getElementById(radioids[i]); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
672 |
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
|
673 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
674 |
try { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
675 |
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
|
676 |
} catch(e) { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
677 |
// 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
|
678 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
679 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
680 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
681 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
682 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
683 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
684 |
} |
1 | 685 |
inputs = form.getElementsByTagName('input'); |
686 |
radios = new Array(); |
|
687 |
for(var i in inputs) |
|
688 |
{ |
|
689 |
if(inputs[i]) if(inputs[i].type == 'radio') |
|
690 |
radios.push(inputs[i]); |
|
691 |
} |
|
692 |
for(var i in radios) |
|
693 |
{ |
|
694 |
if(radios[i].checked && radios[i].name == name) |
|
695 |
return radios[i].value; |
|
696 |
} |
|
697 |
return false; |
|
698 |
} |
|
699 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
700 |
function __aclSetAllRadios(val, valArray) |
1 | 701 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
702 |
val = String(val); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
703 |
var form = document.forms[aclManagerID + '_formobj']; |
1 | 704 |
if (!form) |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
705 |
{ |
1 | 706 |
return false; |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
707 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
708 |
var inputs = form.getElementsByTagName('input'); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
709 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
710 |
var dbg = ''; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
711 |
for(var i = 0; i < inputs.length; i++) |
1 | 712 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
713 |
dbg += String(inputs[i]) + "\n"; |
1 | 714 |
if(inputs[i].type == 'radio') |
715 |
radios.push(inputs[i]); |
|
716 |
} |
|
717 |
for(var i in radios) |
|
718 |
{ |
|
719 |
if(radios[i].value == val) |
|
720 |
radios[i].checked = true; |
|
721 |
else |
|
722 |
radios[i].checked = false; |
|
723 |
} |
|
724 |
} |
|
725 |
||
726 |
function __aclDeleteRule() |
|
727 |
{ |
|
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
|
728 |
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
|
729 |
{ |
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
|
730 |
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
|
731 |
{ |
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
|
732 |
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
|
733 |
} |
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
|
734 |
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
|
735 |
} |
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
|
736 |
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
|
737 |
{ |
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
|
738 |
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
|
739 |
{ |
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
|
740 |
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
|
741 |
} |
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
|
742 |
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
|
743 |
} |
1 | 744 |
parms = { |
745 |
'target_type' : aclDataCache.target_type, |
|
746 |
'target_id' : aclDataCache.target_id, |
|
747 |
'target_name' : aclDataCache.target_name, |
|
748 |
'page_id' : aclDataCache.page_id, |
|
749 |
'namespace' : aclDataCache.namespace, |
|
750 |
'mode' : 'delete' |
|
751 |
}; |
|
752 |
__aclJSONSubmitAjaxHandler(parms); |
|
753 |
} |
|
754 |
||
755 |
function array_keys(obj) |
|
756 |
{ |
|
757 |
keys = new Array(); |
|
758 |
for(var i in obj) |
|
759 |
keys.push(i); |
|
760 |
return keys; |
|
761 |
} |
|
762 |
||
763 |
function form_fetch_field(form, name) |
|
764 |
{ |
|
765 |
var fields = form.getElementsByTagName('input'); |
|
766 |
if ( fields.length < 1 ) |
|
767 |
return false; |
|
768 |
for ( var i = 0; i < fields.length; i++ ) |
|
769 |
{ |
|
770 |
var field = fields[i]; |
|
771 |
if ( field.name == name ) |
|
772 |
return field; |
|
773 |
} |
|
774 |
return false; |
|
775 |
} |
|
776 |