author | Dan |
Fri, 18 Dec 2009 20:57:28 -0500 | |
changeset 1179 | ac861c01a764 |
parent 823 | 4596c40aaa94 |
child 1227 | bdac73ed481e |
permissions | -rw-r--r-- |
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 |
{ |
|
699
c7d737202d59
Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents:
658
diff
changeset
|
10 |
if ( $dynano(child).hasClass('themebutton_theme_system') ) |
435 | 11 |
{ |
699
c7d737202d59
Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents:
658
diff
changeset
|
12 |
if ( $dynano(child).hasClass('themebutton_theme_disabled') ) |
435 | 13 |
{ |
699
c7d737202d59
Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents:
658
diff
changeset
|
14 |
$dynano(child).rmClass('themebutton_theme_disabled') |
435 | 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
parents:
435
diff
changeset
|
43 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
47 |
}); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
48 |
// we've finished nukeing the existing interface, request editor data |
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
699
diff
changeset
|
49 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function(ajax) |
435 | 50 |
{ |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
55 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
58 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
61 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
62 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
63 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
diff
changeset
|
65 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
70 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
77 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
80 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
89 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
108 |
*/ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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 |
|
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
699
diff
changeset
|
124 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function(ajax) |
435 | 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
parents:
435
diff
changeset
|
128 |
theme_list.innerHTML = ''; |
435 | 129 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
465
diff
changeset
|
130 |
if ( !check_json_response(response) ) |
435 | 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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
233 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
259 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
262 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
273 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
diff
changeset
|
275 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
276 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
287 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
diff
changeset
|
289 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
290 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
301 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
diff
changeset
|
303 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
307 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
313 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
316 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
320 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
324 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
328 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
331 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
336 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
diff
changeset
|
338 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
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
parents:
435
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
parents:
435
diff
changeset
|
341 |
lbl_g_acl.appendChild(check); |
658 | 342 |
var str = 'groupcp_grp_' + g_name.toLowerCase(); |
343 |
var g_name_l10n = ( $lang.get(str) != str ) ? $lang.get(str) : g_name; |
|
344 |
lbl_g_acl.appendChild(document.createTextNode(g_name_l10n)); |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
345 |
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
parents:
435
diff
changeset
|
346 |
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
parents:
435
diff
changeset
|
347 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
348 |
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
parents:
435
diff
changeset
|
349 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
350 |
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
parents:
435
diff
changeset
|
351 |
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
parents:
435
diff
changeset
|
352 |
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
parents:
435
diff
changeset
|
353 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
354 |
// User addition field |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
355 |
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
parents:
435
diff
changeset
|
356 |
frm.action = 'javascript:ajaxThemeManagerHandleUserAdd();'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
357 |
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
parents:
435
diff
changeset
|
358 |
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
parents:
435
diff
changeset
|
359 |
f_useradd.type = 'text'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
360 |
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
parents:
435
diff
changeset
|
361 |
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
parents:
435
diff
changeset
|
362 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
363 |
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
parents:
435
diff
changeset
|
364 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
365 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
366 |
frm.appendChild(f_useradd); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
367 |
div_acl.appendChild(frm); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
368 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
369 |
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
parents:
435
diff
changeset
|
370 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
371 |
// User list |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
372 |
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
parents:
435
diff
changeset
|
373 |
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
parents:
435
diff
changeset
|
374 |
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
parents:
435
diff
changeset
|
375 |
div_users.id = 'themeed_user_list'; |
435 | 376 |
for ( var i = 0; i < data.group_list.length; i++ ) |
377 |
{ |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
378 |
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
parents:
435
diff
changeset
|
379 |
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
parents:
435
diff
changeset
|
380 |
continue; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
381 |
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
parents:
435
diff
changeset
|
382 |
var username = data.usernames[uid]; |
435 | 383 |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
384 |
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
parents:
435
diff
changeset
|
385 |
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
parents:
435
diff
changeset
|
386 |
useritem.userid = parseInt(uid); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
387 |
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
parents:
435
diff
changeset
|
388 |
deleter.href = '#'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
389 |
deleter.onclick = function() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
390 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
391 |
ajaxThemeManagerHandleUserRemoval(this); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
392 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
393 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
394 |
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
parents:
435
diff
changeset
|
395 |
useritem.appendChild(deleter); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
396 |
div_users.appendChild(useritem); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
397 |
div_users.appendChild(document.createElement('br')); |
435 | 398 |
} |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
399 |
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
parents:
435
diff
changeset
|
400 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
401 |
target.appendChild(div_acl); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
402 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
403 |
ajaxThemeManagerHandlePolicyClick(); |
435 | 404 |
|
405 |
var clearer = document.createElement('span'); |
|
406 |
clearer.className = 'menuclear'; |
|
407 |
target.appendChild(clearer); |
|
408 |
||
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
409 |
// Theme ID |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
410 |
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
parents:
435
diff
changeset
|
411 |
tid.type = 'hidden'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
412 |
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
parents:
435
diff
changeset
|
413 |
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
parents:
435
diff
changeset
|
414 |
target.appendChild(tid); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
415 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
416 |
// Save button |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
417 |
var raquo = unescape('%BB'); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
418 |
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
parents:
435
diff
changeset
|
419 |
savebtn.type = 'button'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
420 |
savebtn.style.fontWeight = 'bold'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
421 |
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
parents:
435
diff
changeset
|
422 |
savebtn.onclick = function() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
423 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
424 |
ajaxThemeManagerHandleSaveRequest(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
425 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
426 |
target.appendChild(savebtn); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
427 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
428 |
target.appendChild(document.createTextNode(' ')); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
429 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
430 |
// Cancel button |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
431 |
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
parents:
435
diff
changeset
|
432 |
savebtn.type = 'button'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
433 |
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
parents:
435
diff
changeset
|
434 |
savebtn.onclick = function() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
435 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
436 |
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
parents:
435
diff
changeset
|
437 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
438 |
target.appendChild(savebtn); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
439 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
440 |
target.appendChild(document.createTextNode(' ')); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
441 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
442 |
// Uninstall button |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
443 |
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
parents:
435
diff
changeset
|
444 |
savebtn.type = 'button'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
445 |
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
parents:
435
diff
changeset
|
446 |
savebtn.style.color = '#D84308'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
447 |
savebtn.onclick = function() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
448 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
449 |
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
parents:
435
diff
changeset
|
450 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
451 |
ajaxThemeManagerHandleUninstallClick(); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
452 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
453 |
target.appendChild(savebtn); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
454 |
|
435 | 455 |
// Fade it all in |
456 |
domOpacity(target, 0, 100, 500); |
|
457 |
f_name.focus(); |
|
458 |
} |
|
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
459 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
460 |
function ajaxThemeManagerHandlePolicyClick() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
461 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
462 |
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
parents:
435
diff
changeset
|
463 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
464 |
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
parents:
435
diff
changeset
|
465 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
466 |
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
parents:
435
diff
changeset
|
467 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
468 |
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
parents:
435
diff
changeset
|
469 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
470 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
471 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
472 |
function ajaxThemeManagerHandleUserAdd() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
473 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
474 |
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
parents:
435
diff
changeset
|
475 |
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
parents:
435
diff
changeset
|
476 |
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
parents:
435
diff
changeset
|
477 |
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
parents:
435
diff
changeset
|
478 |
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
parents:
435
diff
changeset
|
479 |
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
parents:
435
diff
changeset
|
480 |
img.style.marginLeft = '10px'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
481 |
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
parents:
435
diff
changeset
|
482 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
483 |
var req = toJSONString({ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
484 |
mode: 'uid_lookup', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
485 |
username: f_useradd.value |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
486 |
}); |
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
699
diff
changeset
|
487 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function(ajax) |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
488 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
489 |
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
parents:
435
diff
changeset
|
490 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
491 |
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
parents:
435
diff
changeset
|
492 |
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
parents:
435
diff
changeset
|
493 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
494 |
f_useradd.disabled = null; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
495 |
img.parentNode.removeChild(img); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
496 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
497 |
// process response |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
498 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
465
diff
changeset
|
499 |
if ( !check_json_response(response) ) |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
500 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
501 |
alert(response); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
502 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
503 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
504 |
response = parseJSON(response); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
505 |
if ( response.mode == 'error' ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
506 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
507 |
alert(response.error); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
508 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
509 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
510 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
511 |
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
parents:
435
diff
changeset
|
512 |
var username = response.username; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
513 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
514 |
// 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
parents:
435
diff
changeset
|
515 |
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
parents:
435
diff
changeset
|
516 |
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
parents:
435
diff
changeset
|
517 |
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
parents:
435
diff
changeset
|
518 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
519 |
var child = children[i]; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
520 |
if ( child.userid == uid ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
521 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
522 |
// 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
parents:
435
diff
changeset
|
523 |
var sister = child.nextSibling; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
524 |
div_users.removeChild(child); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
525 |
div_users.removeChild(sister); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
526 |
break; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
527 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
528 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
529 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
530 |
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
parents:
435
diff
changeset
|
531 |
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
parents:
435
diff
changeset
|
532 |
useritem.userid = parseInt(uid); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
533 |
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
parents:
435
diff
changeset
|
534 |
deleter.href = '#'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
535 |
deleter.onclick = function() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
536 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
537 |
ajaxThemeManagerHandleUserRemoval(this); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
538 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
539 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
540 |
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
parents:
435
diff
changeset
|
541 |
useritem.appendChild(deleter); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
542 |
div_users.appendChild(useritem); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
543 |
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
parents:
435
diff
changeset
|
544 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
545 |
}); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
546 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
547 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
548 |
function ajaxThemeManagerHandleUserRemoval(el) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
549 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
550 |
var parent = el.parentNode; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
551 |
var uid = parent.userid; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
552 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
553 |
var grandparent = parent.parentNode; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
554 |
var sister = parent.nextSibling; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
555 |
grandparent.removeChild(parent); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
556 |
grandparent.removeChild(sister); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
557 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
558 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
559 |
function ajaxThemeManagerHandleSaveRequest() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
560 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
561 |
// 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
parents:
435
diff
changeset
|
562 |
var md = false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
563 |
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
parents:
435
diff
changeset
|
564 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
565 |
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
parents:
435
diff
changeset
|
566 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
567 |
md = true; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
568 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
569 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
570 |
var policy = 'allow_all'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
571 |
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
parents:
435
diff
changeset
|
572 |
policy = 'whitelist'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
573 |
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
parents:
435
diff
changeset
|
574 |
policy = 'blacklist'; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
575 |
var json_packet = { |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
576 |
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
parents:
435
diff
changeset
|
577 |
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
parents:
435
diff
changeset
|
578 |
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
parents:
435
diff
changeset
|
579 |
make_default: md, |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
580 |
group_policy: policy, |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
581 |
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
parents:
435
diff
changeset
|
582 |
}; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
583 |
var acl_list = []; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
584 |
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
parents:
435
diff
changeset
|
585 |
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
parents:
435
diff
changeset
|
586 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
587 |
if ( checks[i].checked ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
588 |
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
parents:
435
diff
changeset
|
589 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
590 |
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
parents:
435
diff
changeset
|
591 |
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
parents:
435
diff
changeset
|
592 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
593 |
if ( spans[i].userid ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
594 |
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
parents:
435
diff
changeset
|
595 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
596 |
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
parents:
435
diff
changeset
|
597 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
598 |
var json_send = { |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
599 |
mode: 'save_theme', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
600 |
theme_data: json_packet |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
601 |
}; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
602 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
603 |
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
parents:
435
diff
changeset
|
604 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
605 |
// Request the save |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
606 |
var parent = document.getElementById('ajaxPageContainer'); |
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
699
diff
changeset
|
607 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function(ajax) |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
608 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
609 |
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
parents:
435
diff
changeset
|
610 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
611 |
// process response |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
612 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
465
diff
changeset
|
613 |
if ( !check_json_response(response) ) |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
614 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
615 |
// 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
parents:
435
diff
changeset
|
616 |
parent.innerHTML = response; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
617 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
618 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
619 |
response = parseJSON(response); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
620 |
if ( response.mode == 'error' ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
621 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
622 |
alert(response.error); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
623 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
624 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
625 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
626 |
}); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
627 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
628 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
629 |
function ajaxThemeManagerHandleUninstallClick() |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
630 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
631 |
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
parents:
435
diff
changeset
|
632 |
var json_send = { |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
633 |
mode: 'uninstall', |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
634 |
theme_id: theme_id |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
635 |
}; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
636 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
637 |
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
parents:
435
diff
changeset
|
638 |
|
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
639 |
// Request the action |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
640 |
var parent = document.getElementById('ajaxPageContainer'); |
823
4596c40aaa94
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents:
699
diff
changeset
|
641 |
ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function(ajax) |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
642 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
643 |
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
parents:
435
diff
changeset
|
644 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
645 |
// process response |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
646 |
var response = String(ajax.responseText + ''); |
651
ce9d78d7251d
Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents:
465
diff
changeset
|
647 |
if ( !check_json_response(response) ) |
465
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
648 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
649 |
// 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
parents:
435
diff
changeset
|
650 |
parent.innerHTML = response; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
651 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
652 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
653 |
response = parseJSON(response); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
654 |
if ( response.mode == 'error' ) |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
655 |
{ |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
656 |
alert(response.error); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
657 |
return false; |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
658 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
659 |
} |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
660 |
}); |
fe8b8c9b54e8
Finished theme manager to the point where it's in a working state in Firefox and hopefully IE.
Dan
parents:
435
diff
changeset
|
661 |
} |