author | Dan |
Sat, 12 Apr 2008 10:12:25 -0400 | |
changeset 532 | 03429d7b1537 |
parent 513 | c15fbf197a54 |
child 535 | b31eb2b6c137 |
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 { |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
37 |
var groups = parseJSON(ajax.responseText); |
327 | 38 |
} catch(e) { |
39 |
handle_invalid_json(ajax.responseText); |
|
40 |
} |
|
1 | 41 |
__aclBuildWizardWindow(); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
42 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
43 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
44 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
45 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
46 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
47 |
} |
1 | 48 |
aclDataCache = groups; |
49 |
__aclBuildSelector(groups); |
|
50 |
} |
|
335
67bd3121a12e
Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents:
327
diff
changeset
|
51 |
}, true); |
1 | 52 |
return false; |
53 |
} |
|
54 |
||
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
55 |
function ajaxOpenDirectACLRule(rule_id) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
56 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
57 |
var params = { |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
58 |
target_id: rule_id, |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
59 |
mode: 'seltarget_id' |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
60 |
}; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
61 |
params = ajaxEscape(toJSONString(params)); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
62 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
63 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
64 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
65 |
var response = String(ajax.responseText + ''); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
66 |
if ( response.substr(0, 1) != '{' ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
67 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
68 |
handle_invalid_json(ajax.responseText); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
69 |
return false; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
70 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
71 |
try |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
72 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
73 |
response = parseJSON(response); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
74 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
75 |
catch(e) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
76 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
77 |
handle_invalid_json(response); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
78 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
79 |
if ( !document.getElementById(aclManagerID) ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
80 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
81 |
__aclBuildWizardWindow(); |
513 | 82 |
var main = document.getElementById(aclManagerID + '_main'); |
83 |
main.style.padding = '10px'; |
|
84 |
} |
|
85 |
else |
|
86 |
{ |
|
87 |
var main = document.getElementById(aclManagerID + '_main'); |
|
88 |
main.style.backgroundImage = 'none'; |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
89 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
90 |
if ( response.mode == 'error' ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
91 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
92 |
alert(response.error); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
93 |
killACLManager(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
94 |
return false; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
95 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
96 |
aclDataCache = response; |
513 | 97 |
aclBuildRuleEditor(response, true); |
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
98 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
99 |
}, true); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
100 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
101 |
|
1 | 102 |
function ajaxACLSwitchToSelector() |
103 |
{ |
|
104 |
params = { |
|
105 |
'mode' : 'listgroups' |
|
106 |
}; |
|
107 |
if ( aclDataCache.page_id && aclDataCache.namespace ) |
|
108 |
{ |
|
109 |
params.page_id = aclDataCache.page_id; |
|
110 |
params.namespace = aclDataCache.namespace; |
|
111 |
} |
|
112 |
params = toJSONString(params); |
|
113 |
params = ajaxEscape(params); |
|
114 |
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
|
115 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 116 |
{ |
117 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
118 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
218 | 119 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next'); |
1 | 120 |
groups = parseJSON(ajax.responseText); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
121 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
122 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
123 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
124 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
125 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
126 |
} |
1 | 127 |
aclDataCache = groups; |
128 |
thispage = strToPageID(title); |
|
129 |
groups.page_id = thispage[0]; |
|
130 |
groups.namespace = thispage[1]; |
|
131 |
__aclBuildSelector(groups); |
|
132 |
} |
|
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
|
133 |
}, true); |
1 | 134 |
} |
135 |
||
136 |
function __aclBuildSelector(groups) |
|
137 |
{ |
|
138 |
thispage = strToPageID(title); |
|
139 |
do_scopesel = ( thispage[0] == groups.page_id && thispage[1] == groups.namespace ); |
|
140 |
||
513 | 141 |
document.getElementById(aclManagerID + '_next').style.display = 'inline'; |
142 |
||
1 | 143 |
seed = Math.floor(Math.random() * 1000000); |
144 |
||
145 |
main = document.getElementById(aclManagerID + '_main'); |
|
146 |
main.style.padding = '10px'; |
|
513 | 147 |
main.style.backgroundImage = 'none'; |
148 |
||
149 |
// the "edit existing" button |
|
150 |
var editbtn_wrapper = document.createElement('div'); |
|
151 |
editbtn_wrapper.style.styleFloat = 'right'; |
|
152 |
editbtn_wrapper.style.cssFloat = 'right'; |
|
153 |
editbtn_wrapper.style.fontSize = 'smaller'; |
|
154 |
var editbtn = document.createElement('a'); |
|
155 |
editbtn.href = '#'; |
|
156 |
editbtn.innerHTML = $lang.get('acl_btn_show_existing'); |
|
157 |
editbtn_wrapper.appendChild(editbtn); |
|
158 |
main.appendChild(editbtn_wrapper); |
|
159 |
||
160 |
editbtn.onclick = function() |
|
161 |
{ |
|
162 |
aclSetViewListExisting(); |
|
163 |
return false; |
|
164 |
} |
|
1 | 165 |
|
166 |
selector = document.createElement('div'); |
|
167 |
||
168 |
grpsel = __aclBuildGroupsHTML(groups); |
|
169 |
grpsel.name = 'group_id'; |
|
170 |
||
171 |
span = document.createElement('div'); |
|
172 |
span.id = "enACL_grpbox_"+seed+""; |
|
173 |
||
174 |
// Build the selector |
|
175 |
grpb = document.createElement('input'); |
|
176 |
grpb.type = 'radio'; |
|
177 |
grpb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
178 |
grpb.value = '1'; // ACL_TYPE_GROUP |
1 | 179 |
grpb.checked = 'checked'; |
180 |
grpb.className = seed; |
|
181 |
grpb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'block'; document.getElementById('enACL_usrbox_'+seed).style.display = 'none'; }; |
|
182 |
lbl = document.createElement('label'); |
|
183 |
lbl.appendChild(grpb); |
|
218 | 184 |
lbl.appendChild(document.createTextNode($lang.get('acl_radio_usergroup'))); |
1 | 185 |
lbl.style.display = 'block'; |
186 |
span.appendChild(grpsel); |
|
187 |
||
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
|
188 |
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
|
189 |
anoninfo.className = 'info-box-mini'; |
218 | 190 |
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
|
191 |
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
|
192 |
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
|
193 |
|
1 | 194 |
usrb = document.createElement('input'); |
195 |
usrb.type = 'radio'; |
|
196 |
usrb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
197 |
usrb.value = '2'; // ACL_TYPE_USER |
1 | 198 |
usrb.className = seed; |
199 |
usrb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'none'; document.getElementById('enACL_usrbox_'+seed).style.display = 'block'; }; |
|
200 |
lbl2 = document.createElement('label'); |
|
201 |
lbl2.appendChild(usrb); |
|
218 | 202 |
lbl2.appendChild(document.createTextNode($lang.get('acl_radio_user'))); |
1 | 203 |
lbl2.style.display = 'block'; |
204 |
||
205 |
usrsel = document.createElement('input'); |
|
206 |
usrsel.type = 'text'; |
|
207 |
usrsel.name = 'username'; |
|
184
d74ff822acc9
Replaced autocompleting username with a much more efficient algorithm and caching system
Dan
parents:
151
diff
changeset
|
208 |
usrsel.onkeyup = function() { new AutofillUsername(this, undefined, true); }; |
1 | 209 |
usrsel.id = 'userfield_' + aclManagerID; |
210 |
try { |
|
211 |
usrsel.setAttribute("autocomplete","off"); |
|
212 |
} catch(e) {}; |
|
213 |
||
214 |
span2 = document.createElement('div'); |
|
215 |
span2.id = "enACL_usrbox_"+seed+""; |
|
216 |
span2.style.display = 'none'; |
|
217 |
span2.appendChild(usrsel); |
|
218 |
||
219 |
// Scope selector |
|
220 |
if(do_scopesel) |
|
221 |
{ |
|
222 |
scopediv1 = document.createElement('div'); |
|
223 |
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
|
224 |
scopediv3 = document.createElement('div'); |
1 | 225 |
scopeRadioPage = document.createElement('input'); |
226 |
scopeRadioPage.type = 'radio'; |
|
227 |
scopeRadioPage.name = 'scope'; |
|
228 |
scopeRadioPage.value = 'page'; |
|
229 |
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
|
230 |
scopeRadioPage.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
231 |
if ( groups.page_groups.length > 0 ) scopeRadioPage.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; }; |
1 | 232 |
scopeRadioGlobal = document.createElement('input'); |
233 |
scopeRadioGlobal.type = 'radio'; |
|
234 |
scopeRadioGlobal.name = 'scope'; |
|
235 |
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
|
236 |
scopeRadioGlobal.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
237 |
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
|
238 |
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
|
239 |
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
|
240 |
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
|
241 |
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
|
242 |
scopeRadioGroup.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
243 |
if ( groups.page_groups.length > 0 ) scopeRadioGroup.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'block'; }; |
1 | 244 |
lblPage = document.createElement('label'); |
245 |
lblPage.style.display = 'block'; |
|
246 |
lblPage.appendChild(scopeRadioPage); |
|
218 | 247 |
lblPage.appendChild(document.createTextNode($lang.get('acl_radio_scope_thispage'))); |
1 | 248 |
lblGlobal = document.createElement('label'); |
249 |
lblGlobal.style.display = 'block'; |
|
250 |
lblGlobal.appendChild(scopeRadioGlobal); |
|
218 | 251 |
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
|
252 |
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
|
253 |
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
|
254 |
lblGroup.appendChild(scopeRadioGroup); |
218 | 255 |
lblGroup.appendChild(document.createTextNode($lang.get('acl_radio_scope_pagegroup'))); |
1 | 256 |
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
|
257 |
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
|
258 |
scopediv3.appendChild(lblGlobal); |
1 | 259 |
|
260 |
scopedesc = document.createElement('p'); |
|
218 | 261 |
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
|
262 |
|
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
|
263 |
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
|
264 |
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
|
265 |
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
|
266 |
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
|
267 |
|
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
268 |
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
|
269 |
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
|
270 |
{ |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
271 |
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
|
272 |
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
|
273 |
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
|
274 |
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
|
275 |
} |
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
276 |
|
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
42
diff
changeset
|
277 |
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
|
278 |
|
1 | 279 |
} |
280 |
||
281 |
// Styles |
|
282 |
span.style.marginLeft = '13px'; |
|
283 |
span.style.padding = '5px 0'; |
|
284 |
span2.style.marginLeft = '13px'; |
|
285 |
span2.style.padding = '5px 0'; |
|
286 |
||
287 |
selector.appendChild(lbl); |
|
288 |
selector.appendChild(span); |
|
289 |
||
290 |
selector.appendChild(lbl2); |
|
291 |
selector.appendChild(span2); |
|
292 |
||
293 |
container = document.createElement('div'); |
|
294 |
container.style.margin = 'auto'; |
|
295 |
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
|
296 |
container.style.paddingTop = '50px'; |
1 | 297 |
|
298 |
head = document.createElement('h2'); |
|
218 | 299 |
head.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_title'))); |
1 | 300 |
|
301 |
desc = document.createElement('p'); |
|
218 | 302 |
desc.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_body'))); |
1 | 303 |
|
304 |
container.appendChild(head); |
|
305 |
container.appendChild(desc); |
|
306 |
container.appendChild(selector); |
|
307 |
||
308 |
if(do_scopesel) |
|
309 |
{ |
|
310 |
container.appendChild(scopedesc); |
|
311 |
container.appendChild(scopediv1); |
|
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
312 |
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
|
313 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
314 |
container.appendChild(scopediv2); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
315 |
} |
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
|
316 |
container.appendChild(scopediv3); |
1 | 317 |
} |
318 |
||
319 |
main.appendChild(container); |
|
320 |
||
321 |
var mode = document.createElement('input'); |
|
322 |
mode.name = 'mode'; |
|
323 |
mode.type = 'hidden'; |
|
324 |
mode.id = aclManagerID + '_mode'; |
|
325 |
mode.value = 'seltarget'; |
|
326 |
||
327 |
var theform = document.getElementById(aclManagerID + '_formobj_id'); |
|
328 |
if ( !theform.mode ) |
|
329 |
{ |
|
330 |
theform.appendChild(mode); |
|
331 |
} |
|
332 |
else |
|
333 |
{ |
|
334 |
theform.removeChild(theform.mode); |
|
335 |
theform.appendChild(mode); |
|
336 |
} |
|
337 |
} |
|
338 |
||
339 |
var aclDebugWin = false; |
|
340 |
||
341 |
function aclDebug(text) |
|
342 |
{ |
|
343 |
if(!aclDebugWin) |
|
344 |
aclDebugWin = pseudoWindowOpen("data:text/html;plain,<html><head><title>debug win</title></head><body><h1>Debug window</h1></body></html>", "aclDebugWin"); |
|
345 |
setTimeout(function() { |
|
346 |
aclDebugWin.pre = aclDebugWin.document.createElement('pre'); |
|
347 |
aclDebugWin.pre.appendChild(aclDebugWin.document.createTextNode(text)); |
|
348 |
aclDebugWin.b = aclDebugWin.document.getElementsByTagName('body')[0]; |
|
349 |
aclDebugWin.b.appendChild(aclDebugWin.pre);}, 1000); |
|
350 |
} |
|
351 |
||
352 |
var pseudoWindows = new Object(); |
|
353 |
||
354 |
function pseudoWindowOpen(url, id) |
|
355 |
{ |
|
356 |
if(pseudoWindows[id]) |
|
357 |
{ |
|
358 |
document.getElementById('pseudowin_ifr_'+id).src = url; |
|
359 |
} |
|
360 |
else |
|
361 |
{ |
|
362 |
win = document.createElement('iframe'); |
|
363 |
win.style.position='fixed'; |
|
364 |
win.style.width = '640px'; |
|
365 |
win.style.height = '480px'; |
|
366 |
win.style.top = '0px'; |
|
367 |
win.style.left = '0px'; |
|
368 |
win.style.zIndex = getHighestZ() + 1; |
|
369 |
win.style.backgroundColor = '#FFFFFF'; |
|
370 |
win.name = 'pseudo_ifr_'+id; |
|
371 |
win.id = 'pseudowindow_ifr_'+id; |
|
372 |
win.src = url; |
|
373 |
body = document.getElementsByTagName('body')[0]; |
|
374 |
body.appendChild(win); |
|
375 |
} |
|
376 |
win_obj = eval("( pseudo_ifr_"+id+" )"); |
|
377 |
return win_obj; |
|
378 |
} |
|
379 |
||
380 |
function __aclJSONSubmitAjaxHandler(params) |
|
381 |
{ |
|
382 |
params = toJSONString(params); |
|
383 |
params = ajaxEscape(params); |
|
384 |
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
|
385 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 386 |
{ |
327 | 387 |
var response = String(ajax.responseText + ''); |
388 |
if ( response.substr(0, 1) != '{' ) |
|
389 |
{ |
|
390 |
handle_invalid_json(ajax.responseText); |
|
391 |
return false; |
|
392 |
} |
|
513 | 393 |
try |
394 |
{ |
|
395 |
var data = parseJSON(ajax.responseText); |
|
396 |
} |
|
397 |
catch(e) |
|
398 |
{ |
|
327 | 399 |
handle_invalid_json(ajax.responseText); |
513 | 400 |
return false; |
1 | 401 |
} |
402 |
aclDataCache = data; |
|
403 |
switch(data.mode) |
|
404 |
{ |
|
405 |
case 'seltarget': |
|
406 |
||
407 |
// Build the ACL edit form |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
408 |
aclBuildRuleEditor(data); |
1 | 409 |
|
410 |
break; |
|
411 |
case 'success': |
|
412 |
var note = document.createElement('div'); |
|
413 |
note.className = 'info-box'; |
|
414 |
note.style.marginLeft = '0'; |
|
415 |
var b = document.createElement('b'); |
|
218 | 416 |
b.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_title'))); |
1 | 417 |
note.appendChild(b); |
418 |
note.appendChild(document.createElement('br')); |
|
218 | 419 |
note.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_body', { target_name: data.target_name }))); |
1 | 420 |
note.appendChild(document.createElement('br')); |
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
421 |
|
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
422 |
/* |
1 | 423 |
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
|
424 |
a.href = '#'; |
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
407
diff
changeset
|
425 |
a.id = aclManagerID + '_btn_dismiss'; |
218 | 426 |
a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
1 | 427 |
note.appendChild(a); |
428 |
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
|
429 |
a2.href = '#'; |
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
407
diff
changeset
|
430 |
a.id = aclManagerID + '_btn_close'; |
218 | 431 |
a2.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
1 | 432 |
note.appendChild(a2); |
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
433 |
*/ |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
434 |
|
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
435 |
var a_dismiss = document.createElement('a'); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
436 |
a_dismiss.href = '#'; |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
437 |
a_dismiss.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
438 |
note.appendChild(a_dismiss); |
42
45ebe475ff75
I dunno how many times I'm gonna have to fix the "problem seems to be the hex conversion" bug, but this is at least the fourth try.
Dan
parents:
40
diff
changeset
|
439 |
|
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
440 |
var a_close = document.createElement('a'); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
441 |
a_close.href = '#'; |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
442 |
a_close.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
443 |
note.appendChild(a_close); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
444 |
|
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
445 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
407
diff
changeset
|
446 |
|
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
447 |
a_dismiss.setAttribute('onclick', 'var parent = this.parentNode.parentNode; parent.removeChild(this.parentNode); return false;'); |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
448 |
a_close.setAttribute('onclick', 'killACLManager(); return false;'); |
419
b8b4e38825db
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents:
407
diff
changeset
|
449 |
|
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
450 |
if ( !document.getElementById(aclManagerID+'_deletelnk') ) |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
451 |
document.getElementById(aclManagerID + '_main').innerHTML += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'' + $lang.get('acl_msg_deleterule_confirm') + '\')) __aclDeleteRule(); return false;" style="color: red;">' + $lang.get('acl_lbl_deleterule') + '</a></p>'; |
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
452 |
|
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
453 |
document.getElementById(aclManagerID+'_main').scrollTop = 0; |
513 | 454 |
document.getElementById(aclManagerID+'_main').style.backgroundImage = 'none'; |
472
bc4b58034f4d
Implemented password reset (albeit hackishly) into the new login API; added dummy window.console object to hopefully reduce errors when Firebug isn't around; fixed the longstanding ACL dismiss/close button bug; fixed a couple undefined variables in mailer; fixed PHP error on attempted opening of /dev/(u)random in rijndael.php; clarified documentation for PageProcessor::update_page(); fixed some logic problems in theme ACL code; disabled CAPTCHA debug
Dan
parents:
419
diff
changeset
|
455 |
|
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
|
456 |
aclDataCache.mode = 'save_edit'; |
1 | 457 |
break; |
458 |
case 'delete': |
|
459 |
||
460 |
params = { |
|
461 |
'mode' : 'listgroups' |
|
462 |
}; |
|
463 |
params = toJSONString(params); |
|
464 |
params = ajaxEscape(params); |
|
465 |
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
|
466 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 467 |
{ |
468 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
469 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
218 | 470 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next'); |
1 | 471 |
var thispage = strToPageID(title); |
472 |
groups.page_id = thispage[0]; |
|
473 |
groups.namespace = thispage[1]; |
|
474 |
__aclBuildSelector(groups); |
|
475 |
||
476 |
note = document.createElement('div'); |
|
477 |
note.className = 'info-box'; |
|
478 |
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
|
479 |
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
|
480 |
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
|
481 |
note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000); |
1 | 482 |
b = document.createElement('b'); |
218 | 483 |
b.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title'))); |
1 | 484 |
note.appendChild(b); |
485 |
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
|
486 |
note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_body', { target_name: aclDataCache.target_name }))); |
1 | 487 |
note.appendChild(document.createElement('br')); |
488 |
a = document.createElement('a'); |
|
489 |
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
|
490 |
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 | 491 |
a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
1 | 492 |
note.appendChild(a); |
493 |
a = document.createElement('a'); |
|
494 |
a.href = '#'; |
|
495 |
a.onclick = function() { killACLManager(); return false; }; |
|
218 | 496 |
a.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
1 | 497 |
note.appendChild(a); |
498 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
|
499 |
//fadeInfoBoxes(); |
|
500 |
||
501 |
} |
|
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
|
502 |
}, true); |
1 | 503 |
|
504 |
break; |
|
505 |
case 'error': |
|
506 |
alert("Server side processing error:\n"+data.error); |
|
507 |
break; |
|
508 |
case 'debug': |
|
509 |
aclDebug(data.text); |
|
510 |
break; |
|
513 | 511 |
case 'list_existing': |
512 |
aclSetViewListExistingRespond(data); |
|
513 |
break; |
|
1 | 514 |
default: |
327 | 515 |
handle_invalid_json(ajax.responseText); |
1 | 516 |
break; |
517 |
} |
|
518 |
} |
|
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
|
519 |
}, true); |
1 | 520 |
} |
521 |
||
513 | 522 |
function aclBuildRuleEditor(data, from_direct) |
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
523 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
524 |
var act_desc = ( data.type == 'new' ) ? $lang.get('acl_lbl_editwin_title_create') : $lang.get('acl_lbl_editwin_title_edit'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
525 |
var target_type_t = ( data.target_type == 1 ) ? $lang.get('acl_target_type_group') : $lang.get('acl_target_type_user'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
526 |
var target_name_t = data.target_name; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
527 |
var scope_type = ( data.page_id == false && data.namespace == false ) ? $lang.get('acl_scope_type_wholesite') : ( data.namespace == '__PageGroup' ) ? $lang.get('acl_scope_type_pagegroup') : $lang.get('acl_scope_type_thispage'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
528 |
|
513 | 529 |
document.getElementById(aclManagerID + '_next').style.display = 'inline'; |
530 |
||
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
531 |
html = '<h2>'+act_desc+'</h2>'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
532 |
html += '<p>' + $lang.get('acl_lbl_editwin_body', { target_type: target_type_t, target: target_name_t, scope_type: scope_type }) + '</p>'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
533 |
parser = new templateParser(data.template.acl_field_begin); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
534 |
html += parser.run(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
535 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
536 |
cls = 'row2'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
537 |
for(var i in data.acl_types) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
538 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
539 |
if(typeof(data.acl_types[i]) == 'number') |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
540 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
541 |
cls = ( cls == 'row1' ) ? 'row2' : 'row1'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
542 |
p = new templateParser(data.template.acl_field_item); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
543 |
vars = new Object(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
544 |
if ( data.acl_descs[i].match(/^([a-z0-9_]+)$/) ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
545 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
546 |
vars['FIELD_DESC'] = $lang.get(data.acl_descs[i]); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
547 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
548 |
else |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
549 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
550 |
vars['FIELD_DESC'] = data.acl_descs[i]; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
551 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
552 |
vars['FIELD_INHERIT_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
553 |
vars['FIELD_DENY_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
554 |
vars['FIELD_DISALLOW_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
555 |
vars['FIELD_WIKIMODE_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
556 |
vars['FIELD_ALLOW_CHECKED'] = ''; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
557 |
vars['FIELD_NAME'] = i; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
558 |
if ( !data.current_perms[i] ) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
559 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
560 |
data.current_perms[i] = 'i'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
561 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
562 |
switch(data.current_perms[i]) |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
563 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
564 |
case 'i': |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
565 |
default: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
566 |
vars['FIELD_INHERIT_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
567 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
568 |
case 1: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
569 |
vars['FIELD_DENY_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
570 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
571 |
case 2: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
572 |
vars['FIELD_DISALLOW_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
573 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
574 |
case 3: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
575 |
vars['FIELD_WIKIMODE_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
576 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
577 |
case 4: |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
578 |
vars['FIELD_ALLOW_CHECKED'] = 'checked="checked"'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
579 |
break; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
580 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
581 |
vars['ROW_CLASS'] = cls; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
582 |
p.assign_vars(vars); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
583 |
html += p.run(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
584 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
585 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
586 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
587 |
var parser = new templateParser(data.template.acl_field_end); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
588 |
html += parser.run(); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
589 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
590 |
if(data.type == 'edit') |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
591 |
html += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'' + $lang.get('acl_msg_deleterule_confirm') + '\')) __aclDeleteRule(); return false;" style="color: red;">' + $lang.get('acl_lbl_deleterule') + '</a></p>'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
592 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
593 |
var main = document.getElementById(aclManagerID + '_main'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
594 |
main.innerHTML = html; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
595 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
596 |
var form = document.getElementById(aclManagerID + '_formobj_id'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
597 |
|
513 | 598 |
if ( from_direct ) |
599 |
{ |
|
600 |
var modeobj = document.getElementById(aclManagerID + '_mode'); |
|
601 |
modeobj.value = 'save_edit'; |
|
602 |
} |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
603 |
else |
513 | 604 |
{ |
605 |
var modeobj = form_fetch_field(form, 'mode'); |
|
606 |
if ( modeobj ) |
|
607 |
modeobj.value = 'save_' + data.type; |
|
608 |
else |
|
609 |
alert('modeobj is invalid: '+modeobj); |
|
610 |
} |
|
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
611 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
612 |
aclPermList = array_keys(data.acl_types); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
613 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
614 |
document.getElementById(aclManagerID + '_back').style.display = 'inline'; |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
615 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_save_changes'); |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
616 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
617 |
|
1 | 618 |
function __aclBuildGroupsHTML(groups) |
619 |
{ |
|
620 |
groups = groups.groups; |
|
621 |
select = document.createElement('select'); |
|
622 |
for(var i in groups) |
|
623 |
{ |
|
624 |
if(typeof(groups[i]['name']) == 'string' && i != 'toJSONString') |
|
625 |
{ |
|
626 |
o = document.createElement('option'); |
|
627 |
o.value = groups[i]['id']; |
|
628 |
t = document.createTextNode(groups[i]['name']); |
|
629 |
o.appendChild(t); |
|
630 |
select.appendChild(o); |
|
631 |
} |
|
632 |
} |
|
633 |
return select; |
|
634 |
} |
|
635 |
||
636 |
function __aclBuildWizardWindow() |
|
637 |
{ |
|
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
|
638 |
darken(aclDisableTransitionFX); |
1 | 639 |
box = document.createElement('div'); |
640 |
box.style.width = '640px' |
|
641 |
box.style.height = '440px'; |
|
642 |
box.style.position = 'fixed'; |
|
643 |
width = getWidth(); |
|
644 |
height = getHeight(); |
|
645 |
box.style.left = ( width / 2 - 320 ) + 'px'; |
|
646 |
box.style.top = ( height / 2 - 250 ) + 'px'; |
|
647 |
box.style.backgroundColor = 'white'; |
|
648 |
box.style.zIndex = getHighestZ() + 1; |
|
649 |
box.id = aclManagerID; |
|
650 |
box.style.opacity = '0'; |
|
651 |
box.style.filter = 'alpha(opacity=0)'; |
|
652 |
box.style.display = 'none'; |
|
653 |
||
654 |
mainwin = document.createElement('div'); |
|
655 |
mainwin.id = aclManagerID + '_main'; |
|
656 |
mainwin.style.clip = 'rect(0px,640px,440px,0px)'; |
|
657 |
mainwin.style.overflow = 'auto'; |
|
658 |
mainwin.style.width = '620px'; |
|
659 |
mainwin.style.height = '420px'; |
|
660 |
||
661 |
panel = document.createElement('div'); |
|
662 |
panel.style.width = '620px'; |
|
663 |
panel.style.padding = '10px'; |
|
664 |
panel.style.lineHeight = '40px'; |
|
665 |
panel.style.textAlign = 'right'; |
|
666 |
panel.style.position = 'fixed'; |
|
667 |
panel.style.left = ( width / 2 - 320 ) + 'px'; |
|
668 |
panel.style.top = ( height / 2 + 190 ) + 'px'; |
|
669 |
panel.style.backgroundColor = '#D0D0D0'; |
|
670 |
panel.style.opacity = '0'; |
|
671 |
panel.style.filter = 'alpha(opacity=0)'; |
|
672 |
panel.id = aclManagerID + '_panel'; |
|
673 |
||
674 |
form = document.createElement('form'); |
|
675 |
form.method = 'post'; |
|
676 |
form.action = 'javascript:void(0)'; |
|
677 |
form.onsubmit = function() { if(this.username && !submitAuthorized) return false; __aclSubmitManager(this); return false; }; |
|
678 |
form.name = aclManagerID + '_formobj'; |
|
679 |
form.id = aclManagerID + '_formobj_id'; |
|
680 |
||
681 |
back = document.createElement('input'); |
|
682 |
back.type = 'button'; |
|
218 | 683 |
back.value = $lang.get('etc_wizard_back'); |
1 | 684 |
back.style.fontWeight = 'normal'; |
685 |
back.onclick = function() { ajaxACLSwitchToSelector(); return false; }; |
|
686 |
back.style.display = 'none'; |
|
687 |
back.id = aclManagerID + '_back'; |
|
688 |
||
689 |
saver = document.createElement('input'); |
|
690 |
saver.type = 'submit'; |
|
218 | 691 |
saver.value = $lang.get('etc_wizard_next'); |
1 | 692 |
saver.style.fontWeight = 'bold'; |
693 |
saver.id = aclManagerID + '_next'; |
|
694 |
||
695 |
closer = document.createElement('input'); |
|
696 |
closer.type = 'button'; |
|
218 | 697 |
closer.value = $lang.get('etc_cancel_changes'); |
698 |
closer.onclick = function() { if(!confirm($lang.get('acl_msg_closeacl_confirm'))) return false; killACLManager(); return false; } |
|
1 | 699 |
|
700 |
spacer1 = document.createTextNode(' '); |
|
701 |
spacer2 = document.createTextNode(' '); |
|
702 |
||
703 |
panel.appendChild(back); |
|
704 |
panel.appendChild(spacer1); |
|
705 |
panel.appendChild(saver); |
|
706 |
panel.appendChild(spacer2); |
|
707 |
panel.appendChild(closer); |
|
708 |
form.appendChild(mainwin); |
|
709 |
form.appendChild(panel); |
|
710 |
box.appendChild(form); |
|
711 |
||
712 |
body = document.getElementsByTagName('body')[0]; |
|
713 |
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
|
714 |
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
|
715 |
{ |
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
|
716 |
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
|
717 |
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
|
718 |
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
|
719 |
} |
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
|
720 |
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
|
721 |
{ |
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
|
722 |
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
|
723 |
} |
1 | 724 |
} |
725 |
||
726 |
function killACLManager() |
|
727 |
{ |
|
728 |
el = document.getElementById(aclManagerID); |
|
729 |
if(el) |
|
730 |
{ |
|
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
|
731 |
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
|
732 |
{ |
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
|
733 |
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
|
734 |
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
|
735 |
} |
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
|
736 |
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
|
737 |
{ |
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
|
738 |
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
|
739 |
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
|
740 |
} |
1 | 741 |
} |
742 |
} |
|
743 |
||
744 |
function __aclSubmitManager(form) |
|
745 |
{ |
|
746 |
var thefrm = document.forms[form.name]; |
|
747 |
var modeobj = form_fetch_field(thefrm, 'mode'); |
|
748 |
if ( typeof(modeobj) == 'object' ) |
|
749 |
{ |
|
750 |
var mode = (thefrm.mode.value) ? thefrm.mode.value : 'cant_get'; |
|
751 |
} |
|
752 |
else |
|
753 |
{ |
|
754 |
var mode = ''; |
|
755 |
} |
|
756 |
switch(mode) |
|
757 |
{ |
|
758 |
case 'cant_get': |
|
759 |
alert('BUG: can\'t get the state value from the form field.'); |
|
760 |
break; |
|
761 |
case 'seltarget': |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
762 |
var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2'])); |
1 | 763 |
if(isNaN(target_type)) |
764 |
{ |
|
218 | 765 |
alert($lang.get('acl_err_pleaseselect_targettype')); |
1 | 766 |
return false; |
767 |
} |
|
768 |
target_id = ( target_type == 1 ) ? parseInt(thefrm.group_id.value) : thefrm.username.value; |
|
769 |
||
770 |
obj = { 'mode' : mode, 'target_type' : target_type, 'target_id' : target_id }; |
|
771 |
||
772 |
thispage = strToPageID(title); |
|
773 |
do_scopesel = ( thispage[0] == aclDataCache.page_id && thispage[1] == aclDataCache.namespace ); |
|
774 |
||
775 |
if(do_scopesel) |
|
776 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
777 |
scope = getRadioState(thefrm, 'scope', ['page', 'global']); |
1 | 778 |
if(scope == 'page') |
779 |
{ |
|
780 |
pageid = strToPageID(title); |
|
781 |
obj['page_id'] = pageid[0]; |
|
782 |
obj['namespace'] = pageid[1]; |
|
783 |
} |
|
784 |
else if(scope == 'global') |
|
785 |
{ |
|
786 |
obj['page_id'] = false; |
|
787 |
obj['namespace'] = false; |
|
788 |
} |
|
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
|
789 |
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
|
790 |
{ |
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
|
791 |
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
|
792 |
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
|
793 |
} |
1 | 794 |
else |
795 |
{ |
|
796 |
alert('Invalid scope'); |
|
797 |
return false; |
|
798 |
} |
|
799 |
} |
|
800 |
else |
|
801 |
{ |
|
802 |
obj['page_id'] = aclDataCache.page_id; |
|
803 |
obj['namespace'] = aclDataCache.namespace; |
|
804 |
} |
|
805 |
if(target_id == '') |
|
806 |
{ |
|
218 | 807 |
alert($lang.get('acl_err_pleaseselect_username')); |
1 | 808 |
return false; |
809 |
} |
|
810 |
__aclJSONSubmitAjaxHandler(obj); |
|
811 |
break; |
|
812 |
case 'save_edit': |
|
813 |
case 'save_new': |
|
814 |
var form = document.forms[aclManagerID + '_formobj']; |
|
815 |
selections = new Object(); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
816 |
var dbg = ''; |
511
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
817 |
var warned_everyone = false; |
1 | 818 |
for(var i in aclPermList) |
819 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
820 |
selections[aclPermList[i]] = getRadioState(form, aclPermList[i], [1, 2, 3, 4]); |
511
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
821 |
// If we're editing permissions for everyone on the entire site and the |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
822 |
// admin selected to deny privileges, give a stern warning about it. |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
823 |
if ( selections[aclPermList[i]] == 1 && aclDataCache.target_type == 1 /* ACL_TYPE_GROUP */ && aclDataCache.target_id == 1 && !warned_everyone ) |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
824 |
{ |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
825 |
warned_everyone = true; |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
826 |
if ( !confirm($lang.get('acl_msg_deny_everyone_confirm')) ) |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
827 |
{ |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
828 |
return false; |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
829 |
} |
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
830 |
} |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
831 |
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
|
832 |
if(!selections[aclPermList[i]]) |
1 | 833 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
834 |
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
|
835 |
return false; |
1 | 836 |
} |
837 |
} |
|
838 |
obj = new Object(); |
|
839 |
obj['perms'] = selections; |
|
840 |
obj['mode'] = mode; |
|
841 |
obj['target_type'] = aclDataCache.target_type; |
|
842 |
obj['target_id'] = aclDataCache.target_id; |
|
843 |
obj['target_name'] = aclDataCache.target_name; |
|
844 |
obj['page_id'] = aclDataCache.page_id; |
|
845 |
obj['namespace'] = aclDataCache.namespace; |
|
846 |
__aclJSONSubmitAjaxHandler(obj); |
|
847 |
break; |
|
848 |
default: |
|
849 |
alert("JSON form submit: invalid mode string "+mode+", stopping execution"); |
|
850 |
return false; |
|
851 |
break; |
|
852 |
} |
|
853 |
} |
|
854 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
855 |
function getRadioState(form, name, valArray) |
1 | 856 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
857 |
// Konqueror/Safari fix |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
858 |
if ( form[name] ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
859 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
860 |
var formitem = form[name]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
861 |
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
|
862 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
863 |
var i = 0; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
864 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
865 |
var radioids = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
866 |
while(true) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
867 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
868 |
var elem = formitem[i]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
869 |
if ( !elem ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
870 |
break; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
871 |
radios.push(elem); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
872 |
if ( !elem.id ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
873 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
874 |
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
|
875 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
876 |
radioids.push(elem.id); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
877 |
i++; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
878 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
879 |
var cr; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
880 |
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
|
881 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
882 |
cr = document.getElementById(radioids[i]); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
883 |
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
|
884 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
885 |
try { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
886 |
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
|
887 |
} catch(e) { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
888 |
// 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
|
889 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
890 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
891 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
892 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
893 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
894 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
895 |
} |
1 | 896 |
inputs = form.getElementsByTagName('input'); |
897 |
radios = new Array(); |
|
898 |
for(var i in inputs) |
|
899 |
{ |
|
900 |
if(inputs[i]) if(inputs[i].type == 'radio') |
|
901 |
radios.push(inputs[i]); |
|
902 |
} |
|
903 |
for(var i in radios) |
|
904 |
{ |
|
905 |
if(radios[i].checked && radios[i].name == name) |
|
906 |
return radios[i].value; |
|
907 |
} |
|
908 |
return false; |
|
909 |
} |
|
910 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
911 |
function __aclSetAllRadios(val, valArray) |
1 | 912 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
913 |
val = String(val); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
914 |
var form = document.forms[aclManagerID + '_formobj']; |
1 | 915 |
if (!form) |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
916 |
{ |
1 | 917 |
return false; |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
918 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
919 |
var inputs = form.getElementsByTagName('input'); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
920 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
921 |
var dbg = ''; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
922 |
for(var i = 0; i < inputs.length; i++) |
1 | 923 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
924 |
dbg += String(inputs[i]) + "\n"; |
1 | 925 |
if(inputs[i].type == 'radio') |
926 |
radios.push(inputs[i]); |
|
927 |
} |
|
928 |
for(var i in radios) |
|
929 |
{ |
|
930 |
if(radios[i].value == val) |
|
931 |
radios[i].checked = true; |
|
932 |
else |
|
933 |
radios[i].checked = false; |
|
934 |
} |
|
935 |
} |
|
936 |
||
937 |
function __aclDeleteRule() |
|
938 |
{ |
|
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
|
939 |
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
|
940 |
{ |
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
|
941 |
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
|
942 |
{ |
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
|
943 |
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
|
944 |
} |
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
|
945 |
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
|
946 |
} |
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
|
947 |
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
|
948 |
{ |
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
|
949 |
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
|
950 |
{ |
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
|
951 |
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
|
952 |
} |
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
|
953 |
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
|
954 |
} |
1 | 955 |
parms = { |
956 |
'target_type' : aclDataCache.target_type, |
|
957 |
'target_id' : aclDataCache.target_id, |
|
958 |
'target_name' : aclDataCache.target_name, |
|
959 |
'page_id' : aclDataCache.page_id, |
|
960 |
'namespace' : aclDataCache.namespace, |
|
961 |
'mode' : 'delete' |
|
962 |
}; |
|
963 |
__aclJSONSubmitAjaxHandler(parms); |
|
964 |
} |
|
965 |
||
513 | 966 |
function aclSetViewListExisting() |
967 |
{ |
|
968 |
if ( !document.getElementById(aclManagerID) ) |
|
969 |
{ |
|
970 |
return false; |
|
971 |
} |
|
972 |
||
973 |
var main = document.getElementById(aclManagerID + '_main'); |
|
974 |
main.innerHTML = ''; |
|
975 |
main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)'; |
|
976 |
main.style.backgroundRepeat = 'no-repeat'; |
|
977 |
main.style.backgroundPosition = 'center center'; |
|
978 |
||
979 |
var parms = { |
|
980 |
'mode' : 'list_existing' |
|
981 |
}; |
|
982 |
__aclJSONSubmitAjaxHandler(parms); |
|
983 |
} |
|
984 |
||
985 |
function aclSetViewListExistingRespond(data) |
|
986 |
{ |
|
987 |
var main = document.getElementById(aclManagerID + '_main'); |
|
988 |
main.style.padding = '10px'; |
|
989 |
main.innerHTML = ''; |
|
990 |
||
991 |
var heading = document.createElement('h3'); |
|
992 |
heading.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_title'))); |
|
993 |
main.appendChild(heading); |
|
994 |
||
995 |
var p = document.createElement('p'); |
|
996 |
p.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_body'))); |
|
997 |
main.appendChild(p); |
|
998 |
||
999 |
||
1000 |
main.innerHTML += data.key; |
|
1001 |
main.style.backgroundImage = 'none'; |
|
1002 |
||
1003 |
document.getElementById(aclManagerID + '_back').style.display = 'inline'; |
|
1004 |
document.getElementById(aclManagerID + '_next').style.display = 'none'; |
|
1005 |
||
1006 |
for ( var i = 0; i < data.rules.length; i++ ) |
|
1007 |
{ |
|
1008 |
var rule = data.rules[i]; |
|
1009 |
// build the rule, this is just more boring DOM crap. |
|
1010 |
var div = document.createElement('div'); |
|
1011 |
div.style.padding = '5px 3px'; |
|
1012 |
div.style.backgroundColor = '#' + rule.color; |
|
1013 |
div.style.cursor = 'pointer'; |
|
1014 |
div.rule_id = rule.rule_id; |
|
1015 |
div.onclick = function() |
|
1016 |
{ |
|
1017 |
var main = document.getElementById(aclManagerID + '_main'); |
|
1018 |
main.innerHTML = ''; |
|
1019 |
main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)'; |
|
1020 |
ajaxOpenDirectACLRule(parseInt(this.rule_id)); |
|
1021 |
} |
|
1022 |
div.innerHTML = rule.score_string; |
|
1023 |
main.appendChild(div); |
|
1024 |
} |
|
1025 |
} |
|
1026 |
||
1 | 1027 |
function array_keys(obj) |
1028 |
{ |
|
1029 |
keys = new Array(); |
|
1030 |
for(var i in obj) |
|
1031 |
keys.push(i); |
|
1032 |
return keys; |
|
1033 |
} |
|
1034 |
||
1035 |
function form_fetch_field(form, name) |
|
1036 |
{ |
|
1037 |
var fields = form.getElementsByTagName('input'); |
|
1038 |
if ( fields.length < 1 ) |
|
1039 |
return false; |
|
1040 |
for ( var i = 0; i < fields.length; i++ ) |
|
1041 |
{ |
|
1042 |
var field = fields[i]; |
|
1043 |
if ( field.name == name ) |
|
1044 |
return field; |
|
1045 |
} |
|
1046 |
return false; |
|
1047 |
} |
|
1048 |