author | Dan |
Sun, 10 Feb 2008 19:35:06 -0500 | |
changeset 407 | 35d94240a197 |
parent 377 | bb3e6c3bd4f4 |
child 419 | b8b4e38825db |
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 |
||
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
|
7 |
// Can be set to true by slow themes (St. Patty) |
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
|
8 |
var aclDisableTransitionFX = false; |
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
|
9 |
|
1 | 10 |
function ajaxOpenACLManager(page_id, namespace) |
11 |
{ |
|
12 |
if(IE) |
|
13 |
return true; |
|
14 |
if(!page_id || !namespace) |
|
15 |
{ |
|
16 |
var data = strToPageID(title); |
|
17 |
var page_id = data[0]; |
|
18 |
var namespace = data[1]; |
|
19 |
} |
|
20 |
var params = { |
|
21 |
'mode' : 'listgroups', |
|
22 |
'page_id' : page_id, |
|
23 |
'namespace' : namespace |
|
24 |
}; |
|
25 |
params = toJSONString(params); |
|
26 |
params = ajaxEscape(params); |
|
27 |
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
|
28 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 29 |
{ |
327 | 30 |
var response = String(ajax.responseText + ''); |
31 |
if ( response.substr(0, 1) != '{' ) |
|
32 |
{ |
|
33 |
handle_invalid_json(ajax.responseText); |
|
34 |
return false; |
|
35 |
} |
|
36 |
try { |
|
37 |
data = parseJSON(ajax.responseText); |
|
38 |
} catch(e) { |
|
39 |
handle_invalid_json(ajax.responseText); |
|
40 |
} |
|
1 | 41 |
__aclBuildWizardWindow(); |
42 |
groups = parseJSON(ajax.responseText); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
43 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
44 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
45 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
46 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
47 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
48 |
} |
1 | 49 |
aclDataCache = groups; |
50 |
__aclBuildSelector(groups); |
|
51 |
} |
|
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
|
52 |
}, true); |
1 | 53 |
return false; |
54 |
} |
|
55 |
||
56 |
function ajaxACLSwitchToSelector() |
|
57 |
{ |
|
58 |
params = { |
|
59 |
'mode' : 'listgroups' |
|
60 |
}; |
|
61 |
if ( aclDataCache.page_id && aclDataCache.namespace ) |
|
62 |
{ |
|
63 |
params.page_id = aclDataCache.page_id; |
|
64 |
params.namespace = aclDataCache.namespace; |
|
65 |
} |
|
66 |
params = toJSONString(params); |
|
67 |
params = ajaxEscape(params); |
|
68 |
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
|
69 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 70 |
{ |
71 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
72 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
218 | 73 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next'); |
1 | 74 |
groups = parseJSON(ajax.responseText); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
75 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
76 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
77 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
78 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
79 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
80 |
} |
1 | 81 |
aclDataCache = groups; |
82 |
thispage = strToPageID(title); |
|
83 |
groups.page_id = thispage[0]; |
|
84 |
groups.namespace = thispage[1]; |
|
85 |
__aclBuildSelector(groups); |
|
86 |
} |
|
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
|
87 |
}, true); |
1 | 88 |
} |
89 |
||
90 |
function __aclBuildSelector(groups) |
|
91 |
{ |
|
92 |
thispage = strToPageID(title); |
|
93 |
do_scopesel = ( thispage[0] == groups.page_id && thispage[1] == groups.namespace ); |
|
94 |
||
95 |
seed = Math.floor(Math.random() * 1000000); |
|
96 |
||
97 |
main = document.getElementById(aclManagerID + '_main'); |
|
98 |
main.style.padding = '10px'; |
|
99 |
||
100 |
selector = document.createElement('div'); |
|
101 |
||
102 |
grpsel = __aclBuildGroupsHTML(groups); |
|
103 |
grpsel.name = 'group_id'; |
|
104 |
||
105 |
span = document.createElement('div'); |
|
106 |
span.id = "enACL_grpbox_"+seed+""; |
|
107 |
||
108 |
// Build the selector |
|
109 |
grpb = document.createElement('input'); |
|
110 |
grpb.type = 'radio'; |
|
111 |
grpb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
112 |
grpb.value = '1'; // ACL_TYPE_GROUP |
1 | 113 |
grpb.checked = 'checked'; |
114 |
grpb.className = seed; |
|
115 |
grpb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'block'; document.getElementById('enACL_usrbox_'+seed).style.display = 'none'; }; |
|
116 |
lbl = document.createElement('label'); |
|
117 |
lbl.appendChild(grpb); |
|
218 | 118 |
lbl.appendChild(document.createTextNode($lang.get('acl_radio_usergroup'))); |
1 | 119 |
lbl.style.display = 'block'; |
120 |
span.appendChild(grpsel); |
|
121 |
||
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
|
122 |
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
|
123 |
anoninfo.className = 'info-box-mini'; |
218 | 124 |
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
|
125 |
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
|
126 |
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
|
127 |
|
1 | 128 |
usrb = document.createElement('input'); |
129 |
usrb.type = 'radio'; |
|
130 |
usrb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
131 |
usrb.value = '2'; // ACL_TYPE_USER |
1 | 132 |
usrb.className = seed; |
133 |
usrb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'none'; document.getElementById('enACL_usrbox_'+seed).style.display = 'block'; }; |
|
134 |
lbl2 = document.createElement('label'); |
|
135 |
lbl2.appendChild(usrb); |
|
218 | 136 |
lbl2.appendChild(document.createTextNode($lang.get('acl_radio_user'))); |
1 | 137 |
lbl2.style.display = 'block'; |
138 |
||
139 |
usrsel = document.createElement('input'); |
|
140 |
usrsel.type = 'text'; |
|
141 |
usrsel.name = 'username'; |
|
184
d74ff822acc9
Replaced autocompleting username with a much more efficient algorithm and caching system
Dan
parents:
151
diff
changeset
|
142 |
usrsel.onkeyup = function() { new AutofillUsername(this, undefined, true); }; |
1 | 143 |
usrsel.id = 'userfield_' + aclManagerID; |
144 |
try { |
|
145 |
usrsel.setAttribute("autocomplete","off"); |
|
146 |
} catch(e) {}; |
|
147 |
||
148 |
span2 = document.createElement('div'); |
|
149 |
span2.id = "enACL_usrbox_"+seed+""; |
|
150 |
span2.style.display = 'none'; |
|
151 |
span2.appendChild(usrsel); |
|
152 |
||
153 |
// Scope selector |
|
154 |
if(do_scopesel) |
|
155 |
{ |
|
156 |
scopediv1 = document.createElement('div'); |
|
157 |
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
|
158 |
scopediv3 = document.createElement('div'); |
1 | 159 |
scopeRadioPage = document.createElement('input'); |
160 |
scopeRadioPage.type = 'radio'; |
|
161 |
scopeRadioPage.name = 'scope'; |
|
162 |
scopeRadioPage.value = 'page'; |
|
163 |
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
|
164 |
scopeRadioPage.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
165 |
if ( groups.page_groups.length > 0 ) scopeRadioPage.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; }; |
1 | 166 |
scopeRadioGlobal = document.createElement('input'); |
167 |
scopeRadioGlobal.type = 'radio'; |
|
168 |
scopeRadioGlobal.name = 'scope'; |
|
169 |
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
|
170 |
scopeRadioGlobal.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
171 |
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
|
172 |
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
|
173 |
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
|
174 |
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
|
175 |
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
|
176 |
scopeRadioGroup.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
177 |
if ( groups.page_groups.length > 0 ) scopeRadioGroup.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'block'; }; |
1 | 178 |
lblPage = document.createElement('label'); |
179 |
lblPage.style.display = 'block'; |
|
180 |
lblPage.appendChild(scopeRadioPage); |
|
218 | 181 |
lblPage.appendChild(document.createTextNode($lang.get('acl_radio_scope_thispage'))); |
1 | 182 |
lblGlobal = document.createElement('label'); |
183 |
lblGlobal.style.display = 'block'; |
|
184 |
lblGlobal.appendChild(scopeRadioGlobal); |
|
218 | 185 |
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
|
186 |
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
|
187 |
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
|
188 |
lblGroup.appendChild(scopeRadioGroup); |
218 | 189 |
lblGroup.appendChild(document.createTextNode($lang.get('acl_radio_scope_pagegroup'))); |
1 | 190 |
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
|
191 |
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
|
192 |
scopediv3.appendChild(lblGlobal); |
1 | 193 |
|
194 |
scopedesc = document.createElement('p'); |
|
218 | 195 |
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
|
196 |
|
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
|
197 |
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
|
198 |
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
|
199 |
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
|
200 |
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
|
201 |
|
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
|
202 |
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
|
203 |
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
|
204 |
{ |
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
|
205 |
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
|
206 |
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
|
207 |
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
|
208 |
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
|
209 |
} |
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
|
210 |
|
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
|
211 |
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
|
212 |
|
1 | 213 |
} |
214 |
||
215 |
// Styles |
|
216 |
span.style.marginLeft = '13px'; |
|
217 |
span.style.padding = '5px 0'; |
|
218 |
span2.style.marginLeft = '13px'; |
|
219 |
span2.style.padding = '5px 0'; |
|
220 |
||
221 |
selector.appendChild(lbl); |
|
222 |
selector.appendChild(span); |
|
223 |
||
224 |
selector.appendChild(lbl2); |
|
225 |
selector.appendChild(span2); |
|
226 |
||
227 |
container = document.createElement('div'); |
|
228 |
container.style.margin = 'auto'; |
|
229 |
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
|
230 |
container.style.paddingTop = '50px'; |
1 | 231 |
|
232 |
head = document.createElement('h2'); |
|
218 | 233 |
head.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_title'))); |
1 | 234 |
|
235 |
desc = document.createElement('p'); |
|
218 | 236 |
desc.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_body'))); |
1 | 237 |
|
238 |
container.appendChild(head); |
|
239 |
container.appendChild(desc); |
|
240 |
container.appendChild(selector); |
|
241 |
||
242 |
if(do_scopesel) |
|
243 |
{ |
|
244 |
container.appendChild(scopedesc); |
|
245 |
container.appendChild(scopediv1); |
|
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
246 |
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
|
247 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
248 |
container.appendChild(scopediv2); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
249 |
} |
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
|
250 |
container.appendChild(scopediv3); |
1 | 251 |
} |
252 |
||
253 |
main.appendChild(container); |
|
254 |
||
255 |
var mode = document.createElement('input'); |
|
256 |
mode.name = 'mode'; |
|
257 |
mode.type = 'hidden'; |
|
258 |
mode.id = aclManagerID + '_mode'; |
|
259 |
mode.value = 'seltarget'; |
|
260 |
||
261 |
var theform = document.getElementById(aclManagerID + '_formobj_id'); |
|
262 |
if ( !theform.mode ) |
|
263 |
{ |
|
264 |
theform.appendChild(mode); |
|
265 |
} |
|
266 |
else |
|
267 |
{ |
|
268 |
theform.removeChild(theform.mode); |
|
269 |
theform.appendChild(mode); |
|
270 |
} |
|
271 |
} |
|
272 |
||
273 |
var aclDebugWin = false; |
|
274 |
||
275 |
function aclDebug(text) |
|
276 |
{ |
|
277 |
if(!aclDebugWin) |
|
278 |
aclDebugWin = pseudoWindowOpen("data:text/html;plain,<html><head><title>debug win</title></head><body><h1>Debug window</h1></body></html>", "aclDebugWin"); |
|
279 |
setTimeout(function() { |
|
280 |
aclDebugWin.pre = aclDebugWin.document.createElement('pre'); |
|
281 |
aclDebugWin.pre.appendChild(aclDebugWin.document.createTextNode(text)); |
|
282 |
aclDebugWin.b = aclDebugWin.document.getElementsByTagName('body')[0]; |
|
283 |
aclDebugWin.b.appendChild(aclDebugWin.pre);}, 1000); |
|
284 |
} |
|
285 |
||
286 |
var pseudoWindows = new Object(); |
|
287 |
||
288 |
function pseudoWindowOpen(url, id) |
|
289 |
{ |
|
290 |
if(pseudoWindows[id]) |
|
291 |
{ |
|
292 |
document.getElementById('pseudowin_ifr_'+id).src = url; |
|
293 |
} |
|
294 |
else |
|
295 |
{ |
|
296 |
win = document.createElement('iframe'); |
|
297 |
win.style.position='fixed'; |
|
298 |
win.style.width = '640px'; |
|
299 |
win.style.height = '480px'; |
|
300 |
win.style.top = '0px'; |
|
301 |
win.style.left = '0px'; |
|
302 |
win.style.zIndex = getHighestZ() + 1; |
|
303 |
win.style.backgroundColor = '#FFFFFF'; |
|
304 |
win.name = 'pseudo_ifr_'+id; |
|
305 |
win.id = 'pseudowindow_ifr_'+id; |
|
306 |
win.src = url; |
|
307 |
body = document.getElementsByTagName('body')[0]; |
|
308 |
body.appendChild(win); |
|
309 |
} |
|
310 |
win_obj = eval("( pseudo_ifr_"+id+" )"); |
|
311 |
return win_obj; |
|
312 |
} |
|
313 |
||
314 |
function __aclJSONSubmitAjaxHandler(params) |
|
315 |
{ |
|
316 |
params = toJSONString(params); |
|
317 |
params = ajaxEscape(params); |
|
318 |
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
|
319 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 320 |
{ |
327 | 321 |
var response = String(ajax.responseText + ''); |
322 |
if ( response.substr(0, 1) != '{' ) |
|
323 |
{ |
|
324 |
handle_invalid_json(ajax.responseText); |
|
325 |
return false; |
|
326 |
} |
|
1 | 327 |
try { |
328 |
data = parseJSON(ajax.responseText); |
|
329 |
} catch(e) { |
|
327 | 330 |
handle_invalid_json(ajax.responseText); |
1 | 331 |
} |
332 |
aclDataCache = data; |
|
333 |
switch(data.mode) |
|
334 |
{ |
|
335 |
case 'seltarget': |
|
336 |
||
337 |
// Build the ACL edit form |
|
338 |
// try { |
|
218 | 339 |
|
340 |
var act_desc = ( data.type == 'new' ) ? $lang.get('acl_lbl_editwin_title_create') : $lang.get('acl_lbl_editwin_title_edit'); |
|
341 |
var target_type_t = ( data.target_type == 1 ) ? $lang.get('acl_target_type_group') : $lang.get('acl_target_type_user'); |
|
342 |
var target_name_t = data.target_name; |
|
343 |
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'); |
|
344 |
||
345 |
html = '<h2>'+act_desc+'</h2>'; |
|
346 |
html += '<p>' + $lang.get('acl_lbl_editwin_body', { target_type: target_type_t, target: target_name_t, scope_type: scope_type }) + '</p>'; |
|
1 | 347 |
parser = new templateParser(data.template.acl_field_begin); |
348 |
html += parser.run(); |
|
349 |
||
350 |
cls = 'row2'; |
|
351 |
for(var i in data.acl_types) |
|
352 |
{ |
|
353 |
if(typeof(data.acl_types[i]) == 'number') |
|
354 |
{ |
|
355 |
cls = ( cls == 'row1' ) ? 'row2' : 'row1'; |
|
356 |
p = new templateParser(data.template.acl_field_item); |
|
357 |
vars = new Object(); |
|
218 | 358 |
if ( data.acl_descs[i].match(/^([a-z0-9_]+)$/) ) |
359 |
{ |
|
360 |
vars['FIELD_DESC'] = $lang.get(data.acl_descs[i]); |
|
361 |
} |
|
362 |
else |
|
363 |
{ |
|
364 |
vars['FIELD_DESC'] = data.acl_descs[i]; |
|
365 |
} |
|
345
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
366 |
vars['FIELD_INHERIT_CHECKED'] = ''; |
1 | 367 |
vars['FIELD_DENY_CHECKED'] = ''; |
368 |
vars['FIELD_DISALLOW_CHECKED'] = ''; |
|
369 |
vars['FIELD_WIKIMODE_CHECKED'] = ''; |
|
370 |
vars['FIELD_ALLOW_CHECKED'] = ''; |
|
371 |
vars['FIELD_NAME'] = i; |
|
345
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
372 |
if ( !data.current_perms[i] ) |
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
373 |
{ |
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
374 |
data.current_perms[i] = 'i'; |
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
375 |
} |
1 | 376 |
switch(data.current_perms[i]) |
377 |
{ |
|
345
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
378 |
case 'i': |
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
379 |
default: |
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
380 |
vars['FIELD_INHERIT_CHECKED'] = 'checked="checked"'; |
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
336
diff
changeset
|
381 |
break; |
1 | 382 |
case 1: |
383 |
vars['FIELD_DENY_CHECKED'] = 'checked="checked"'; |
|
384 |
break; |
|
385 |
case 2: |
|
386 |
vars['FIELD_DISALLOW_CHECKED'] = 'checked="checked"'; |
|
387 |
break; |
|
388 |
case 3: |
|
389 |
vars['FIELD_WIKIMODE_CHECKED'] = 'checked="checked"'; |
|
390 |
break; |
|
391 |
case 4: |
|
392 |
vars['FIELD_ALLOW_CHECKED'] = 'checked="checked"'; |
|
393 |
break; |
|
394 |
} |
|
395 |
vars['ROW_CLASS'] = cls; |
|
396 |
p.assign_vars(vars); |
|
397 |
html += p.run(); |
|
398 |
} |
|
399 |
} |
|
400 |
||
401 |
var parser = new templateParser(data.template.acl_field_end); |
|
402 |
html += parser.run(); |
|
403 |
||
404 |
if(data.type == 'edit') |
|
218 | 405 |
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>'; |
1 | 406 |
|
407 |
var main = document.getElementById(aclManagerID + '_main'); |
|
408 |
main.innerHTML = html; |
|
409 |
||
410 |
var form = document.getElementById(aclManagerID + '_formobj_id'); |
|
411 |
||
412 |
var modeobj = form_fetch_field(form, 'mode'); |
|
413 |
if ( modeobj ) |
|
414 |
modeobj.value = 'save_' + data.type; |
|
415 |
else |
|
416 |
alert('modeobj is invalid: '+modeobj); |
|
417 |
||
418 |
aclPermList = array_keys(data.acl_types); |
|
419 |
||
420 |
document.getElementById(aclManagerID + '_back').style.display = 'inline'; |
|
218 | 421 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_save_changes'); |
1 | 422 |
|
423 |
// } catch(e) { alert(e); aclDebug(ajax.responseText); } |
|
424 |
||
425 |
break; |
|
426 |
case 'success': |
|
427 |
var note = document.createElement('div'); |
|
428 |
note.className = 'info-box'; |
|
429 |
note.style.marginLeft = '0'; |
|
430 |
var b = document.createElement('b'); |
|
218 | 431 |
b.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_title'))); |
1 | 432 |
note.appendChild(b); |
433 |
note.appendChild(document.createElement('br')); |
|
218 | 434 |
note.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_body', { target_name: data.target_name }))); |
1 | 435 |
note.appendChild(document.createElement('br')); |
436 |
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
|
437 |
a.href = '#'; |
377
bb3e6c3bd4f4
Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents:
345
diff
changeset
|
438 |
a.onclick = function(e) { this.parentNode.parentNode.removeChild(this.parentNode); return false; }; |
218 | 439 |
a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
1 | 440 |
note.appendChild(a); |
441 |
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
|
442 |
a2.href = '#'; |
377
bb3e6c3bd4f4
Removed stray debugging info from ACL editor success notification; added ability for guests to set language on URI (?lang=eng); added html_in_pages ACL type and separated from php_in_pages so HTML can be embedded but not PHP; rewote portions of the path manager to better abstract URL input; added Zend Framework into list of BSD-licensed libraries; localized some remaining strings; got the migration script working, but just barely; fixed display bug in Special:Contributions; localized Main Page button in admin panel
Dan
parents:
345
diff
changeset
|
443 |
a2.onclick = function(e) { killACLManager(); return false; }; |
218 | 444 |
a2.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
1 | 445 |
note.appendChild(a2); |
446 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
|
447 |
if(!document.getElementById(aclManagerID+'_deletelnk')) |
|
218 | 448 |
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>'; |
1 | 449 |
//fadeInfoBoxes(); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
450 |
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
|
451 |
|
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
|
452 |
aclDataCache.mode = 'save_edit'; |
1 | 453 |
break; |
454 |
case 'delete': |
|
455 |
||
456 |
params = { |
|
457 |
'mode' : 'listgroups' |
|
458 |
}; |
|
459 |
params = toJSONString(params); |
|
460 |
params = ajaxEscape(params); |
|
461 |
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
|
462 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 463 |
{ |
464 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
465 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
218 | 466 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next'); |
1 | 467 |
var thispage = strToPageID(title); |
468 |
groups.page_id = thispage[0]; |
|
469 |
groups.namespace = thispage[1]; |
|
470 |
__aclBuildSelector(groups); |
|
471 |
||
472 |
note = document.createElement('div'); |
|
473 |
note.className = 'info-box'; |
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000); |
1 | 478 |
b = document.createElement('b'); |
218 | 479 |
b.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title'))); |
1 | 480 |
note.appendChild(b); |
481 |
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
|
482 |
note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_body', { target_name: aclDataCache.target_name }))); |
1 | 483 |
note.appendChild(document.createElement('br')); |
484 |
a = document.createElement('a'); |
|
485 |
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
|
486 |
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 | 487 |
a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
1 | 488 |
note.appendChild(a); |
489 |
a = document.createElement('a'); |
|
490 |
a.href = '#'; |
|
491 |
a.onclick = function() { killACLManager(); return false; }; |
|
218 | 492 |
a.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
1 | 493 |
note.appendChild(a); |
494 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
|
495 |
//fadeInfoBoxes(); |
|
496 |
||
497 |
} |
|
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
|
498 |
}, true); |
1 | 499 |
|
500 |
break; |
|
501 |
case 'error': |
|
502 |
alert("Server side processing error:\n"+data.error); |
|
503 |
break; |
|
504 |
case 'debug': |
|
505 |
aclDebug(data.text); |
|
506 |
break; |
|
507 |
default: |
|
327 | 508 |
handle_invalid_json(ajax.responseText); |
1 | 509 |
break; |
510 |
} |
|
511 |
} |
|
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
|
512 |
}, true); |
1 | 513 |
} |
514 |
||
515 |
function __aclBuildGroupsHTML(groups) |
|
516 |
{ |
|
517 |
groups = groups.groups; |
|
518 |
select = document.createElement('select'); |
|
519 |
for(var i in groups) |
|
520 |
{ |
|
521 |
if(typeof(groups[i]['name']) == 'string' && i != 'toJSONString') |
|
522 |
{ |
|
523 |
o = document.createElement('option'); |
|
524 |
o.value = groups[i]['id']; |
|
525 |
t = document.createTextNode(groups[i]['name']); |
|
526 |
o.appendChild(t); |
|
527 |
select.appendChild(o); |
|
528 |
} |
|
529 |
} |
|
530 |
return select; |
|
531 |
} |
|
532 |
||
533 |
function __aclBuildWizardWindow() |
|
534 |
{ |
|
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
|
535 |
darken(aclDisableTransitionFX); |
1 | 536 |
box = document.createElement('div'); |
537 |
box.style.width = '640px' |
|
538 |
box.style.height = '440px'; |
|
539 |
box.style.position = 'fixed'; |
|
540 |
width = getWidth(); |
|
541 |
height = getHeight(); |
|
542 |
box.style.left = ( width / 2 - 320 ) + 'px'; |
|
543 |
box.style.top = ( height / 2 - 250 ) + 'px'; |
|
544 |
box.style.backgroundColor = 'white'; |
|
545 |
box.style.zIndex = getHighestZ() + 1; |
|
546 |
box.id = aclManagerID; |
|
547 |
box.style.opacity = '0'; |
|
548 |
box.style.filter = 'alpha(opacity=0)'; |
|
549 |
box.style.display = 'none'; |
|
550 |
||
551 |
mainwin = document.createElement('div'); |
|
552 |
mainwin.id = aclManagerID + '_main'; |
|
553 |
mainwin.style.clip = 'rect(0px,640px,440px,0px)'; |
|
554 |
mainwin.style.overflow = 'auto'; |
|
555 |
mainwin.style.width = '620px'; |
|
556 |
mainwin.style.height = '420px'; |
|
557 |
||
558 |
panel = document.createElement('div'); |
|
559 |
panel.style.width = '620px'; |
|
560 |
panel.style.padding = '10px'; |
|
561 |
panel.style.lineHeight = '40px'; |
|
562 |
panel.style.textAlign = 'right'; |
|
563 |
panel.style.position = 'fixed'; |
|
564 |
panel.style.left = ( width / 2 - 320 ) + 'px'; |
|
565 |
panel.style.top = ( height / 2 + 190 ) + 'px'; |
|
566 |
panel.style.backgroundColor = '#D0D0D0'; |
|
567 |
panel.style.opacity = '0'; |
|
568 |
panel.style.filter = 'alpha(opacity=0)'; |
|
569 |
panel.id = aclManagerID + '_panel'; |
|
570 |
||
571 |
form = document.createElement('form'); |
|
572 |
form.method = 'post'; |
|
573 |
form.action = 'javascript:void(0)'; |
|
574 |
form.onsubmit = function() { if(this.username && !submitAuthorized) return false; __aclSubmitManager(this); return false; }; |
|
575 |
form.name = aclManagerID + '_formobj'; |
|
576 |
form.id = aclManagerID + '_formobj_id'; |
|
577 |
||
578 |
back = document.createElement('input'); |
|
579 |
back.type = 'button'; |
|
218 | 580 |
back.value = $lang.get('etc_wizard_back'); |
1 | 581 |
back.style.fontWeight = 'normal'; |
582 |
back.onclick = function() { ajaxACLSwitchToSelector(); return false; }; |
|
583 |
back.style.display = 'none'; |
|
584 |
back.id = aclManagerID + '_back'; |
|
585 |
||
586 |
saver = document.createElement('input'); |
|
587 |
saver.type = 'submit'; |
|
218 | 588 |
saver.value = $lang.get('etc_wizard_next'); |
1 | 589 |
saver.style.fontWeight = 'bold'; |
590 |
saver.id = aclManagerID + '_next'; |
|
591 |
||
592 |
closer = document.createElement('input'); |
|
593 |
closer.type = 'button'; |
|
218 | 594 |
closer.value = $lang.get('etc_cancel_changes'); |
595 |
closer.onclick = function() { if(!confirm($lang.get('acl_msg_closeacl_confirm'))) return false; killACLManager(); return false; } |
|
1 | 596 |
|
597 |
spacer1 = document.createTextNode(' '); |
|
598 |
spacer2 = document.createTextNode(' '); |
|
599 |
||
600 |
panel.appendChild(back); |
|
601 |
panel.appendChild(spacer1); |
|
602 |
panel.appendChild(saver); |
|
603 |
panel.appendChild(spacer2); |
|
604 |
panel.appendChild(closer); |
|
605 |
form.appendChild(mainwin); |
|
606 |
form.appendChild(panel); |
|
607 |
box.appendChild(form); |
|
608 |
||
609 |
body = document.getElementsByTagName('body')[0]; |
|
610 |
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
|
611 |
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
|
612 |
{ |
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
|
613 |
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
|
614 |
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
|
615 |
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
|
616 |
} |
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
|
617 |
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
|
618 |
{ |
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
|
619 |
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
|
620 |
} |
1 | 621 |
} |
622 |
||
623 |
function killACLManager() |
|
624 |
{ |
|
625 |
el = document.getElementById(aclManagerID); |
|
626 |
if(el) |
|
627 |
{ |
|
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
|
628 |
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
|
629 |
{ |
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
|
630 |
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
|
631 |
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
|
632 |
} |
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
|
633 |
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
|
634 |
{ |
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
|
635 |
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
|
636 |
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
|
637 |
} |
1 | 638 |
} |
639 |
} |
|
640 |
||
641 |
function __aclSubmitManager(form) |
|
642 |
{ |
|
643 |
var thefrm = document.forms[form.name]; |
|
644 |
var modeobj = form_fetch_field(thefrm, 'mode'); |
|
645 |
if ( typeof(modeobj) == 'object' ) |
|
646 |
{ |
|
647 |
var mode = (thefrm.mode.value) ? thefrm.mode.value : 'cant_get'; |
|
648 |
} |
|
649 |
else |
|
650 |
{ |
|
651 |
var mode = ''; |
|
652 |
} |
|
653 |
switch(mode) |
|
654 |
{ |
|
655 |
case 'cant_get': |
|
656 |
alert('BUG: can\'t get the state value from the form field.'); |
|
657 |
break; |
|
658 |
case 'seltarget': |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
659 |
var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2'])); |
1 | 660 |
if(isNaN(target_type)) |
661 |
{ |
|
218 | 662 |
alert($lang.get('acl_err_pleaseselect_targettype')); |
1 | 663 |
return false; |
664 |
} |
|
665 |
target_id = ( target_type == 1 ) ? parseInt(thefrm.group_id.value) : thefrm.username.value; |
|
666 |
||
667 |
obj = { 'mode' : mode, 'target_type' : target_type, 'target_id' : target_id }; |
|
668 |
||
669 |
thispage = strToPageID(title); |
|
670 |
do_scopesel = ( thispage[0] == aclDataCache.page_id && thispage[1] == aclDataCache.namespace ); |
|
671 |
||
672 |
if(do_scopesel) |
|
673 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
674 |
scope = getRadioState(thefrm, 'scope', ['page', 'global']); |
1 | 675 |
if(scope == 'page') |
676 |
{ |
|
677 |
pageid = strToPageID(title); |
|
678 |
obj['page_id'] = pageid[0]; |
|
679 |
obj['namespace'] = pageid[1]; |
|
680 |
} |
|
681 |
else if(scope == 'global') |
|
682 |
{ |
|
683 |
obj['page_id'] = false; |
|
684 |
obj['namespace'] = false; |
|
685 |
} |
|
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
|
686 |
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
|
687 |
{ |
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
|
688 |
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
|
689 |
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
|
690 |
} |
1 | 691 |
else |
692 |
{ |
|
693 |
alert('Invalid scope'); |
|
694 |
return false; |
|
695 |
} |
|
696 |
} |
|
697 |
else |
|
698 |
{ |
|
699 |
obj['page_id'] = aclDataCache.page_id; |
|
700 |
obj['namespace'] = aclDataCache.namespace; |
|
701 |
} |
|
702 |
if(target_id == '') |
|
703 |
{ |
|
218 | 704 |
alert($lang.get('acl_err_pleaseselect_username')); |
1 | 705 |
return false; |
706 |
} |
|
707 |
__aclJSONSubmitAjaxHandler(obj); |
|
708 |
break; |
|
709 |
case 'save_edit': |
|
710 |
case 'save_new': |
|
711 |
var form = document.forms[aclManagerID + '_formobj']; |
|
712 |
selections = new Object(); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
713 |
var dbg = ''; |
1 | 714 |
for(var i in aclPermList) |
715 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
716 |
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
|
717 |
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
|
718 |
if(!selections[aclPermList[i]]) |
1 | 719 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
720 |
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
|
721 |
return false; |
1 | 722 |
} |
723 |
} |
|
724 |
obj = new Object(); |
|
725 |
obj['perms'] = selections; |
|
726 |
obj['mode'] = mode; |
|
727 |
obj['target_type'] = aclDataCache.target_type; |
|
728 |
obj['target_id'] = aclDataCache.target_id; |
|
729 |
obj['target_name'] = aclDataCache.target_name; |
|
730 |
obj['page_id'] = aclDataCache.page_id; |
|
731 |
obj['namespace'] = aclDataCache.namespace; |
|
732 |
__aclJSONSubmitAjaxHandler(obj); |
|
733 |
break; |
|
734 |
default: |
|
735 |
alert("JSON form submit: invalid mode string "+mode+", stopping execution"); |
|
736 |
return false; |
|
737 |
break; |
|
738 |
} |
|
739 |
} |
|
740 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
741 |
function getRadioState(form, name, valArray) |
1 | 742 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
743 |
// Konqueror/Safari fix |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
744 |
if ( form[name] ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
745 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
746 |
var formitem = form[name]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
747 |
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
|
748 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
749 |
var i = 0; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
750 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
751 |
var radioids = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
752 |
while(true) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
753 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
754 |
var elem = formitem[i]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
755 |
if ( !elem ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
756 |
break; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
757 |
radios.push(elem); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
758 |
if ( !elem.id ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
759 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
760 |
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
|
761 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
762 |
radioids.push(elem.id); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
763 |
i++; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
764 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
765 |
var cr; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
766 |
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
|
767 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
768 |
cr = document.getElementById(radioids[i]); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
769 |
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
|
770 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
771 |
try { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
772 |
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
|
773 |
} catch(e) { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
774 |
// 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
|
775 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
776 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
777 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
778 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
779 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
780 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
781 |
} |
1 | 782 |
inputs = form.getElementsByTagName('input'); |
783 |
radios = new Array(); |
|
784 |
for(var i in inputs) |
|
785 |
{ |
|
786 |
if(inputs[i]) if(inputs[i].type == 'radio') |
|
787 |
radios.push(inputs[i]); |
|
788 |
} |
|
789 |
for(var i in radios) |
|
790 |
{ |
|
791 |
if(radios[i].checked && radios[i].name == name) |
|
792 |
return radios[i].value; |
|
793 |
} |
|
794 |
return false; |
|
795 |
} |
|
796 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
797 |
function __aclSetAllRadios(val, valArray) |
1 | 798 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
799 |
val = String(val); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
800 |
var form = document.forms[aclManagerID + '_formobj']; |
1 | 801 |
if (!form) |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
802 |
{ |
1 | 803 |
return false; |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
804 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
805 |
var inputs = form.getElementsByTagName('input'); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
806 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
807 |
var dbg = ''; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
808 |
for(var i = 0; i < inputs.length; i++) |
1 | 809 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
810 |
dbg += String(inputs[i]) + "\n"; |
1 | 811 |
if(inputs[i].type == 'radio') |
812 |
radios.push(inputs[i]); |
|
813 |
} |
|
814 |
for(var i in radios) |
|
815 |
{ |
|
816 |
if(radios[i].value == val) |
|
817 |
radios[i].checked = true; |
|
818 |
else |
|
819 |
radios[i].checked = false; |
|
820 |
} |
|
821 |
} |
|
822 |
||
823 |
function __aclDeleteRule() |
|
824 |
{ |
|
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
|
825 |
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
|
826 |
{ |
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
|
827 |
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
|
828 |
{ |
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
|
829 |
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
|
830 |
} |
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
|
831 |
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
|
832 |
} |
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
|
833 |
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
|
834 |
{ |
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
|
835 |
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
|
836 |
{ |
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
|
837 |
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
|
838 |
} |
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
|
839 |
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
|
840 |
} |
1 | 841 |
parms = { |
842 |
'target_type' : aclDataCache.target_type, |
|
843 |
'target_id' : aclDataCache.target_id, |
|
844 |
'target_name' : aclDataCache.target_name, |
|
845 |
'page_id' : aclDataCache.page_id, |
|
846 |
'namespace' : aclDataCache.namespace, |
|
847 |
'mode' : 'delete' |
|
848 |
}; |
|
849 |
__aclJSONSubmitAjaxHandler(parms); |
|
850 |
} |
|
851 |
||
852 |
function array_keys(obj) |
|
853 |
{ |
|
854 |
keys = new Array(); |
|
855 |
for(var i in obj) |
|
856 |
keys.push(i); |
|
857 |
return keys; |
|
858 |
} |
|
859 |
||
860 |
function form_fetch_field(form, name) |
|
861 |
{ |
|
862 |
var fields = form.getElementsByTagName('input'); |
|
863 |
if ( fields.length < 1 ) |
|
864 |
return false; |
|
865 |
for ( var i = 0; i < fields.length; i++ ) |
|
866 |
{ |
|
867 |
var field = fields[i]; |
|
868 |
if ( field.name == name ) |
|
869 |
return field; |
|
870 |
} |
|
871 |
return false; |
|
872 |
} |
|
873 |