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