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