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