435
|
1 |
function ajaxToggleSystemThemes()
|
|
2 |
{
|
|
3 |
var theme_list = document.getElementById('theme_list_edit');
|
|
4 |
var mode = ( theme_list.sys_shown ) ? 'hide' : 'show';
|
|
5 |
for ( var i = 0; i < theme_list.childNodes.length; i++ )
|
|
6 |
{
|
|
7 |
var child = theme_list.childNodes[i];
|
|
8 |
if ( child.tagName == 'DIV' )
|
|
9 |
{
|
|
10 |
if ( $(child).hasClass('themebutton_theme_system') )
|
|
11 |
{
|
|
12 |
if ( $(child).hasClass('themebutton_theme_disabled') )
|
|
13 |
{
|
|
14 |
$(child).rmClass('themebutton_theme_disabled')
|
|
15 |
}
|
|
16 |
if ( mode == 'show' )
|
|
17 |
{
|
|
18 |
domObjChangeOpac(0, child);
|
|
19 |
child.style.display = 'block';
|
|
20 |
domOpacity(child, 0, 100, 1000);
|
|
21 |
}
|
|
22 |
else
|
|
23 |
{
|
|
24 |
domOpacity(child, 100, 0, 1000);
|
|
25 |
setTimeout("document.getElementById('" + child.id + "').style.display = 'none';", 1050);
|
|
26 |
}
|
|
27 |
}
|
|
28 |
}
|
|
29 |
}
|
|
30 |
theme_list.sys_shown = ( mode == 'show' );
|
|
31 |
document.getElementById('systheme_toggler').innerHTML = ( mode == 'hide' ) ? $lang.get('acptm_btn_system_themes_show') : $lang.get('acptm_btn_system_themes_hide');
|
|
32 |
}
|
|
33 |
|
|
34 |
function ajaxInstallTheme(theme_id)
|
|
35 |
{
|
|
36 |
var thediv = document.getElementById('themebtn_install_' + theme_id);
|
|
37 |
if ( !thediv )
|
|
38 |
return false;
|
|
39 |
thediv.removeChild(thediv.getElementsByTagName('a')[0]);
|
|
40 |
var status = document.createElement('div');
|
|
41 |
status.className = 'status';
|
|
42 |
thediv.appendChild(status);
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
43 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
44 |
var req = toJSONString({
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
45 |
mode: 'install',
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
46 |
theme_id: theme_id
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
47 |
});
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
48 |
// we've finished nukeing the existing interface, request editor data
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
49 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
|
435
|
50 |
{
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
51 |
if ( ajax.readyState == 4 && ajax.status == 200 )
|
435
|
52 |
{
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
53 |
var response = String(ajax.responseText + '');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
54 |
if ( response.substr(0, 1) == '{' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
55 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
56 |
response = parseJSON(response);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
57 |
if ( response.mode == 'error' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
58 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
59 |
alert(response.error);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
60 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
61 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
62 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
63 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
64 |
var theme_list = document.getElementById('theme_list_edit');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
65 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
66 |
var btn = document.createElement('div');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
67 |
btn.className = 'themebutton';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
68 |
btn.style.backgroundImage = thediv.style.backgroundImage;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
69 |
btn.id = 'themebtn_edit_' + theme_id;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
70 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
71 |
var a = document.createElement('a');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
72 |
a.className = 'tb-inner';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
73 |
a.appendChild(document.createTextNode($lang.get('acptm_btn_theme_edit')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
74 |
a.appendChild(document.createTextNode("\n"));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
75 |
a.theme_id = theme_id;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
76 |
a.onclick = function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
77 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
78 |
ajaxEditTheme(this.theme_id);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
79 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
80 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
81 |
a.href = '#';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
82 |
var span = document.createElement('span');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
83 |
span.className = 'themename';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
84 |
span.appendChild(document.createTextNode(thediv.getAttribute('enano:themename')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
85 |
a.appendChild(span);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
86 |
btn.appendChild(a);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
87 |
btn.setAttribute('enano:themename', thediv.getAttribute('enano:themename'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
88 |
theme_list.appendChild(btn);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
89 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
90 |
thediv.parentNode.removeChild(thediv);
|
435
|
91 |
}
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
92 |
});
|
435
|
93 |
}
|
|
94 |
|
|
95 |
function ajaxEditTheme(theme_id)
|
|
96 |
{
|
|
97 |
// Fade out and subsequently destroy the entire list, then make an
|
|
98 |
// ajax request to the theme manager for the theme info via JSON
|
|
99 |
var theme_list = document.getElementById('theme_list_edit').parentNode;
|
|
100 |
var backgroundImage = document.getElementById('themebtn_edit_' + theme_id).style.backgroundImage;
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
101 |
/*
|
435
|
102 |
for ( var i = 0; i < theme_list.childNodes.length; i++ )
|
|
103 |
{
|
|
104 |
var el = theme_list.childNodes[i];
|
|
105 |
if ( el.tagName )
|
|
106 |
domOpacity(el, 100, 0, 1000);
|
|
107 |
}
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
108 |
*/
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
109 |
var thediv = document.getElementById('themebtn_edit_' + theme_id);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
110 |
if ( !thediv )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
111 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
112 |
thediv.removeChild(thediv.getElementsByTagName('a')[0]);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
113 |
var status = document.createElement('div');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
114 |
status.className = 'status';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
115 |
thediv.appendChild(status);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
116 |
|
435
|
117 |
setTimeout(function()
|
|
118 |
{
|
|
119 |
var req = toJSONString({
|
|
120 |
mode: 'fetch_theme',
|
|
121 |
theme_id: theme_id
|
|
122 |
});
|
|
123 |
// we've finished nukeing the existing interface, request editor data
|
|
124 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
|
|
125 |
{
|
|
126 |
if ( ajax.readyState == 4 && ajax.status == 200 )
|
|
127 |
{
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
128 |
theme_list.innerHTML = '';
|
435
|
129 |
var response = String(ajax.responseText + '');
|
|
130 |
if ( response.substr(0, 1) != '{' )
|
|
131 |
{
|
|
132 |
alert(response);
|
|
133 |
return false;
|
|
134 |
}
|
|
135 |
response = parseJSON(response);
|
|
136 |
if ( response.mode == 'error' )
|
|
137 |
{
|
|
138 |
alert(response.error);
|
|
139 |
return false;
|
|
140 |
}
|
|
141 |
response.background_image = backgroundImage;
|
|
142 |
ajaxBuildThemeEditor(response, theme_list);
|
|
143 |
}
|
|
144 |
});
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
145 |
}, 200);
|
435
|
146 |
}
|
|
147 |
|
|
148 |
function ajaxBuildThemeEditor(data, target)
|
|
149 |
{
|
|
150 |
// Build the theme editor interface
|
|
151 |
// Init opacity
|
|
152 |
domObjChangeOpac(0, target);
|
|
153 |
|
|
154 |
// Theme preview
|
|
155 |
var preview = document.createElement('div');
|
|
156 |
preview.style.border = '1px solid #F0F0F0';
|
|
157 |
preview.style.padding = '5px';
|
|
158 |
preview.style.width = '216px';
|
|
159 |
preview.style.height = '150px';
|
|
160 |
preview.style.backgroundImage = data.background_image;
|
|
161 |
preview.style.backgroundRepeat = 'no-repeat';
|
|
162 |
preview.style.backgroundPosition = 'center center';
|
|
163 |
preview.style.cssFloat = 'right';
|
|
164 |
preview.style.styleFloat = 'right';
|
|
165 |
|
|
166 |
target.appendChild(preview);
|
|
167 |
|
|
168 |
// Heading
|
|
169 |
var h3 = document.createElement('h3');
|
|
170 |
h3.appendChild(document.createTextNode($lang.get('acptm_heading_theme_edit', { theme_name: data.theme_name })));
|
|
171 |
target.appendChild(h3);
|
|
172 |
|
|
173 |
// Field: Theme name
|
|
174 |
var l_name = document.createElement('label');
|
|
175 |
l_name.appendChild(document.createTextNode($lang.get('acptm_field_theme_name') + ' '));
|
|
176 |
var f_name = document.createElement('input');
|
|
177 |
f_name.type = 'text';
|
|
178 |
f_name.id = 'themeed_field_name';
|
|
179 |
f_name.value = data.theme_name;
|
|
180 |
f_name.size = '40';
|
|
181 |
l_name.appendChild(f_name);
|
|
182 |
target.appendChild(l_name);
|
|
183 |
|
|
184 |
target.appendChild(document.createElement('br'));
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
185 |
target.appendChild(document.createElement('br'));
|
435
|
186 |
|
|
187 |
// Field: default style
|
|
188 |
var l_style = document.createElement('label');
|
|
189 |
l_style.appendChild(document.createTextNode($lang.get('acptm_field_default_style') + ' '));
|
|
190 |
var f_style = document.createElement('select');
|
|
191 |
f_style.id = 'themeed_field_style';
|
|
192 |
var opts = [];
|
|
193 |
for ( var i = 0; i < data.css.length; i++ )
|
|
194 |
{
|
|
195 |
if ( data.css[i] == '_printable' )
|
|
196 |
continue;
|
|
197 |
|
|
198 |
opts[i] = document.createElement('option');
|
|
199 |
opts[i].value = data.css[i];
|
|
200 |
opts[i].appendChild(document.createTextNode(data.css[i]));
|
|
201 |
if ( data.default_style == data.css[i] )
|
|
202 |
{
|
|
203 |
opts[i].selected = true;
|
|
204 |
}
|
|
205 |
f_style.appendChild(opts[i]);
|
|
206 |
}
|
|
207 |
l_style.appendChild(f_style);
|
|
208 |
target.appendChild(l_style);
|
|
209 |
|
|
210 |
target.appendChild(document.createElement('br'));
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
211 |
target.appendChild(document.createElement('br'));
|
435
|
212 |
|
|
213 |
// Default theme
|
|
214 |
target.appendChild(document.createTextNode($lang.get('acptm_field_default_theme') + ' '));
|
|
215 |
if ( data.is_default )
|
|
216 |
{
|
|
217 |
var l_default = document.createElement('b');
|
|
218 |
l_default.appendChild(document.createTextNode($lang.get('acptm_field_default_msg_current')));
|
|
219 |
}
|
|
220 |
else
|
|
221 |
{
|
|
222 |
var l_default = document.createElement('label');
|
|
223 |
var f_default = document.createElement('input');
|
|
224 |
f_default.type = 'checkbox';
|
|
225 |
f_default.id = 'themeed_field_default';
|
|
226 |
l_default.appendChild(f_default);
|
|
227 |
l_default.appendChild(document.createTextNode($lang.get('acptm_field_default_btn_make_default')));
|
|
228 |
}
|
|
229 |
target.appendChild(l_default);
|
|
230 |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
231 |
target.appendChild(document.createElement('br'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
232 |
target.appendChild(document.createElement('br'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
233 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
234 |
// Disable theme
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
235 |
var disable_span = document.createElement('span');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
236 |
disable_span.appendChild(document.createTextNode($lang.get('acptm_field_disable_title') + ' '));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
237 |
target.appendChild(disable_span);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
238 |
var l_disable = document.createElement('label');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
239 |
var f_disable = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
240 |
f_disable.type = 'checkbox';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
241 |
f_disable.id = 'themeed_field_disable';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
242 |
if ( !data.enabled )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
243 |
f_disable.setAttribute('checked', 'checked');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
244 |
l_disable.style.fontWeight = 'bold';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
245 |
l_disable.appendChild(f_disable);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
246 |
l_disable.appendChild(document.createTextNode($lang.get('acptm_field_disable')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
247 |
target.appendChild(l_disable);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
248 |
|
435
|
249 |
// Availability policy
|
|
250 |
var h3 = document.createElement('h3');
|
|
251 |
h3.appendChild(document.createTextNode($lang.get('acptm_heading_theme_groups')));
|
|
252 |
target.appendChild(h3);
|
|
253 |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
254 |
// Label for the whole field
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
255 |
var p_d_policy = document.createElement('p');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
256 |
p_d_policy.style.fontWeight = 'bold';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
257 |
p_d_policy.appendChild(document.createTextNode($lang.get('acptm_field_policy')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
258 |
target.appendChild(p_d_policy);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
259 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
260 |
// Wrapper for options
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
261 |
var p_f_policy = document.createElement('p');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
262 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
263 |
// Option: allow all
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
264 |
var l_policy_allow_all = document.createElement('label');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
265 |
var f_policy_allow_all = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
266 |
f_policy_allow_all.type = 'radio';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
267 |
f_policy_allow_all.id = 'themeed_field_policy_allow_all';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
268 |
f_policy_allow_all.name = 'themeed_field_policy';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
269 |
f_policy_allow_all.value = 'allow_all';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
270 |
l_policy_allow_all.appendChild(f_policy_allow_all);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
271 |
l_policy_allow_all.appendChild(document.createTextNode(' ' + $lang.get('acptm_field_policy_allow_all')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
272 |
if ( data.group_policy == 'allow_all' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
273 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
274 |
f_policy_allow_all.setAttribute('checked', 'checked');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
275 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
276 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
277 |
// Option: whitelist
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
278 |
var l_policy_whitelist = document.createElement('label');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
279 |
var f_policy_whitelist = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
280 |
f_policy_whitelist.type = 'radio';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
281 |
f_policy_whitelist.id = 'themeed_field_policy_whitelist';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
282 |
f_policy_whitelist.name = 'themeed_field_policy';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
283 |
f_policy_whitelist.value = 'whitelist';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
284 |
l_policy_whitelist.appendChild(f_policy_whitelist);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
285 |
l_policy_whitelist.appendChild(document.createTextNode(' ' + $lang.get('acptm_field_policy_whitelist')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
286 |
if ( data.group_policy == 'whitelist' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
287 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
288 |
f_policy_whitelist.setAttribute('checked', 'checked');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
289 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
290 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
291 |
// Option: blacklist
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
292 |
var l_policy_blacklist = document.createElement('label');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
293 |
var f_policy_blacklist = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
294 |
f_policy_blacklist.type = 'radio';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
295 |
f_policy_blacklist.id = 'themeed_field_policy_blacklist';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
296 |
f_policy_blacklist.name = 'themeed_field_policy';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
297 |
f_policy_blacklist.value = 'blacklist';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
298 |
l_policy_blacklist.appendChild(f_policy_blacklist);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
299 |
l_policy_blacklist.appendChild(document.createTextNode(' ' + $lang.get('acptm_field_policy_blacklist')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
300 |
if ( data.group_policy == 'blacklist' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
301 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
302 |
f_policy_blacklist.setAttribute('checked', 'checked');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
303 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
304 |
f_policy_allow_all.onclick = ajaxThemeManagerHandlePolicyClick;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
305 |
f_policy_whitelist.onclick = ajaxThemeManagerHandlePolicyClick;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
306 |
f_policy_blacklist.onclick = ajaxThemeManagerHandlePolicyClick;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
307 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
308 |
p_f_policy.appendChild(l_policy_allow_all);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
309 |
p_f_policy.appendChild(document.createElement('br'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
310 |
p_f_policy.appendChild(l_policy_whitelist);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
311 |
p_f_policy.appendChild(document.createElement('br'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
312 |
p_f_policy.appendChild(l_policy_blacklist);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
313 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
314 |
target.appendChild(p_d_policy);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
315 |
target.appendChild(p_f_policy);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
316 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
317 |
var div_acl = document.createElement('div');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
318 |
div_acl.id = 'themeed_acl_box';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
319 |
div_acl.style.margin = '0 0 10px 30px';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
320 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
321 |
var h3_g = document.createElement('h3');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
322 |
h3_g.appendChild(document.createTextNode($lang.get('acptm_field_acl_heading_groups')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
323 |
div_acl.appendChild(h3_g);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
324 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
325 |
var div_groups = document.createElement('div');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
326 |
div_groups.style.border = '1px solid #E8E8E8';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
327 |
div_groups.id = 'themeed_group_list';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
328 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
329 |
// Group list
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
330 |
for ( var i in data.group_names )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
331 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
332 |
var g_name = data.group_names[i];
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
333 |
var check = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
334 |
check.type = 'checkbox';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
335 |
if ( in_array("g:" + i, data.group_list) )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
336 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
337 |
check.setAttribute('checked', 'checked');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
338 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
339 |
check.group_id = parseInt(i);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
340 |
var lbl_g_acl = document.createElement('label');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
341 |
lbl_g_acl.appendChild(check);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
342 |
// FIXME: l10n on group name
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
343 |
lbl_g_acl.appendChild(document.createTextNode(g_name));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
344 |
div_groups.appendChild(lbl_g_acl);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
345 |
div_groups.appendChild(document.createElement('br'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
346 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
347 |
div_acl.appendChild(div_groups);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
348 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
349 |
var h3_u = document.createElement('h3');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
350 |
h3_u.appendChild(document.createTextNode($lang.get('acptm_field_acl_heading_users')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
351 |
div_acl.appendChild(h3_u);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
352 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
353 |
// User addition field
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
354 |
var frm = document.createElement('form');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
355 |
frm.action = 'javascript:ajaxThemeManagerHandleUserAdd();';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
356 |
frm.appendChild(document.createTextNode($lang.get('acptm_field_acl_add_user')));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
357 |
var f_useradd = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
358 |
f_useradd.type = 'text';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
359 |
f_useradd.id = 'themeed_field_adduser';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
360 |
f_useradd.onkeyup = function(e)
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
361 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
362 |
new AutofillUsername(this, e, false);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
363 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
364 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
365 |
frm.appendChild(f_useradd);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
366 |
div_acl.appendChild(frm);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
367 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
368 |
div_acl.appendChild(document.createElement('br'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
369 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
370 |
// User list
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
371 |
var div_users = document.createElement('div');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
372 |
div_users.style.border = '1px solid #E8E8E8';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
373 |
div_users.style.padding = '4px';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
374 |
div_users.id = 'themeed_user_list';
|
435
|
375 |
for ( var i = 0; i < data.group_list.length; i++ )
|
|
376 |
{
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
377 |
var id = data.group_list[i];
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
378 |
if ( id.substr(0, 2) != 'u:' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
379 |
continue;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
380 |
var uid = id.substr(2);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
381 |
var username = data.usernames[uid];
|
435
|
382 |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
383 |
var useritem = document.createElement('span');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
384 |
useritem.appendChild(document.createTextNode(username + ' '));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
385 |
useritem.userid = parseInt(uid);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
386 |
var deleter = document.createElement('a');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
387 |
deleter.href = '#';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
388 |
deleter.onclick = function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
389 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
390 |
ajaxThemeManagerHandleUserRemoval(this);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
391 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
392 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
393 |
deleter.appendChild(document.createTextNode('[X]'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
394 |
useritem.appendChild(deleter);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
395 |
div_users.appendChild(useritem);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
396 |
div_users.appendChild(document.createElement('br'));
|
435
|
397 |
}
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
398 |
div_acl.appendChild(div_users);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
399 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
400 |
target.appendChild(div_acl);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
401 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
402 |
ajaxThemeManagerHandlePolicyClick();
|
435
|
403 |
|
|
404 |
var clearer = document.createElement('span');
|
|
405 |
clearer.className = 'menuclear';
|
|
406 |
target.appendChild(clearer);
|
|
407 |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
408 |
// Theme ID
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
409 |
var tid = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
410 |
tid.type = 'hidden';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
411 |
tid.id = 'themeed_theme_id';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
412 |
tid.value = data.theme_id;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
413 |
target.appendChild(tid);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
414 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
415 |
// Save button
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
416 |
var raquo = unescape('%BB');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
417 |
var savebtn = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
418 |
savebtn.type = 'button';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
419 |
savebtn.style.fontWeight = 'bold';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
420 |
savebtn.value = $lang.get('etc_save_changes') + ' ' + raquo;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
421 |
savebtn.onclick = function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
422 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
423 |
ajaxThemeManagerHandleSaveRequest();
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
424 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
425 |
target.appendChild(savebtn);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
426 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
427 |
target.appendChild(document.createTextNode(' '));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
428 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
429 |
// Cancel button
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
430 |
var savebtn = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
431 |
savebtn.type = 'button';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
432 |
savebtn.value = $lang.get('etc_cancel');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
433 |
savebtn.onclick = function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
434 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
435 |
ajaxPage(namespace_list['Admin'] + 'ThemeManager');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
436 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
437 |
target.appendChild(savebtn);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
438 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
439 |
target.appendChild(document.createTextNode(' '));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
440 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
441 |
// Uninstall button
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
442 |
var savebtn = document.createElement('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
443 |
savebtn.type = 'button';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
444 |
savebtn.value = $lang.get('acptm_btn_uninstall_theme');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
445 |
savebtn.style.color = '#D84308';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
446 |
savebtn.onclick = function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
447 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
448 |
if ( !confirm($lang.get('acptm_msg_uninstall_confirm')) )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
449 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
450 |
ajaxThemeManagerHandleUninstallClick();
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
451 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
452 |
target.appendChild(savebtn);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
453 |
|
435
|
454 |
// Fade it all in
|
|
455 |
domOpacity(target, 0, 100, 500);
|
|
456 |
f_name.focus();
|
|
457 |
}
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
458 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
459 |
function ajaxThemeManagerHandlePolicyClick()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
460 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
461 |
if ( document.getElementById('themeed_field_policy_allow_all').checked )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
462 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
463 |
document.getElementById('themeed_acl_box').style.display = 'none';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
464 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
465 |
else if ( document.getElementById('themeed_field_policy_whitelist').checked || document.getElementById('themeed_field_policy_blacklist').checked )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
466 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
467 |
document.getElementById('themeed_acl_box').style.display = 'block';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
468 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
469 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
470 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
471 |
function ajaxThemeManagerHandleUserAdd()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
472 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
473 |
var f_useradd = document.getElementById('themeed_field_adduser');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
474 |
f_useradd.setAttribute('disabled', 'disabled');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
475 |
var parent = f_useradd.parentNode;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
476 |
var img = document.createElement('img');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
477 |
img.src = ajax_load_icon;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
478 |
img.id = 'themeed_useradd_status';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
479 |
img.style.marginLeft = '10px';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
480 |
insertAfter(parent, img, f_useradd);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
481 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
482 |
var req = toJSONString({
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
483 |
mode: 'uid_lookup',
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
484 |
username: f_useradd.value
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
485 |
});
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
486 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
487 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
488 |
if ( ajax.readyState == 4 && ajax.status == 200 )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
489 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
490 |
var img = document.getElementById('themeed_useradd_status');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
491 |
var f_useradd = document.getElementById('themeed_field_adduser');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
492 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
493 |
f_useradd.disabled = null;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
494 |
img.parentNode.removeChild(img);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
495 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
496 |
// process response
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
497 |
var response = String(ajax.responseText + '');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
498 |
if ( response.substr(0, 1) != '{' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
499 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
500 |
alert(response);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
501 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
502 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
503 |
response = parseJSON(response);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
504 |
if ( response.mode == 'error' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
505 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
506 |
alert(response.error);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
507 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
508 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
509 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
510 |
var uid = parseInt(response.uid);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
511 |
var username = response.username;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
512 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
513 |
// Loop through the list of users and remove any existing ones with the same uid
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
514 |
var div_users = document.getElementById('themeed_user_list');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
515 |
var children = div_users.getElementsByTagName('span');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
516 |
for ( var i = 0; i < children.length; i++ )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
517 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
518 |
var child = children[i];
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
519 |
if ( child.userid == uid )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
520 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
521 |
// the sister is the br element next to the span with the checkbox/text
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
522 |
var sister = child.nextSibling;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
523 |
div_users.removeChild(child);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
524 |
div_users.removeChild(sister);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
525 |
break;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
526 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
527 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
528 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
529 |
var useritem = document.createElement('span');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
530 |
useritem.appendChild(document.createTextNode(username + ' '));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
531 |
useritem.userid = parseInt(uid);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
532 |
var deleter = document.createElement('a');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
533 |
deleter.href = '#';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
534 |
deleter.onclick = function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
535 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
536 |
ajaxThemeManagerHandleUserRemoval(this);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
537 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
538 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
539 |
deleter.appendChild(document.createTextNode('[X]'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
540 |
useritem.appendChild(deleter);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
541 |
div_users.appendChild(useritem);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
542 |
div_users.appendChild(document.createElement('br'));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
543 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
544 |
});
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
545 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
546 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
547 |
function ajaxThemeManagerHandleUserRemoval(el)
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
548 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
549 |
var parent = el.parentNode;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
550 |
var uid = parent.userid;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
551 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
552 |
var grandparent = parent.parentNode;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
553 |
var sister = parent.nextSibling;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
554 |
grandparent.removeChild(parent);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
555 |
grandparent.removeChild(sister);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
556 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
557 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
558 |
function ajaxThemeManagerHandleSaveRequest()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
559 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
560 |
// Build a JSON condensed request
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
561 |
var md = false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
562 |
if ( document.getElementById('themeed_field_default') )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
563 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
564 |
if ( document.getElementById('themeed_field_default').checked )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
565 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
566 |
md = true;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
567 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
568 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
569 |
var policy = 'allow_all';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
570 |
if ( document.getElementById('themeed_field_policy_whitelist').checked )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
571 |
policy = 'whitelist';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
572 |
else if ( document.getElementById('themeed_field_policy_blacklist').checked )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
573 |
policy = 'blacklist';
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
574 |
var json_packet = {
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
575 |
theme_id: document.getElementById('themeed_theme_id').value,
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
576 |
theme_name: document.getElementById('themeed_field_name').value,
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
577 |
default_style: document.getElementById('themeed_field_style').value,
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
578 |
make_default: md,
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
579 |
group_policy: policy,
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
580 |
enabled: ( document.getElementById('themeed_field_disable').checked ? false : true )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
581 |
};
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
582 |
var acl_list = [];
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
583 |
var checks = document.getElementById('themeed_group_list').getElementsByTagName('input');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
584 |
for ( var i = 0; i < checks.length; i++ )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
585 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
586 |
if ( checks[i].checked )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
587 |
acl_list.push('g:' + checks[i].group_id);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
588 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
589 |
var spans = document.getElementById('themeed_user_list').getElementsByTagName('span');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
590 |
for ( var i = 0; i < spans.length; i++ )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
591 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
592 |
if ( spans[i].userid )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
593 |
acl_list.push('u:' + spans[i].userid);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
594 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
595 |
json_packet.group_list = acl_list;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
596 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
597 |
var json_send = {
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
598 |
mode: 'save_theme',
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
599 |
theme_data: json_packet
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
600 |
};
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
601 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
602 |
json_send = ajaxEscape(toJSONString(json_send));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
603 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
604 |
// Request the save
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
605 |
var parent = document.getElementById('ajaxPageContainer');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
606 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
607 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
608 |
if ( ajax.readyState == 4 && ajax.status == 200 )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
609 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
610 |
// process response
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
611 |
var response = String(ajax.responseText + '');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
612 |
if ( response.substr(0, 1) != '{' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
613 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
614 |
// For this we actually *expect* an HTML response.
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
615 |
parent.innerHTML = response;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
616 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
617 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
618 |
response = parseJSON(response);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
619 |
if ( response.mode == 'error' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
620 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
621 |
alert(response.error);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
622 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
623 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
624 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
625 |
});
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
626 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
627 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
628 |
function ajaxThemeManagerHandleUninstallClick()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
629 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
630 |
var theme_id = document.getElementById('themeed_theme_id').value;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
631 |
var json_send = {
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
632 |
mode: 'uninstall',
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
633 |
theme_id: theme_id
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
634 |
};
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
635 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
636 |
json_send = ajaxEscape(toJSONString(json_send));
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
637 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
638 |
// Request the action
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
639 |
var parent = document.getElementById('ajaxPageContainer');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
640 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function()
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
641 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
642 |
if ( ajax.readyState == 4 && ajax.status == 200 )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
643 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
644 |
// process response
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
645 |
var response = String(ajax.responseText + '');
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
646 |
if ( response.substr(0, 1) != '{' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
647 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
648 |
// For this we actually *expect* an HTML response.
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
649 |
parent.innerHTML = response;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
650 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
651 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
652 |
response = parseJSON(response);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
653 |
if ( response.mode == 'error' )
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
654 |
{
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
655 |
alert(response.error);
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
656 |
return false;
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
657 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
658 |
}
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
659 |
});
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
diff
changeset
|
660 |
}
|