author | Dan |
Wed, 15 Apr 2009 14:23:48 -0400 | |
changeset 911 | facff435cdaa |
parent 907 | 44851d7e9bda |
child 1056 | f21d6e75b469 |
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 |
|
907
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
12 |
void(page_id); |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
13 |
void(namespace); |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
14 |
|
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
15 |
// require re-auth |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
16 |
if ( auth_level <= USER_LEVEL_MEMBER ) |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
17 |
{ |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
18 |
load_component(['login', 'fadefilter', 'flyin', 'jquery', 'jquery-ui', 'crypto', 'messagebox']); |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
19 |
ajaxDynamicReauth(function(key) |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
20 |
{ |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
21 |
ajaxOpenACLManager(page_id, namespace); |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
22 |
}, user_level); |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
23 |
|
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
24 |
return false; |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
25 |
} |
44851d7e9bda
Live Re-Auth is now required for deleting pages, editing ACLs, protecting pages, and clearing logs. Committing in a hurry as a storm is coming in, hope everything is in there.
Dan
parents:
823
diff
changeset
|
26 |
|
787 | 27 |
load_component(['l10n', 'messagebox', 'fadefilter', 'template-compiler', 'jquery', 'jquery-ui', 'autofill']); |
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
568
diff
changeset
|
28 |
|
1 | 29 |
if(!page_id || !namespace) |
30 |
{ |
|
31 |
var data = strToPageID(title); |
|
32 |
var page_id = data[0]; |
|
33 |
var namespace = data[1]; |
|
34 |
} |
|
35 |
var params = { |
|
36 |
'mode' : 'listgroups', |
|
37 |
'page_id' : page_id, |
|
38 |
'namespace' : namespace |
|
39 |
}; |
|
40 |
params = toJSONString(params); |
|
41 |
params = ajaxEscape(params); |
|
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
787
diff
changeset
|
42 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) { |
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
377
diff
changeset
|
43 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 44 |
{ |
327 | 45 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
586
diff
changeset
|
46 |
if ( !check_json_response(response) ) |
327 | 47 |
{ |
48 |
handle_invalid_json(ajax.responseText); |
|
49 |
return false; |
|
50 |
} |
|
51 |
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
|
52 |
var groups = parseJSON(ajax.responseText); |
327 | 53 |
} catch(e) { |
54 |
handle_invalid_json(ajax.responseText); |
|
55 |
} |
|
1 | 56 |
__aclBuildWizardWindow(); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
57 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
58 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
59 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
60 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
61 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
62 |
} |
1 | 63 |
aclDataCache = groups; |
64 |
__aclBuildSelector(groups); |
|
65 |
} |
|
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
|
66 |
}, true); |
1 | 67 |
return false; |
68 |
} |
|
69 |
||
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
|
70 |
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
|
71 |
{ |
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents:
763
diff
changeset
|
72 |
load_component(['l10n', 'messagebox', 'fadefilter', 'template-compiler', 'autofill']); |
694
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
73 |
|
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
|
74 |
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
|
75 |
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
|
76 |
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
|
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 |
params = ajaxEscape(toJSONString(params)); |
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
787
diff
changeset
|
79 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) { |
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
|
80 |
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
|
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 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
586
diff
changeset
|
83 |
if ( !check_json_response(response) ) |
512
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
84 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
85 |
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
|
86 |
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
|
87 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
88 |
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
|
89 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
90 |
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
|
91 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
92 |
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
|
93 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
94 |
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
|
95 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
96 |
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
|
97 |
{ |
13532b0a223f
ACL: Added API call to edit rule 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 |
__aclBuildWizardWindow(); |
513 | 99 |
var main = document.getElementById(aclManagerID + '_main'); |
100 |
main.style.padding = '10px'; |
|
101 |
} |
|
102 |
else |
|
103 |
{ |
|
104 |
var main = document.getElementById(aclManagerID + '_main'); |
|
105 |
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
|
106 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
107 |
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
|
108 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
113 |
aclDataCache = response; |
513 | 114 |
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
|
115 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
116 |
}, 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
|
117 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
118 |
|
1 | 119 |
function ajaxACLSwitchToSelector() |
120 |
{ |
|
121 |
params = { |
|
122 |
'mode' : 'listgroups' |
|
123 |
}; |
|
124 |
if ( aclDataCache.page_id && aclDataCache.namespace ) |
|
125 |
{ |
|
126 |
params.page_id = aclDataCache.page_id; |
|
127 |
params.namespace = aclDataCache.namespace; |
|
128 |
} |
|
129 |
params = toJSONString(params); |
|
130 |
params = ajaxEscape(params); |
|
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
787
diff
changeset
|
131 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) { |
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
377
diff
changeset
|
132 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 133 |
{ |
134 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
135 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
218 | 136 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next'); |
1 | 137 |
groups = parseJSON(ajax.responseText); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
138 |
if ( groups.mode == 'error' ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
139 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
140 |
alert(groups.error); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
141 |
killACLManager(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
142 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
143 |
} |
1 | 144 |
aclDataCache = groups; |
145 |
thispage = strToPageID(title); |
|
146 |
groups.page_id = thispage[0]; |
|
147 |
groups.namespace = thispage[1]; |
|
148 |
__aclBuildSelector(groups); |
|
149 |
} |
|
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
|
150 |
}, true); |
1 | 151 |
} |
152 |
||
153 |
function __aclBuildSelector(groups) |
|
154 |
{ |
|
155 |
thispage = strToPageID(title); |
|
156 |
do_scopesel = ( thispage[0] == groups.page_id && thispage[1] == groups.namespace ); |
|
157 |
||
513 | 158 |
document.getElementById(aclManagerID + '_next').style.display = 'inline'; |
159 |
||
1 | 160 |
seed = Math.floor(Math.random() * 1000000); |
161 |
||
162 |
main = document.getElementById(aclManagerID + '_main'); |
|
163 |
main.style.padding = '10px'; |
|
513 | 164 |
main.style.backgroundImage = 'none'; |
165 |
||
166 |
// the "edit existing" button |
|
167 |
var editbtn_wrapper = document.createElement('div'); |
|
168 |
editbtn_wrapper.style.styleFloat = 'right'; |
|
169 |
editbtn_wrapper.style.cssFloat = 'right'; |
|
170 |
editbtn_wrapper.style.fontSize = 'smaller'; |
|
171 |
var editbtn = document.createElement('a'); |
|
172 |
editbtn.href = '#'; |
|
173 |
editbtn.innerHTML = $lang.get('acl_btn_show_existing'); |
|
174 |
editbtn_wrapper.appendChild(editbtn); |
|
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
175 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
176 |
// tracer button |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
177 |
var tracebtn = document.createElement('a'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
178 |
tracebtn.href = '#'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
179 |
tracebtn.innerHTML = $lang.get('acl_btn_view_effective'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
180 |
editbtn_wrapper.appendChild(document.createElement('br')); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
181 |
editbtn_wrapper.appendChild(tracebtn); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
182 |
|
513 | 183 |
main.appendChild(editbtn_wrapper); |
184 |
||
185 |
editbtn.onclick = function() |
|
186 |
{ |
|
187 |
aclSetViewListExisting(); |
|
188 |
return false; |
|
189 |
} |
|
1 | 190 |
|
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
191 |
tracebtn.onclick = function() |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
192 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
193 |
aclSetViewDebugTools(); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
194 |
return false; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
195 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
196 |
|
1 | 197 |
selector = document.createElement('div'); |
198 |
||
199 |
grpsel = __aclBuildGroupsHTML(groups); |
|
200 |
grpsel.name = 'group_id'; |
|
201 |
||
202 |
span = document.createElement('div'); |
|
203 |
span.id = "enACL_grpbox_"+seed+""; |
|
204 |
||
205 |
// Build the selector |
|
206 |
grpb = document.createElement('input'); |
|
207 |
grpb.type = 'radio'; |
|
208 |
grpb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
209 |
grpb.value = '1'; // ACL_TYPE_GROUP |
1 | 210 |
grpb.checked = 'checked'; |
211 |
grpb.className = seed; |
|
212 |
grpb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'block'; document.getElementById('enACL_usrbox_'+seed).style.display = 'none'; }; |
|
213 |
lbl = document.createElement('label'); |
|
214 |
lbl.appendChild(grpb); |
|
218 | 215 |
lbl.appendChild(document.createTextNode($lang.get('acl_radio_usergroup'))); |
1 | 216 |
lbl.style.display = 'block'; |
217 |
span.appendChild(grpsel); |
|
218 |
||
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
|
219 |
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
|
220 |
anoninfo.className = 'info-box-mini'; |
218 | 221 |
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
|
222 |
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
|
223 |
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
|
224 |
|
1 | 225 |
usrb = document.createElement('input'); |
226 |
usrb.type = 'radio'; |
|
227 |
usrb.name = 'target_type'; |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
228 |
usrb.value = '2'; // ACL_TYPE_USER |
1 | 229 |
usrb.className = seed; |
230 |
usrb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'none'; document.getElementById('enACL_usrbox_'+seed).style.display = 'block'; }; |
|
231 |
lbl2 = document.createElement('label'); |
|
232 |
lbl2.appendChild(usrb); |
|
218 | 233 |
lbl2.appendChild(document.createTextNode($lang.get('acl_radio_user'))); |
1 | 234 |
lbl2.style.display = 'block'; |
235 |
||
236 |
usrsel = document.createElement('input'); |
|
237 |
usrsel.type = 'text'; |
|
238 |
usrsel.name = 'username'; |
|
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
239 |
usrsel.className = 'autofill username'; |
1 | 240 |
usrsel.id = 'userfield_' + aclManagerID; |
241 |
try { |
|
242 |
usrsel.setAttribute("autocomplete","off"); |
|
243 |
} catch(e) {}; |
|
244 |
||
245 |
span2 = document.createElement('div'); |
|
246 |
span2.id = "enACL_usrbox_"+seed+""; |
|
247 |
span2.style.display = 'none'; |
|
248 |
span2.appendChild(usrsel); |
|
249 |
||
250 |
// Scope selector |
|
251 |
if(do_scopesel) |
|
252 |
{ |
|
253 |
scopediv1 = document.createElement('div'); |
|
254 |
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
|
255 |
scopediv3 = document.createElement('div'); |
1 | 256 |
scopeRadioPage = document.createElement('input'); |
257 |
scopeRadioPage.type = 'radio'; |
|
258 |
scopeRadioPage.name = 'scope'; |
|
259 |
scopeRadioPage.value = 'page'; |
|
260 |
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
|
261 |
scopeRadioPage.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
262 |
if ( groups.page_groups.length > 0 ) scopeRadioPage.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; }; |
1 | 263 |
scopeRadioGlobal = document.createElement('input'); |
264 |
scopeRadioGlobal.type = 'radio'; |
|
265 |
scopeRadioGlobal.name = 'scope'; |
|
266 |
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
|
267 |
scopeRadioGlobal.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
268 |
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
|
269 |
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
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
scopeRadioGroup.className = '1048576'; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
274 |
if ( groups.page_groups.length > 0 ) scopeRadioGroup.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'block'; }; |
1 | 275 |
lblPage = document.createElement('label'); |
276 |
lblPage.style.display = 'block'; |
|
277 |
lblPage.appendChild(scopeRadioPage); |
|
218 | 278 |
lblPage.appendChild(document.createTextNode($lang.get('acl_radio_scope_thispage'))); |
1 | 279 |
lblGlobal = document.createElement('label'); |
280 |
lblGlobal.style.display = 'block'; |
|
281 |
lblGlobal.appendChild(scopeRadioGlobal); |
|
218 | 282 |
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
|
283 |
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
|
284 |
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
|
285 |
lblGroup.appendChild(scopeRadioGroup); |
218 | 286 |
lblGroup.appendChild(document.createTextNode($lang.get('acl_radio_scope_pagegroup'))); |
1 | 287 |
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
|
288 |
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
|
289 |
scopediv3.appendChild(lblGlobal); |
1 | 290 |
|
291 |
scopedesc = document.createElement('p'); |
|
218 | 292 |
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
|
293 |
|
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
|
294 |
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
|
295 |
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
|
296 |
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
|
297 |
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
|
298 |
|
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 |
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
|
300 |
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
|
301 |
{ |
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
|
302 |
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
|
303 |
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
|
304 |
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
|
305 |
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
|
306 |
} |
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
|
307 |
|
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
|
308 |
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
|
309 |
|
1 | 310 |
} |
311 |
||
312 |
// Styles |
|
313 |
span.style.marginLeft = '13px'; |
|
314 |
span.style.padding = '5px 0'; |
|
315 |
span2.style.marginLeft = '13px'; |
|
316 |
span2.style.padding = '5px 0'; |
|
317 |
||
318 |
selector.appendChild(lbl); |
|
319 |
selector.appendChild(span); |
|
320 |
||
321 |
selector.appendChild(lbl2); |
|
322 |
selector.appendChild(span2); |
|
323 |
||
324 |
container = document.createElement('div'); |
|
325 |
container.style.margin = 'auto'; |
|
326 |
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
|
327 |
container.style.paddingTop = '50px'; |
1 | 328 |
|
329 |
head = document.createElement('h2'); |
|
218 | 330 |
head.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_title'))); |
1 | 331 |
|
332 |
desc = document.createElement('p'); |
|
218 | 333 |
desc.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_body'))); |
1 | 334 |
|
335 |
container.appendChild(head); |
|
336 |
container.appendChild(desc); |
|
337 |
container.appendChild(selector); |
|
338 |
||
339 |
if(do_scopesel) |
|
340 |
{ |
|
341 |
container.appendChild(scopedesc); |
|
342 |
container.appendChild(scopediv1); |
|
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
343 |
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
|
344 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
345 |
container.appendChild(scopediv2); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
74
diff
changeset
|
346 |
} |
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
|
347 |
container.appendChild(scopediv3); |
1 | 348 |
} |
349 |
||
350 |
main.appendChild(container); |
|
351 |
||
352 |
var mode = document.createElement('input'); |
|
353 |
mode.name = 'mode'; |
|
354 |
mode.type = 'hidden'; |
|
355 |
mode.id = aclManagerID + '_mode'; |
|
356 |
mode.value = 'seltarget'; |
|
357 |
||
358 |
var theform = document.getElementById(aclManagerID + '_formobj_id'); |
|
359 |
if ( !theform.mode ) |
|
360 |
{ |
|
361 |
theform.appendChild(mode); |
|
362 |
} |
|
363 |
else |
|
364 |
{ |
|
365 |
theform.removeChild(theform.mode); |
|
366 |
theform.appendChild(mode); |
|
367 |
} |
|
677
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
368 |
|
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
369 |
autofill_init_element(usrsel, { |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
370 |
allow_anon: true |
2a263b598a2b
Improved miniPrompt and fadefilter to properly overlap parent modal windows. MessageBox() is next. Fixed pref_disable_js_fx not working due to wrong type (number instead of boolean).
Dan
parents:
651
diff
changeset
|
371 |
}); |
1 | 372 |
} |
373 |
||
374 |
var aclDebugWin = false; |
|
375 |
||
376 |
function aclDebug(text) |
|
377 |
{ |
|
378 |
if(!aclDebugWin) |
|
379 |
aclDebugWin = pseudoWindowOpen("data:text/html;plain,<html><head><title>debug win</title></head><body><h1>Debug window</h1></body></html>", "aclDebugWin"); |
|
380 |
setTimeout(function() { |
|
381 |
aclDebugWin.pre = aclDebugWin.document.createElement('pre'); |
|
382 |
aclDebugWin.pre.appendChild(aclDebugWin.document.createTextNode(text)); |
|
383 |
aclDebugWin.b = aclDebugWin.document.getElementsByTagName('body')[0]; |
|
384 |
aclDebugWin.b.appendChild(aclDebugWin.pre);}, 1000); |
|
385 |
} |
|
386 |
||
387 |
var pseudoWindows = new Object(); |
|
388 |
||
389 |
function pseudoWindowOpen(url, id) |
|
390 |
{ |
|
391 |
if(pseudoWindows[id]) |
|
392 |
{ |
|
393 |
document.getElementById('pseudowin_ifr_'+id).src = url; |
|
394 |
} |
|
395 |
else |
|
396 |
{ |
|
397 |
win = document.createElement('iframe'); |
|
398 |
win.style.position='fixed'; |
|
399 |
win.style.width = '640px'; |
|
400 |
win.style.height = '480px'; |
|
401 |
win.style.top = '0px'; |
|
402 |
win.style.left = '0px'; |
|
403 |
win.style.zIndex = getHighestZ() + 1; |
|
404 |
win.style.backgroundColor = '#FFFFFF'; |
|
405 |
win.name = 'pseudo_ifr_'+id; |
|
406 |
win.id = 'pseudowindow_ifr_'+id; |
|
407 |
win.src = url; |
|
408 |
body = document.getElementsByTagName('body')[0]; |
|
409 |
body.appendChild(win); |
|
410 |
} |
|
411 |
win_obj = eval("( pseudo_ifr_"+id+" )"); |
|
412 |
return win_obj; |
|
413 |
} |
|
414 |
||
415 |
function __aclJSONSubmitAjaxHandler(params) |
|
416 |
{ |
|
417 |
params = toJSONString(params); |
|
418 |
params = ajaxEscape(params); |
|
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
787
diff
changeset
|
419 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) { |
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
377
diff
changeset
|
420 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 421 |
{ |
327 | 422 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
586
diff
changeset
|
423 |
if ( !check_json_response(response) ) |
327 | 424 |
{ |
425 |
handle_invalid_json(ajax.responseText); |
|
426 |
return false; |
|
427 |
} |
|
513 | 428 |
try |
429 |
{ |
|
430 |
var data = parseJSON(ajax.responseText); |
|
431 |
} |
|
432 |
catch(e) |
|
433 |
{ |
|
327 | 434 |
handle_invalid_json(ajax.responseText); |
513 | 435 |
return false; |
1 | 436 |
} |
437 |
aclDataCache = data; |
|
438 |
switch(data.mode) |
|
439 |
{ |
|
440 |
case 'seltarget': |
|
441 |
||
442 |
// 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
|
443 |
aclBuildRuleEditor(data); |
1 | 444 |
|
445 |
break; |
|
446 |
case 'success': |
|
447 |
var note = document.createElement('div'); |
|
448 |
note.className = 'info-box'; |
|
449 |
note.style.marginLeft = '0'; |
|
450 |
var b = document.createElement('b'); |
|
218 | 451 |
b.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_title'))); |
1 | 452 |
note.appendChild(b); |
453 |
note.appendChild(document.createElement('br')); |
|
218 | 454 |
note.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_body', { target_name: data.target_name }))); |
1 | 455 |
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
|
456 |
|
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
|
457 |
/* |
1 | 458 |
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
|
459 |
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
|
460 |
a.id = aclManagerID + '_btn_dismiss'; |
218 | 461 |
a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
1 | 462 |
note.appendChild(a); |
463 |
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
|
464 |
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
|
465 |
a.id = aclManagerID + '_btn_close'; |
218 | 466 |
a2.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
1 | 467 |
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
|
468 |
*/ |
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
|
469 |
|
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
|
470 |
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
|
471 |
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
|
472 |
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
|
473 |
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
|
474 |
|
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
|
475 |
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
|
476 |
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
|
477 |
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
|
478 |
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
|
479 |
|
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
|
480 |
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
|
481 |
|
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
|
482 |
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
|
483 |
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
|
484 |
|
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
|
485 |
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
|
486 |
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
|
487 |
|
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
|
488 |
document.getElementById(aclManagerID+'_main').scrollTop = 0; |
513 | 489 |
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
|
490 |
|
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
|
491 |
aclDataCache.mode = 'save_edit'; |
1 | 492 |
break; |
493 |
case 'delete': |
|
494 |
||
495 |
params = { |
|
496 |
'mode' : 'listgroups' |
|
497 |
}; |
|
498 |
params = toJSONString(params); |
|
499 |
params = ajaxEscape(params); |
|
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
787
diff
changeset
|
500 |
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) { |
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
377
diff
changeset
|
501 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
1 | 502 |
{ |
503 |
document.getElementById(aclManagerID+'_main').innerHTML = ''; |
|
504 |
document.getElementById(aclManagerID + '_back').style.display = 'none'; |
|
218 | 505 |
document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next'); |
1 | 506 |
var thispage = strToPageID(title); |
507 |
groups.page_id = thispage[0]; |
|
508 |
groups.namespace = thispage[1]; |
|
509 |
__aclBuildSelector(groups); |
|
510 |
||
511 |
note = document.createElement('div'); |
|
512 |
note.className = 'info-box'; |
|
513 |
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
|
514 |
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
|
515 |
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
|
516 |
note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000); |
1 | 517 |
b = document.createElement('b'); |
218 | 518 |
b.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title'))); |
1 | 519 |
note.appendChild(b); |
520 |
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
|
521 |
note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_body', { target_name: aclDataCache.target_name }))); |
1 | 522 |
note.appendChild(document.createElement('br')); |
523 |
a = document.createElement('a'); |
|
524 |
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
|
525 |
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 | 526 |
a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :')); |
1 | 527 |
note.appendChild(a); |
528 |
a = document.createElement('a'); |
|
529 |
a.href = '#'; |
|
530 |
a.onclick = function() { killACLManager(); return false; }; |
|
218 | 531 |
a.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]')); |
1 | 532 |
note.appendChild(a); |
533 |
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild); |
|
534 |
//fadeInfoBoxes(); |
|
535 |
||
536 |
} |
|
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
|
537 |
}, true); |
1 | 538 |
|
539 |
break; |
|
540 |
case 'error': |
|
541 |
alert("Server side processing error:\n"+data.error); |
|
542 |
break; |
|
543 |
case 'debug': |
|
544 |
aclDebug(data.text); |
|
545 |
break; |
|
513 | 546 |
case 'list_existing': |
547 |
aclSetViewListExistingRespond(data); |
|
548 |
break; |
|
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
549 |
case 'trace': |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
550 |
aclDrawTraceWrapper(data); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
551 |
break; |
1 | 552 |
default: |
327 | 553 |
handle_invalid_json(ajax.responseText); |
1 | 554 |
break; |
555 |
} |
|
556 |
} |
|
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
|
557 |
}, true); |
1 | 558 |
} |
559 |
||
513 | 560 |
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
|
561 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
562 |
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
|
563 |
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
|
564 |
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
|
565 |
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
|
566 |
|
513 | 567 |
document.getElementById(aclManagerID + '_next').style.display = 'inline'; |
568 |
||
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
|
569 |
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
|
570 |
html += '<p>' + $lang.get('acl_lbl_editwin_body', { target_type: target_type_t, target: target_name_t, scope_type: scope_type }) + '</p>'; |
679 | 571 |
|
572 |
// preset management |
|
573 |
var load_flags = 'href="#" onclick="aclShowPresetLoader(); return false;"'; |
|
574 |
var save_flags = 'href="#" onclick="aclShowPresetSave(); return false;"'; |
|
575 |
html += '<div style="float: right;">'; |
|
576 |
html += $lang.get('acl_btn_edit_presets', { load_flags: load_flags, save_flags: save_flags }); |
|
577 |
html += '</div>'; |
|
578 |
html += '<div style="clear: both;"></div>'; |
|
579 |
||
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
|
580 |
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
|
581 |
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
|
582 |
|
13532b0a223f
ACL: Added API call to edit rule 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 |
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
|
584 |
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
|
585 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
586 |
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
|
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 |
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
|
589 |
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
|
590 |
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
|
591 |
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
|
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 |
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
|
594 |
} |
13532b0a223f
ACL: Added API call to edit rule 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 |
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
|
596 |
{ |
13532b0a223f
ACL: Added API call to edit rule 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 |
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
|
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 |
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
|
600 |
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
|
601 |
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
|
602 |
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
|
603 |
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
|
604 |
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
|
605 |
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
|
606 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
607 |
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
|
608 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
609 |
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
|
610 |
{ |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
611 |
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
|
612 |
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
|
613 |
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
|
614 |
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
|
615 |
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
|
616 |
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
|
617 |
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
|
618 |
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
|
619 |
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
|
620 |
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
|
621 |
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
|
622 |
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
|
623 |
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
|
624 |
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
|
625 |
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
|
626 |
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
|
627 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
628 |
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
|
629 |
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
|
630 |
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
|
631 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
632 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
633 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
634 |
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
|
635 |
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
|
636 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
637 |
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
|
638 |
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
|
639 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
640 |
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
|
641 |
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
|
642 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
643 |
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
|
644 |
|
513 | 645 |
if ( from_direct ) |
646 |
{ |
|
647 |
var modeobj = document.getElementById(aclManagerID + '_mode'); |
|
648 |
modeobj.value = 'save_edit'; |
|
649 |
} |
|
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
|
650 |
else |
513 | 651 |
{ |
652 |
var modeobj = form_fetch_field(form, 'mode'); |
|
653 |
if ( modeobj ) |
|
654 |
modeobj.value = 'save_' + data.type; |
|
655 |
else |
|
656 |
alert('modeobj is invalid: '+modeobj); |
|
657 |
} |
|
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
|
658 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
659 |
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
|
660 |
|
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
661 |
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
|
662 |
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
|
663 |
} |
13532b0a223f
ACL: Added API call to edit rule based only on numeric rule ID; to be used later with lister for existing rules and effective permissions viewer
Dan
parents:
511
diff
changeset
|
664 |
|
1 | 665 |
function __aclBuildGroupsHTML(groups) |
666 |
{ |
|
667 |
groups = groups.groups; |
|
668 |
select = document.createElement('select'); |
|
669 |
for(var i in groups) |
|
670 |
{ |
|
671 |
if(typeof(groups[i]['name']) == 'string' && i != 'toJSONString') |
|
672 |
{ |
|
673 |
o = document.createElement('option'); |
|
674 |
o.value = groups[i]['id']; |
|
675 |
t = document.createTextNode(groups[i]['name']); |
|
676 |
o.appendChild(t); |
|
677 |
select.appendChild(o); |
|
678 |
} |
|
679 |
} |
|
680 |
return select; |
|
681 |
} |
|
682 |
||
683 |
function __aclBuildWizardWindow() |
|
684 |
{ |
|
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
685 |
darken(aclDisableTransitionFX, 70, 'acldarkener'); |
1 | 686 |
box = document.createElement('div'); |
687 |
box.style.width = '640px' |
|
688 |
box.style.height = '440px'; |
|
689 |
box.style.position = 'fixed'; |
|
690 |
width = getWidth(); |
|
691 |
height = getHeight(); |
|
692 |
box.style.left = ( width / 2 - 320 ) + 'px'; |
|
693 |
box.style.top = ( height / 2 - 250 ) + 'px'; |
|
694 |
box.style.backgroundColor = 'white'; |
|
695 |
box.style.zIndex = getHighestZ() + 1; |
|
696 |
box.id = aclManagerID; |
|
697 |
box.style.opacity = '0'; |
|
698 |
box.style.filter = 'alpha(opacity=0)'; |
|
699 |
box.style.display = 'none'; |
|
700 |
||
701 |
mainwin = document.createElement('div'); |
|
702 |
mainwin.id = aclManagerID + '_main'; |
|
703 |
mainwin.style.clip = 'rect(0px,640px,440px,0px)'; |
|
704 |
mainwin.style.overflow = 'auto'; |
|
705 |
mainwin.style.width = '620px'; |
|
706 |
mainwin.style.height = '420px'; |
|
707 |
||
708 |
panel = document.createElement('div'); |
|
709 |
panel.style.width = '620px'; |
|
710 |
panel.style.padding = '10px'; |
|
711 |
panel.style.lineHeight = '40px'; |
|
712 |
panel.style.textAlign = 'right'; |
|
713 |
panel.style.position = 'fixed'; |
|
714 |
panel.style.left = ( width / 2 - 320 ) + 'px'; |
|
715 |
panel.style.top = ( height / 2 + 190 ) + 'px'; |
|
716 |
panel.style.backgroundColor = '#D0D0D0'; |
|
717 |
panel.style.opacity = '0'; |
|
718 |
panel.style.filter = 'alpha(opacity=0)'; |
|
719 |
panel.id = aclManagerID + '_panel'; |
|
720 |
||
721 |
form = document.createElement('form'); |
|
722 |
form.method = 'post'; |
|
723 |
form.action = 'javascript:void(0)'; |
|
724 |
form.onsubmit = function() { if(this.username && !submitAuthorized) return false; __aclSubmitManager(this); return false; }; |
|
725 |
form.name = aclManagerID + '_formobj'; |
|
726 |
form.id = aclManagerID + '_formobj_id'; |
|
727 |
||
728 |
back = document.createElement('input'); |
|
729 |
back.type = 'button'; |
|
218 | 730 |
back.value = $lang.get('etc_wizard_back'); |
1 | 731 |
back.style.fontWeight = 'normal'; |
732 |
back.onclick = function() { ajaxACLSwitchToSelector(); return false; }; |
|
733 |
back.style.display = 'none'; |
|
734 |
back.id = aclManagerID + '_back'; |
|
735 |
||
736 |
saver = document.createElement('input'); |
|
737 |
saver.type = 'submit'; |
|
218 | 738 |
saver.value = $lang.get('etc_wizard_next'); |
1 | 739 |
saver.style.fontWeight = 'bold'; |
740 |
saver.id = aclManagerID + '_next'; |
|
741 |
||
742 |
closer = document.createElement('input'); |
|
743 |
closer.type = 'button'; |
|
218 | 744 |
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
|
745 |
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
|
746 |
{ |
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
|
747 |
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
|
748 |
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
|
749 |
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
|
750 |
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
|
751 |
{ |
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
|
752 |
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
|
753 |
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
|
754 |
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
|
755 |
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
|
756 |
}, |
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
|
757 |
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
|
758 |
{ |
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
|
759 |
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
|
760 |
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
|
761 |
} |
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
|
762 |
}, |
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
|
763 |
{ |
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
|
764 |
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
|
765 |
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
|
766 |
{ |
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
|
767 |
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
|
768 |
} |
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
|
769 |
} |
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
|
770 |
] |
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
|
771 |
}); |
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
|
772 |
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
|
773 |
} |
1 | 774 |
|
775 |
spacer1 = document.createTextNode(' '); |
|
776 |
spacer2 = document.createTextNode(' '); |
|
777 |
||
778 |
panel.appendChild(back); |
|
779 |
panel.appendChild(spacer1); |
|
780 |
panel.appendChild(saver); |
|
781 |
panel.appendChild(spacer2); |
|
782 |
panel.appendChild(closer); |
|
783 |
form.appendChild(mainwin); |
|
784 |
form.appendChild(panel); |
|
785 |
box.appendChild(form); |
|
786 |
||
787 |
body = document.getElementsByTagName('body')[0]; |
|
788 |
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
|
789 |
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
|
790 |
{ |
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
|
791 |
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
|
792 |
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
|
793 |
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
|
794 |
} |
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
|
795 |
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
|
796 |
{ |
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
|
797 |
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
|
798 |
} |
1 | 799 |
} |
800 |
||
801 |
function killACLManager() |
|
802 |
{ |
|
803 |
el = document.getElementById(aclManagerID); |
|
804 |
if(el) |
|
805 |
{ |
|
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
|
806 |
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
|
807 |
{ |
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
808 |
enlighten(true, 'acldarkener'); |
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
|
809 |
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
|
810 |
} |
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
|
811 |
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
|
812 |
{ |
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
|
813 |
opacity(aclManagerID, 100, 0, 500); |
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
814 |
setTimeout('var el = document.getElementById(aclManagerID); el.parentNode.removeChild(el); enlighten(false, "acldarkener");', 750); |
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
|
815 |
} |
1 | 816 |
} |
817 |
} |
|
818 |
||
819 |
function __aclSubmitManager(form) |
|
820 |
{ |
|
821 |
var thefrm = document.forms[form.name]; |
|
822 |
var modeobj = form_fetch_field(thefrm, 'mode'); |
|
823 |
if ( typeof(modeobj) == 'object' ) |
|
824 |
{ |
|
825 |
var mode = (thefrm.mode.value) ? thefrm.mode.value : 'cant_get'; |
|
826 |
} |
|
827 |
else |
|
828 |
{ |
|
829 |
var mode = ''; |
|
830 |
} |
|
831 |
switch(mode) |
|
832 |
{ |
|
833 |
case 'cant_get': |
|
834 |
alert('BUG: can\'t get the state value from the form field.'); |
|
835 |
break; |
|
836 |
case 'seltarget': |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
837 |
var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2'])); |
1 | 838 |
if(isNaN(target_type)) |
839 |
{ |
|
218 | 840 |
alert($lang.get('acl_err_pleaseselect_targettype')); |
1 | 841 |
return false; |
842 |
} |
|
843 |
target_id = ( target_type == 1 ) ? parseInt(thefrm.group_id.value) : thefrm.username.value; |
|
844 |
||
845 |
obj = { 'mode' : mode, 'target_type' : target_type, 'target_id' : target_id }; |
|
846 |
||
847 |
thispage = strToPageID(title); |
|
848 |
do_scopesel = ( thispage[0] == aclDataCache.page_id && thispage[1] == aclDataCache.namespace ); |
|
849 |
||
850 |
if(do_scopesel) |
|
851 |
{ |
|
535 | 852 |
scope = getRadioState(thefrm, 'scope', ['page', 'group', 'global']); |
1 | 853 |
if(scope == 'page') |
854 |
{ |
|
855 |
pageid = strToPageID(title); |
|
856 |
obj['page_id'] = pageid[0]; |
|
857 |
obj['namespace'] = pageid[1]; |
|
858 |
} |
|
859 |
else if(scope == 'global') |
|
860 |
{ |
|
861 |
obj['page_id'] = false; |
|
862 |
obj['namespace'] = false; |
|
863 |
} |
|
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
|
864 |
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
|
865 |
{ |
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
|
866 |
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
|
867 |
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
|
868 |
} |
1 | 869 |
else |
870 |
{ |
|
871 |
alert('Invalid scope'); |
|
872 |
return false; |
|
873 |
} |
|
874 |
} |
|
875 |
else |
|
876 |
{ |
|
877 |
obj['page_id'] = aclDataCache.page_id; |
|
878 |
obj['namespace'] = aclDataCache.namespace; |
|
879 |
} |
|
880 |
if(target_id == '') |
|
881 |
{ |
|
218 | 882 |
alert($lang.get('acl_err_pleaseselect_username')); |
1 | 883 |
return false; |
884 |
} |
|
885 |
__aclJSONSubmitAjaxHandler(obj); |
|
886 |
break; |
|
887 |
case 'save_edit': |
|
888 |
case 'save_new': |
|
889 |
var form = document.forms[aclManagerID + '_formobj']; |
|
890 |
selections = new Object(); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
891 |
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
|
892 |
var warned_everyone = false; |
1 | 893 |
for(var i in aclPermList) |
894 |
{ |
|
679 | 895 |
selections[aclPermList[i]] = getRadioState(form, aclPermList[i], ['i', 1, 2, 3, 4]); |
511
f88c8c79d784
Made some improvements to ACL system including: warning on setting Deny for Everyone on the entire site, added ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL, and changed behavior as noted in the docs so that Deny for Everyone is no longer able to be overridden
Dan
parents:
472
diff
changeset
|
896 |
// 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
|
897 |
// 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
|
898 |
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
|
899 |
{ |
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
|
900 |
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
|
901 |
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
|
902 |
{ |
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
|
903 |
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
|
904 |
} |
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
|
905 |
} |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
906 |
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
|
907 |
if(!selections[aclPermList[i]]) |
1 | 908 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
909 |
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
|
910 |
return false; |
1 | 911 |
} |
912 |
} |
|
913 |
obj = new Object(); |
|
914 |
obj['perms'] = selections; |
|
915 |
obj['mode'] = mode; |
|
916 |
obj['target_type'] = aclDataCache.target_type; |
|
917 |
obj['target_id'] = aclDataCache.target_id; |
|
918 |
obj['target_name'] = aclDataCache.target_name; |
|
919 |
obj['page_id'] = aclDataCache.page_id; |
|
920 |
obj['namespace'] = aclDataCache.namespace; |
|
921 |
__aclJSONSubmitAjaxHandler(obj); |
|
922 |
break; |
|
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
923 |
case 'trace': |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
924 |
var params = { |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
925 |
mode: 'trace', |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
926 |
user: document.getElementById(aclManagerID + 'trace_user').value, |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
927 |
page: document.getElementById(aclManagerID + 'trace_page').value |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
928 |
}; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
929 |
__aclJSONSubmitAjaxHandler(params); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
930 |
break; |
1 | 931 |
default: |
932 |
alert("JSON form submit: invalid mode string "+mode+", stopping execution"); |
|
933 |
return false; |
|
934 |
break; |
|
935 |
} |
|
936 |
} |
|
937 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
938 |
function getRadioState(form, name, valArray) |
1 | 939 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
940 |
// Konqueror/Safari fix |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
941 |
if ( form[name] ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
942 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
943 |
var formitem = form[name]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
944 |
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
|
945 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
946 |
var i = 0; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
947 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
948 |
var radioids = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
949 |
while(true) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
950 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
951 |
var elem = formitem[i]; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
952 |
if ( !elem ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
953 |
break; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
954 |
radios.push(elem); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
955 |
if ( !elem.id ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
956 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
957 |
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
|
958 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
959 |
radioids.push(elem.id); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
960 |
i++; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
961 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
962 |
var cr; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
963 |
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
|
964 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
965 |
cr = document.getElementById(radioids[i]); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
966 |
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
|
967 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
968 |
try { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
969 |
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
|
970 |
} catch(e) { |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
971 |
// 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
|
972 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
973 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
974 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
975 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
976 |
return false; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
977 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
978 |
} |
1 | 979 |
inputs = form.getElementsByTagName('input'); |
980 |
radios = new Array(); |
|
981 |
for(var i in inputs) |
|
982 |
{ |
|
983 |
if(inputs[i]) if(inputs[i].type == 'radio') |
|
984 |
radios.push(inputs[i]); |
|
985 |
} |
|
986 |
for(var i in radios) |
|
987 |
{ |
|
988 |
if(radios[i].checked && radios[i].name == name) |
|
989 |
return radios[i].value; |
|
990 |
} |
|
991 |
return false; |
|
992 |
} |
|
993 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
994 |
function __aclSetAllRadios(val, valArray) |
1 | 995 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
996 |
val = String(val); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
997 |
var form = document.forms[aclManagerID + '_formobj']; |
1 | 998 |
if (!form) |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
999 |
{ |
1 | 1000 |
return false; |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
1001 |
} |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
1002 |
var inputs = form.getElementsByTagName('input'); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
1003 |
var radios = new Array(); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
1004 |
var dbg = ''; |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
1005 |
for(var i = 0; i < inputs.length; i++) |
1 | 1006 |
{ |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
1
diff
changeset
|
1007 |
dbg += String(inputs[i]) + "\n"; |
1 | 1008 |
if(inputs[i].type == 'radio') |
1009 |
radios.push(inputs[i]); |
|
1010 |
} |
|
1011 |
for(var i in radios) |
|
1012 |
{ |
|
1013 |
if(radios[i].value == val) |
|
1014 |
radios[i].checked = true; |
|
1015 |
else |
|
1016 |
radios[i].checked = false; |
|
1017 |
} |
|
1018 |
} |
|
1019 |
||
1020 |
function __aclDeleteRule() |
|
1021 |
{ |
|
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
|
1022 |
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
|
1023 |
{ |
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
|
1024 |
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
|
1025 |
{ |
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
|
1026 |
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
|
1027 |
} |
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
|
1028 |
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
|
1029 |
} |
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
|
1030 |
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
|
1031 |
{ |
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
|
1032 |
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
|
1033 |
{ |
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
|
1034 |
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
|
1035 |
} |
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
|
1036 |
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
|
1037 |
} |
1 | 1038 |
parms = { |
1039 |
'target_type' : aclDataCache.target_type, |
|
1040 |
'target_id' : aclDataCache.target_id, |
|
1041 |
'target_name' : aclDataCache.target_name, |
|
1042 |
'page_id' : aclDataCache.page_id, |
|
1043 |
'namespace' : aclDataCache.namespace, |
|
1044 |
'mode' : 'delete' |
|
1045 |
}; |
|
1046 |
__aclJSONSubmitAjaxHandler(parms); |
|
1047 |
} |
|
1048 |
||
513 | 1049 |
function aclSetViewListExisting() |
1050 |
{ |
|
1051 |
if ( !document.getElementById(aclManagerID) ) |
|
1052 |
{ |
|
1053 |
return false; |
|
1054 |
} |
|
1055 |
||
1056 |
var main = document.getElementById(aclManagerID + '_main'); |
|
1057 |
main.innerHTML = ''; |
|
1058 |
main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)'; |
|
1059 |
main.style.backgroundRepeat = 'no-repeat'; |
|
1060 |
main.style.backgroundPosition = 'center center'; |
|
1061 |
||
1062 |
var parms = { |
|
1063 |
'mode' : 'list_existing' |
|
1064 |
}; |
|
1065 |
__aclJSONSubmitAjaxHandler(parms); |
|
1066 |
} |
|
1067 |
||
1068 |
function aclSetViewListExistingRespond(data) |
|
1069 |
{ |
|
1070 |
var main = document.getElementById(aclManagerID + '_main'); |
|
1071 |
main.style.padding = '10px'; |
|
1072 |
main.innerHTML = ''; |
|
1073 |
||
1074 |
var heading = document.createElement('h3'); |
|
1075 |
heading.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_title'))); |
|
1076 |
main.appendChild(heading); |
|
1077 |
||
1078 |
var p = document.createElement('p'); |
|
1079 |
p.appendChild(document.createTextNode($lang.get('acl_msg_scale_intro_body'))); |
|
1080 |
main.appendChild(p); |
|
1081 |
||
1082 |
||
1083 |
main.innerHTML += data.key; |
|
1084 |
main.style.backgroundImage = 'none'; |
|
1085 |
||
1086 |
document.getElementById(aclManagerID + '_back').style.display = 'inline'; |
|
1087 |
document.getElementById(aclManagerID + '_next').style.display = 'none'; |
|
1088 |
||
1089 |
for ( var i = 0; i < data.rules.length; i++ ) |
|
1090 |
{ |
|
1091 |
var rule = data.rules[i]; |
|
1092 |
// build the rule, this is just more boring DOM crap. |
|
1093 |
var div = document.createElement('div'); |
|
1094 |
div.style.padding = '5px 3px'; |
|
1095 |
div.style.backgroundColor = '#' + rule.color; |
|
1096 |
div.style.cursor = 'pointer'; |
|
1097 |
div.rule_id = rule.rule_id; |
|
1098 |
div.onclick = function() |
|
1099 |
{ |
|
1100 |
var main = document.getElementById(aclManagerID + '_main'); |
|
1101 |
main.innerHTML = ''; |
|
1102 |
main.style.backgroundImage = 'url(' + scriptPath + '/images/loading-big.gif)'; |
|
1103 |
ajaxOpenDirectACLRule(parseInt(this.rule_id)); |
|
1104 |
} |
|
1105 |
div.innerHTML = rule.score_string; |
|
1106 |
main.appendChild(div); |
|
1107 |
} |
|
1108 |
} |
|
1109 |
||
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1110 |
function aclSetViewDebugTools() |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1111 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1112 |
// selection window for viewing effective permissions |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1113 |
var main = document.getElementById(aclManagerID + '_main'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1114 |
main.innerHTML = ''; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1115 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1116 |
// set the submission handler to trace |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1117 |
var thefrm = document.forms[form.name]; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1118 |
var modeobj = form_fetch_field(thefrm, 'mode'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1119 |
modeobj.value = 'trace'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1120 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1121 |
// show the back button |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1122 |
document.getElementById(aclManagerID + '_back').style.display = 'inline'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1123 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1124 |
// |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1125 |
// start building |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1126 |
// |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1127 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1128 |
// selection interface |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1129 |
var selector = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1130 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1131 |
var table = document.createElement('table'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1132 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1133 |
// username |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1134 |
var tr_user = document.createElement('tr'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1135 |
var td_user_l = document.createElement('td'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1136 |
var lbl_user = document.createElement('label'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1137 |
lbl_user.setAttribute('for', aclManagerID + 'trace_user'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1138 |
lbl_user.appendChild(document.createTextNode($lang.get('acl_lbl_trace_user'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1139 |
td_user_l.appendChild(lbl_user); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1140 |
tr_user.appendChild(td_user_l); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1141 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1142 |
var td_user_i = document.createElement('td'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1143 |
var i_user = document.createElement('input'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1144 |
i_user.type = 'text'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1145 |
i_user.id = aclManagerID + 'trace_user'; |
763
a03406756fdd
[Minor] Enabled anonymous user autocompletion in ACL tracer
Dan
parents:
749
diff
changeset
|
1146 |
i_user.onkeyup = function() { new AutofillUsername(this, true); }; |
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1147 |
i_user.size = '20'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1148 |
td_user_i.appendChild(i_user); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1149 |
tr_user.appendChild(td_user_i); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1150 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1151 |
table.appendChild(tr_user); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1152 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1153 |
// page |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1154 |
var tr_page = document.createElement('tr'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1155 |
var td_page_l = document.createElement('td'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1156 |
var lbl_page = document.createElement('label'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1157 |
lbl_page.setAttribute('for', aclManagerID + 'trace_page'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1158 |
lbl_page.appendChild(document.createTextNode($lang.get('acl_lbl_trace_page'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1159 |
td_page_l.appendChild(lbl_page); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1160 |
tr_page.appendChild(td_page_l); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1161 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1162 |
var td_page_i = document.createElement('td'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1163 |
var i_page = document.createElement('input'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1164 |
i_page.type = 'text'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1165 |
i_page.id = aclManagerID + 'trace_page'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1166 |
i_page.onkeyup = function() { new AutofillPage(this); }; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1167 |
i_page.size = '20'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1168 |
td_page_i.appendChild(i_page); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1169 |
tr_page.appendChild(td_page_i); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1170 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1171 |
table.appendChild(tr_page); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1172 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1173 |
selector.appendChild(table); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1174 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1175 |
// wrapper |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1176 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1177 |
var container = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1178 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1179 |
container.style.margin = 'auto'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1180 |
container.style.width = '360px'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1181 |
container.style.paddingTop = '90px'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1182 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1183 |
var head = document.createElement('h2'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1184 |
head.appendChild(document.createTextNode($lang.get('acl_lbl_trace_title'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1185 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1186 |
var desc = document.createElement('p'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1187 |
desc.innerHTML = $lang.get('acl_lbl_trace_body'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1188 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1189 |
container.appendChild(head); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1190 |
container.appendChild(desc); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1191 |
container.appendChild(selector); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1192 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1193 |
main.appendChild(container); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1194 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1195 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1196 |
function aclTraceKey() |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1197 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1198 |
var div = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1199 |
$(div).addClass('tblholder'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1200 |
var table = document.createElement('table'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1201 |
$(table).attr('cellspacing', '1').attr('cellpadding', '4'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1202 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1203 |
var inherit_list = ['enano_default', 'global_everyone', 'global_group', 'global_user', 'pg_everyone', 'pg_group', 'pg_user', 'local_everyone', 'local_group', 'local_user']; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1204 |
for ( var i = 0; i < inherit_list.length; i++ ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1205 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1206 |
var t = inherit_list[i]; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1207 |
var tr = document.createElement('tr'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1208 |
var td_key = document.createElement('td'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1209 |
$(td_key).addClass('acl_' + t).addClass('acl_inherit_key'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1210 |
tr.appendChild(td_key); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1211 |
var td_explain = document.createElement('td'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1212 |
$(td_explain).addClass(i % 2 == 0 ? 'row1' : 'row2'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1213 |
td_explain.appendChild(document.createTextNode($lang.get('acl_inherit_key_' + t))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1214 |
tr.appendChild(td_explain); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1215 |
table.appendChild(tr); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1216 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1217 |
div.appendChild(table); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1218 |
return div; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1219 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1220 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1221 |
function aclTraceModalKey() |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1222 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1223 |
load_component('messagebox'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1224 |
miniPrompt(function(parent) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1225 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1226 |
// heading |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1227 |
var h3 = document.createElement('h3'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1228 |
h3.appendChild(document.createTextNode($lang.get('acl_msg_trace_key'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1229 |
parent.appendChild(h3); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1230 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1231 |
var key = aclTraceKey(); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1232 |
parent.appendChild(key); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1233 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1234 |
var p = document.createElement('p'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1235 |
$(p).css('text-align', 'center'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1236 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1237 |
var closer = document.createElement('a'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1238 |
$(closer).addClass('abutton').addClass('abutton_red').css('font-weight', 'bold'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1239 |
closer.appendChild(document.createTextNode($lang.get('etc_close'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1240 |
closer.href = '#'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1241 |
$(closer).click(function(e) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1242 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1243 |
miniPromptDestroy(this); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1244 |
return false; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1245 |
}); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1246 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1247 |
p.appendChild(closer); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1248 |
parent.appendChild(p); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1249 |
}); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1250 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1251 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1252 |
function aclDrawTraceWrapper(data) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1253 |
{ |
730 | 1254 |
// hide the next button |
1255 |
document.getElementById(aclManagerID + '_next').style.display = 'none'; |
|
1256 |
||
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1257 |
var trace_by_perm = aclDrawTraceByPerm(data); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1258 |
var trace_by_rule = aclDrawTraceByRule(data); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1259 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1260 |
trace_by_perm.id = 'aclDebugTraceViewPerm'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1261 |
trace_by_rule.id = 'aclDebugTraceViewRule'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1262 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1263 |
var start_with_rule = ( readCookie('acl_trace_view') == 'rule' ); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1264 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1265 |
if ( start_with_rule ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1266 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1267 |
trace_by_perm.style.display = 'none'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1268 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1269 |
else |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1270 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1271 |
trace_by_rule.style.display = 'none'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1272 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1273 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1274 |
// selection window for viewing effective permissions |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1275 |
var main = document.getElementById(aclManagerID + '_main'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1276 |
main.innerHTML = ''; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1277 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1278 |
var wrapper = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1279 |
$(wrapper).css('padding-bottom', '20px'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1280 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1281 |
var floatlink = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1282 |
$(floatlink).css('float', 'right').css('margin-left', '20px').css('margin-bottom', '20px').css('text-align', 'right'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1283 |
var a_toggle = document.createElement('a'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1284 |
$(a_toggle).attr('id', 'aclDebugTraceViewToggle'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1285 |
a_toggle.innerHTML = '» '; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1286 |
a_toggle.innerHTML += start_with_rule ? $lang.get('acl_btn_sort_perm') : $lang.get('acl_btn_sort_rule'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1287 |
a_toggle.href = '#'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1288 |
floatlink.appendChild(a_toggle); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1289 |
floatlink.appendChild(document.createElement('br')); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1290 |
var a_key = document.createElement('a'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1291 |
$(a_key).css('font-size', 'smaller'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1292 |
a_key.innerHTML = '» '; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1293 |
a_key.innerHTML += $lang.get('acl_btn_view_key'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1294 |
a_key.href = '#'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1295 |
floatlink.appendChild(a_key); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1296 |
wrapper.appendChild(floatlink); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1297 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1298 |
var h3 = document.createElement('h3'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1299 |
h3.appendChild(document.createTextNode($lang.get('acl_msg_debug_main_title'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1300 |
wrapper.appendChild(h3); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1301 |
var p = document.createElement('p'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1302 |
p.appendChild(document.createTextNode($lang.get('acl_msg_debug_main_body'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1303 |
wrapper.appendChild(p); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1304 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1305 |
wrapper.appendChild(trace_by_perm); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1306 |
wrapper.appendChild(trace_by_rule); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1307 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1308 |
main.appendChild(wrapper); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1309 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1310 |
$(a_toggle).click(function(e) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1311 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1312 |
aclTraceToggleViews(); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1313 |
return false; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1314 |
}); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1315 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1316 |
$(a_key).click(function(e) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1317 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1318 |
aclTraceModalKey(); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1319 |
return false; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1320 |
}); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1321 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1322 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1323 |
function aclTraceToggleViews() |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1324 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1325 |
var trace_by_perm = document.getElementById('aclDebugTraceViewPerm'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1326 |
var trace_by_rule = document.getElementById('aclDebugTraceViewRule'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1327 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1328 |
var toggler = document.getElementById('aclDebugTraceViewToggle'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1329 |
var newtext; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1330 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1331 |
if ( trace_by_perm.style.display == 'none' ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1332 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1333 |
newtext = $lang.get('acl_btn_sort_rule'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1334 |
$(trace_by_rule).hide('blind', {}, 750, function() |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1335 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1336 |
$(trace_by_perm).show('blind', {}, 750); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1337 |
}); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1338 |
createCookie('acl_trace_view', 'perm'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1339 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1340 |
else |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1341 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1342 |
newtext = $lang.get('acl_btn_sort_perm'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1343 |
$(trace_by_perm).hide('blind', {}, 750, function() |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1344 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1345 |
$(trace_by_rule).show('blind', {}, 750); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1346 |
}); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1347 |
createCookie('acl_trace_view', 'rule'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1348 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1349 |
$(toggler).fadeOut(500, function() |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1350 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1351 |
this.innerHTML = '» ' + newtext; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1352 |
$(this).fadeIn(500); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1353 |
}); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1354 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1355 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1356 |
function aclDrawTraceByPerm(data) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1357 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1358 |
var wrapper = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1359 |
// wrapper.style.display = 'none'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1360 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1361 |
// temporarily append wrapper to body to allow onclick to work |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1362 |
// var body = document.getElementsByTagName('body')[0]; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1363 |
// body.appendChild(wrapper); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1364 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1365 |
for ( var i in data.perms ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1366 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1367 |
var perm = data.perms[i]; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1368 |
var item = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1369 |
item.className = perm.divclass; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1370 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1371 |
// first row - permission name + current setting |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1372 |
// use innerHTML here to allow for HTML in localized permission types |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1373 |
item.innerHTML += '<b>' + perm.perm_name + ' - ' + perm.perm_value + '</b>'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1374 |
item.appendChild(document.createElement('br')); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1375 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1376 |
// second row - permission localized name + rule ID |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1377 |
var sm = document.createElement('small'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1378 |
sm.innerHTML = perm.perm_src; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1379 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1380 |
item.appendChild(sm); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1381 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1382 |
wrapper.appendChild(item); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1383 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1384 |
// whole row is now in the document |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1385 |
if ( perm.rule_id != -1 ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1386 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1387 |
sm.innerHTML += ' ['; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1388 |
// rule is editable |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1389 |
var editlink = document.createElement('a'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1390 |
editlink.href = 'javascript:ajaxOpenDirectACLRule(' + perm.rule_id + ');'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1391 |
editlink.appendChild(document.createTextNode($lang.get('acl_btn_edit_rule'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1392 |
sm.appendChild(editlink); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1393 |
sm.innerHTML += ']'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1394 |
} |
749 | 1395 |
|
1396 |
if ( perm.bad_deps.length > 0 ) |
|
1397 |
{ |
|
1398 |
var bd = document.createElement('span'); |
|
1399 |
$(bd).addClass('acl_failed_deps'); |
|
1400 |
var failed_deps = ''; |
|
1401 |
for ( var i = 0; i < perm.bad_deps.length; i++ ) |
|
1402 |
{ |
|
1403 |
if ( i > 0 ) |
|
1404 |
failed_deps += ', '; |
|
1405 |
failed_deps += data.perms[perm.bad_deps[i]].perm_name; |
|
1406 |
} |
|
1407 |
var title = document.createElement('span'); |
|
1408 |
$(title).addClass('title'); |
|
1409 |
title.appendChild(document.createTextNode($lang.get('acl_msg_failed_deps'))); |
|
1410 |
bd.appendChild(title); |
|
1411 |
bd.appendChild(document.createTextNode(failed_deps)); |
|
1412 |
||
1413 |
item.appendChild(document.createElement('br')); |
|
1414 |
item.appendChild(bd); |
|
1415 |
} |
|
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1416 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1417 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1418 |
// var ret = wrapper.cloneNode(true); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1419 |
// body.removeChild(wrapper); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1420 |
// wrapper = false; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1421 |
// ret.style.display = 'block'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1422 |
// console.debug(ret); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1423 |
// return ret; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1424 |
return wrapper; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1425 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1426 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1427 |
function aclDrawTraceByRule(data) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1428 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1429 |
var wrapper = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1430 |
var groupdata = {}; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1431 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1432 |
for ( var i in data.perms ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1433 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1434 |
var perm = data.perms[i]; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1435 |
if ( !groupdata[perm['rule_id']] ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1436 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1437 |
groupdata[perm['rule_id']] = { |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1438 |
meta: { |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1439 |
divclass: perm.divclass, |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1440 |
perm_src: perm.perm_src, |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1441 |
rule_id: perm.rule_id |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1442 |
}, |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1443 |
rules: {} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1444 |
}; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1445 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1446 |
groupdata[perm['rule_id']]['rules'][i] = perm; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1447 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1448 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1449 |
for ( var i in groupdata ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1450 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1451 |
var group = groupdata[i]; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1452 |
var grp = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1453 |
var head = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1454 |
head.className = group.meta.divclass; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1455 |
var span = document.createElement('span'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1456 |
span.style.fontSize = 'larger'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1457 |
span.appendChild(document.createTextNode(group.meta.perm_src)); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1458 |
head.appendChild(span); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1459 |
if ( group.meta.rule_id != -1 ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1460 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1461 |
head.innerHTML += ' ['; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1462 |
// rule is editable |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1463 |
var editlink = document.createElement('a'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1464 |
editlink.href = 'javascript:ajaxOpenDirectACLRule(' + group.meta.rule_id + ');'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1465 |
editlink.appendChild(document.createTextNode($lang.get('acl_btn_edit_rule'))); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1466 |
head.appendChild(editlink); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1467 |
head.innerHTML += ']'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1468 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1469 |
grp.appendChild(head); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1470 |
for ( var i in group.rules ) |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1471 |
{ |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1472 |
var rule = group.rules[i]; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1473 |
var rulediv = document.createElement('div'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1474 |
rulediv.style.padding = '3px 12px'; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1475 |
rulediv.innerHTML += rule.perm_name + ': '; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1476 |
var b = document.createElement('strong'); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1477 |
b.appendChild(document.createTextNode(rule.perm_value)); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1478 |
rulediv.appendChild(b); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1479 |
grp.appendChild(rulediv); |
749 | 1480 |
|
1481 |
if ( rule.bad_deps.length > 0 ) |
|
1482 |
{ |
|
1483 |
var bd = document.createElement('span'); |
|
1484 |
$(bd).addClass('acl_failed_deps'); |
|
1485 |
var failed_deps = ''; |
|
1486 |
for ( var i = 0; i < rule.bad_deps.length; i++ ) |
|
1487 |
{ |
|
1488 |
if ( i > 0 ) |
|
1489 |
failed_deps += ', '; |
|
1490 |
failed_deps += data.perms[rule.bad_deps[i]].perm_name; |
|
1491 |
} |
|
1492 |
var title = document.createElement('span'); |
|
1493 |
$(title).addClass('title'); |
|
1494 |
title.appendChild(document.createTextNode($lang.get('acl_msg_failed_deps'))); |
|
1495 |
bd.appendChild(title); |
|
1496 |
bd.appendChild(document.createTextNode(failed_deps)); |
|
1497 |
||
1498 |
rulediv.appendChild(document.createElement('br')); |
|
1499 |
rulediv.appendChild(bd); |
|
1500 |
} |
|
729
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1501 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1502 |
wrapper.appendChild(grp); |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1503 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1504 |
|
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1505 |
return wrapper; |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1506 |
} |
ebac7eeb89eb
Merging in the past three months' work on ACL tracing tools.
Dan
parents:
694
diff
changeset
|
1507 |
|
679 | 1508 |
function aclShowPresetLoader() |
1509 |
{ |
|
1510 |
var prompt = miniPrompt(function(parent) |
|
1511 |
{ |
|
1512 |
parent.innerHTML = '<img style="display: block; margin: 0 auto;" src="' + cdnPath + '/images/loading-big.gif" />'; |
|
1513 |
}); |
|
1514 |
var request = toJSONString({ |
|
1515 |
mode: 'list_presets' |
|
1516 |
}); |
|
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
787
diff
changeset
|
1517 |
ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(request), function(ajax) |
679 | 1518 |
{ |
1519 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
|
1520 |
{ |
|
1521 |
if ( !check_json_response(ajax.responseText) ) |
|
1522 |
{ |
|
1523 |
miniPromptDestroy(prompt); |
|
1524 |
return handle_invalid_json(ajax.responseText); |
|
1525 |
} |
|
1526 |
var response = parseJSON(ajax.responseText); |
|
1527 |
if ( response.mode == 'error' ) |
|
1528 |
{ |
|
1529 |
alert(response.error); |
|
1530 |
miniPromptDestroy(prompt); |
|
1531 |
return false; |
|
1532 |
} |
|
1533 |
prompt = prompt.firstChild.nextSibling; |
|
1534 |
prompt.style.textAlign = 'center'; |
|
1535 |
prompt.innerHTML = '<h3>' + $lang.get('acl_lbl_preset_load_title') + '</h3>'; |
|
1536 |
||
1537 |
if ( response.presets.length > 0 ) |
|
1538 |
{ |
|
1539 |
// selection box |
|
1540 |
var para = document.createElement('p'); |
|
1541 |
var select = document.createElement('select'); |
|
1542 |
||
1543 |
var option = document.createElement('option'); |
|
1544 |
option.value = '0'; |
|
1545 |
option.appendChild(document.createTextNode($lang.get('acl_lbl_preset_load'))); |
|
1546 |
select.appendChild(option); |
|
1547 |
||
1548 |
for ( var i = 0; i < response.presets.length; i++ ) |
|
1549 |
{ |
|
1550 |
var preset = response.presets[i]; |
|
1551 |
var option = document.createElement('option'); |
|
1552 |
option.value = preset.rule_id; |
|
1553 |
option.preset_data = preset; |
|
1554 |
option.appendChild(document.createTextNode($lang.get(preset.preset_name))); |
|
1555 |
select.appendChild(option); |
|
1556 |
} |
|
1557 |
||
1558 |
para.appendChild(select); |
|
1559 |
prompt.appendChild(para); |
|
1560 |
||
1561 |
// buttons |
|
1562 |
var buttons = document.createElement('p'); |
|
1563 |
||
1564 |
// load button |
|
1565 |
var btn_load = document.createElement('a'); |
|
1566 |
btn_load.className = 'abutton abutton_green'; |
|
1567 |
btn_load.style.fontWeight = 'bold'; |
|
1568 |
btn_load.appendChild(document.createTextNode($lang.get('acl_btn_load_preset'))); |
|
1569 |
btn_load.selectobj = select; |
|
1570 |
btn_load.onclick = function() |
|
1571 |
{ |
|
1572 |
if ( this.selectobj.value == '0' ) |
|
1573 |
{ |
|
1574 |
alert($lang.get('acl_err_select_preset')); |
|
1575 |
return false; |
|
1576 |
} |
|
1577 |
// retrieve preset data |
|
1578 |
for ( var i = 0; i < this.selectobj.childNodes.length; i++ ) |
|
1579 |
{ |
|
1580 |
if ( this.selectobj.childNodes[i].tagName == 'OPTION' ) |
|
1581 |
{ |
|
1582 |
var node = this.selectobj.childNodes[i]; |
|
1583 |
if ( node.value == this.selectobj.value ) |
|
1584 |
{ |
|
1585 |
aclSetRulesAbsolute(node.preset_data.rules); |
|
1586 |
break; |
|
1587 |
} |
|
1588 |
} |
|
1589 |
} |
|
1590 |
miniPromptDestroy(this); |
|
1591 |
return false; |
|
1592 |
} |
|
1593 |
btn_load.href = '#'; |
|
1594 |
buttons.appendChild(btn_load); |
|
1595 |
||
1596 |
buttons.appendChild(document.createTextNode(' ')); |
|
1597 |
||
1598 |
// cancel button |
|
1599 |
var btn_cancel = document.createElement('a'); |
|
1600 |
btn_cancel.className = 'abutton'; |
|
1601 |
btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel'))); |
|
1602 |
btn_cancel.onclick = function() |
|
1603 |
{ |
|
1604 |
miniPromptDestroy(this); |
|
1605 |
return false; |
|
1606 |
} |
|
1607 |
btn_cancel.href = '#'; |
|
1608 |
buttons.appendChild(btn_cancel); |
|
1609 |
||
1610 |
prompt.appendChild(buttons); |
|
1611 |
} |
|
1612 |
else |
|
1613 |
{ |
|
1614 |
// "no presets" |
|
1615 |
prompt.innerHTML += '<p>' + $lang.get('acl_msg_no_presets', { close_flags: 'href="#" onclick="miniPromptDestroy(this); return false;"' }) + '</p>'; |
|
1616 |
} |
|
1617 |
} |
|
1618 |
}); |
|
1619 |
} |
|
1620 |
||
1621 |
function aclSetRulesAbsolute(rules) |
|
1622 |
{ |
|
1623 |
__aclSetAllRadios('i'); |
|
1624 |
||
1625 |
var form = document.forms[aclManagerID + '_formobj']; |
|
1626 |
if (!form) |
|
1627 |
{ |
|
1628 |
return false; |
|
1629 |
} |
|
1630 |
var inputs = form.getElementsByTagName('input'); |
|
1631 |
var radios = new Array(); |
|
1632 |
var dbg = ''; |
|
1633 |
for(var i = 0; i < inputs.length; i++) |
|
1634 |
{ |
|
1635 |
if(inputs[i].type == 'radio') |
|
1636 |
radios.push(inputs[i]); |
|
1637 |
} |
|
1638 |
for(var i in radios) |
|
1639 |
{ |
|
1640 |
if ( typeof(rules[ radios[i]['name'] ]) == 'number' ) |
|
1641 |
{ |
|
1642 |
radios[i].checked = ( rules[radios[i]['name']] == radios[i].value ); |
|
1643 |
} |
|
1644 |
} |
|
1645 |
} |
|
1646 |
||
1647 |
function aclShowPresetSave() |
|
1648 |
{ |
|
1649 |
miniPrompt(function(parent) |
|
1650 |
{ |
|
1651 |
parent.style.textAlign = 'center'; |
|
1652 |
||
1653 |
parent.innerHTML = '<h3>' + $lang.get('acl_lbl_preset_save_title') + '</h3>'; |
|
1654 |
var input = document.createElement('input'); |
|
1655 |
input.id = aclManagerID + '_preset_save'; |
|
1656 |
input.type = 'text'; |
|
1657 |
input.size = '30'; |
|
1658 |
input.onkeypress = function(e) |
|
1659 |
{ |
|
1660 |
// javascript sucks. IE and several others throw myriad errors unless it's done this way. |
|
1661 |
if ( e ) |
|
1662 |
if ( e.keyCode ) |
|
1663 |
if ( e.keyCode == 13 ) |
|
1664 |
{ |
|
1665 |
if ( aclSavePreset() ) |
|
1666 |
{ |
|
694
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1667 |
if ( window.opera ) |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1668 |
{ |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1669 |
// damn weird opera bug. |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1670 |
var input = this; |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1671 |
setTimeout(function() |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1672 |
{ |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1673 |
miniPromptDestroy(input); |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1674 |
}, 10); |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1675 |
} |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1676 |
else |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1677 |
{ |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1678 |
miniPromptDestroy(this); |
43367c66d869
Couple of fixes (hacks) for Opera and the aftermath of that z-index change to darken() and enlighten() fadefilters; added ajaxOpenDirectACLRule() to placeholder list
Dan
parents:
679
diff
changeset
|
1679 |
} |
679 | 1680 |
} |
1681 |
} |
|
1682 |
else if ( e.keyCode == 27 ) |
|
1683 |
{ |
|
1684 |
miniPromptDestroy(this); |
|
1685 |
} |
|
1686 |
} |
|
1687 |
var para = document.createElement('p'); |
|
1688 |
para.appendChild(input); |
|
1689 |
||
1690 |
parent.appendChild(para); |
|
1691 |
||
1692 |
// buttons |
|
1693 |
var buttons = document.createElement('p'); |
|
1694 |
||
1695 |
// save button |
|
1696 |
var btn_save = document.createElement('a'); |
|
1697 |
btn_save.className = 'abutton abutton_green'; |
|
1698 |
btn_save.style.fontWeight = 'bold'; |
|
1699 |
btn_save.appendChild(document.createTextNode($lang.get('acl_btn_save_preset'))); |
|
1700 |
btn_save.selectobj = select; |
|
1701 |
btn_save.onclick = function() |
|
1702 |
{ |
|
1703 |
if ( aclSavePreset() ) |
|
1704 |
{ |
|
1705 |
miniPromptDestroy(this); |
|
1706 |
} |
|
1707 |
return false; |
|
1708 |
} |
|
1709 |
btn_save.href = '#'; |
|
1710 |
buttons.appendChild(btn_save); |
|
1711 |
||
1712 |
buttons.appendChild(document.createTextNode(' ')); |
|
1713 |
||
1714 |
// cancel button |
|
1715 |
var btn_cancel = document.createElement('a'); |
|
1716 |
btn_cancel.className = 'abutton'; |
|
1717 |
btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel'))); |
|
1718 |
btn_cancel.onclick = function() |
|
1719 |
{ |
|
1720 |
miniPromptDestroy(this); |
|
1721 |
return false; |
|
1722 |
} |
|
1723 |
btn_cancel.href = '#'; |
|
1724 |
buttons.appendChild(btn_cancel); |
|
1725 |
||
1726 |
parent.appendChild(buttons); |
|
1727 |
||
1728 |
var timeout = ( aclDisableTransitionFX ) ? 10 : 1000; |
|
1729 |
setTimeout(function() |
|
1730 |
{ |
|
1731 |
input.focus(); |
|
1732 |
}, timeout); |
|
1733 |
}); |
|
1734 |
} |
|
1735 |
||
1736 |
function aclSavePreset() |
|
1737 |
{ |
|
1738 |
var input = document.getElementById(aclManagerID + '_preset_save'); |
|
1739 |
if ( trim(input.value) == '' ) |
|
1740 |
{ |
|
1741 |
alert($lang.get('acl_err_preset_name_empty')); |
|
1742 |
return false; |
|
1743 |
} |
|
1744 |
var form = document.forms[aclManagerID + '_formobj'], selections = {}; |
|
1745 |
var dbg = ''; |
|
1746 |
var warned_everyone = false; |
|
1747 |
for(var i in aclPermList) |
|
1748 |
{ |
|
1749 |
selections[aclPermList[i]] = getRadioState(form, aclPermList[i], ['i', 1, 2, 3, 4]); |
|
1750 |
// If we're editing permissions for everyone on the entire site and the |
|
1751 |
// admin selected to deny privileges, give a stern warning about it. |
|
1752 |
if ( selections[aclPermList[i]] == 1 && aclDataCache.target_type == 1 /* ACL_TYPE_GROUP */ && aclDataCache.target_id == 1 && !warned_everyone ) |
|
1753 |
{ |
|
1754 |
warned_everyone = true; |
|
1755 |
if ( !confirm($lang.get('acl_msg_deny_everyone_confirm')) ) |
|
1756 |
{ |
|
1757 |
return false; |
|
1758 |
} |
|
1759 |
} |
|
1760 |
dbg += aclPermList[i] + ': ' + selections[aclPermList[i]] + "\n"; |
|
1761 |
if(!selections[aclPermList[i]]) |
|
1762 |
{ |
|
1763 |
alert("Invalid return from getRadioState: "+i+": "+selections[i]+" ("+typeof(selections[i])+")"); |
|
1764 |
return false; |
|
1765 |
} |
|
1766 |
} |
|
1767 |
||
1768 |
var packet = toJSONString({ |
|
1769 |
mode: 'save_preset', |
|
1770 |
preset_name: input.value, |
|
1771 |
perms: selections |
|
1772 |
}); |
|
1773 |
||
1774 |
var whitey = whiteOutElement(document.getElementById(aclManagerID)); |
|
1775 |
||
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
787
diff
changeset
|
1776 |
ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(packet), function(ajax) |
679 | 1777 |
{ |
1778 |
if ( ajax.readyState == 4 && ajax.status == 200 ) |
|
1779 |
{ |
|
1780 |
if ( !check_json_response(ajax.responseText) ) |
|
1781 |
{ |
|
1782 |
whitey.parentNode.removeChild(whitey); |
|
1783 |
return handle_invalid_json(ajax.responseText); |
|
1784 |
} |
|
1785 |
var response = parseJSON(ajax.responseText); |
|
1786 |
if ( response.mode == 'error' ) |
|
1787 |
{ |
|
1788 |
whitey.parentNode.removeChild(whitey); |
|
1789 |
alert(response.error); |
|
1790 |
return false; |
|
1791 |
} |
|
1792 |
whiteOutReportSuccess(whitey); |
|
1793 |
} |
|
1794 |
}); |
|
1795 |
||
1796 |
return true; |
|
1797 |
} |
|
1798 |
||
1 | 1799 |
function array_keys(obj) |
1800 |
{ |
|
1801 |
keys = new Array(); |
|
1802 |
for(var i in obj) |
|
1803 |
keys.push(i); |
|
1804 |
return keys; |
|
1805 |
} |