author | Dan |
Thu, 12 Jul 2007 15:32:15 -0400 | |
changeset 69 | 63638a42cee9 |
parent 60 | 71b50f8c8f85 |
child 76 | 608dee512bf0 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
2 |
* AJAX applets |
|
3 |
*/ |
|
4 |
||
5 |
function ajaxGet(uri, f) { |
|
6 |
if (window.XMLHttpRequest) { |
|
7 |
ajax = new XMLHttpRequest(); |
|
8 |
} else { |
|
9 |
if (window.ActiveXObject) { |
|
10 |
ajax = new ActiveXObject("Microsoft.XMLHTTP"); |
|
11 |
} else { |
|
12 |
alert('Enano client-side runtime error: No AJAX support, unable to continue'); |
|
13 |
return; |
|
14 |
} |
|
15 |
} |
|
16 |
ajax.onreadystatechange = f; |
|
17 |
ajax.open('GET', uri, true); |
|
18 |
ajax.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" ); |
|
19 |
ajax.send(null); |
|
20 |
} |
|
21 |
||
22 |
function ajaxPost(uri, parms, f) { |
|
23 |
if (window.XMLHttpRequest) { |
|
24 |
ajax = new XMLHttpRequest(); |
|
25 |
} else { |
|
26 |
if (window.ActiveXObject) { |
|
27 |
ajax = new ActiveXObject("Microsoft.XMLHTTP"); |
|
28 |
} else { |
|
29 |
alert('Enano client-side runtime error: No AJAX support, unable to continue'); |
|
30 |
return; |
|
31 |
} |
|
32 |
} |
|
33 |
ajax.onreadystatechange = f; |
|
34 |
ajax.open('POST', uri, true); |
|
35 |
ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
32
diff
changeset
|
36 |
// Setting Content-length in Safari triggers a warning |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
32
diff
changeset
|
37 |
if ( !is_Safari ) |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
32
diff
changeset
|
38 |
{ |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
32
diff
changeset
|
39 |
ajax.setRequestHeader("Content-length", parms.length); |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
32
diff
changeset
|
40 |
} |
1 | 41 |
ajax.setRequestHeader("Connection", "close"); |
42 |
ajax.send(parms); |
|
43 |
} |
|
44 |
||
45 |
function ajaxEscape(text) |
|
46 |
{ |
|
47 |
text = escape(text); |
|
48 |
text = text.replace(/\+/g, '%2B', text); |
|
49 |
return text; |
|
50 |
} |
|
51 |
||
52 |
// Page editor |
|
53 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
54 |
function ajaxEditor() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
55 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
56 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
57 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
58 |
return true; |
1 | 59 |
setAjaxLoading(); |
60 |
ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() { |
|
61 |
if(ajax.readyState == 4) { |
|
62 |
unsetAjaxLoading(); |
|
63 |
if(edit_open) { |
|
64 |
c=confirm('Do you really want to revert your changes?'); |
|
65 |
if(!c) return; |
|
66 |
} |
|
67 |
edit_open = true; |
|
68 |
selectButtonMajor('article'); |
|
69 |
selectButtonMinor('edit'); |
|
70 |
if(in_array('ajaxEditArea', grippied_textareas)) |
|
71 |
{ |
|
72 |
// Allow the textarea grippifier to re-create the resizer control on the textarea |
|
73 |
grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
|
74 |
} |
|
75 |
disableUnload('If you do, any changes that you have made to this page will be lost.'); |
|
76 |
var switcher = ( readCookie('enano_editor_mode') == 'tinymce' ) ? |
|
77 |
'<a href="#" onclick="setEditorText(); return false;">wikitext editor</a> | graphical editor' : |
|
78 |
'wikitext editor | <a href="#" onclick="setEditorMCE(); return false;">graphical editor</a>' ; |
|
79 |
document.getElementById('ajaxEditContainer').innerHTML = '\ |
|
80 |
<div id="mdgPreviewContainer"></div> \ |
|
81 |
<span id="switcher">' + switcher + '</span><br />\ |
|
82 |
<form name="mdgAjaxEditor" method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
|
83 |
<textarea id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\ |
|
84 |
Edit summary: <input id="ajaxEditSummary" size="40" /><br />\ |
|
85 |
<input id="ajaxEditMinor" name="minor" type="checkbox" /> <label for="ajaxEditMinor">This is a minor edit</label><br />\ |
|
86 |
<a href="#" onclick="void(ajaxSavePage()); return false;">save changes</a> | <a href="#" onclick="void(ajaxShowPreview()); return false;">preview changes</a> | <a href="#" onclick="void(ajaxEditor()); return false;">revert changes</a> | <a href="#" onclick="void(ajaxDiscard()); return false;">discard changes</a> | <a href="#" onclick="ajaxWikiEditHelp(); return false;">formatting help</a>\ |
|
87 |
<br />\ |
|
88 |
'+editNotice+'\ |
|
89 |
</form>'; |
|
90 |
// initTextareas(); |
|
91 |
if(readCookie('enano_editor_mode') == 'tinymce') |
|
92 |
{ |
|
93 |
$('ajaxEditArea').switchToMCE(); |
|
94 |
} |
|
95 |
} |
|
96 |
}); |
|
97 |
} |
|
98 |
||
99 |
function setEditorMCE() |
|
100 |
{ |
|
101 |
$('ajaxEditArea').switchToMCE(); |
|
102 |
createCookie('enano_editor_mode', 'tinymce', 365); |
|
103 |
$('switcher').object.innerHTML = '<a href="#" onclick="setEditorText(); return false;">wikitext editor</a> | graphical editor'; |
|
104 |
} |
|
105 |
||
106 |
function setEditorText() |
|
107 |
{ |
|
108 |
$('ajaxEditArea').destroyMCE(); |
|
109 |
createCookie('enano_editor_mode', 'text', 365); |
|
110 |
$('switcher').object.innerHTML = 'wikitext editor | <a href="#" onclick="setEditorMCE(); return false;">graphical editor</a>'; |
|
111 |
} |
|
112 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
113 |
function ajaxViewSource() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
114 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
115 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
116 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
117 |
return true; |
1 | 118 |
setAjaxLoading(); |
119 |
ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() { |
|
120 |
if(ajax.readyState == 4) { |
|
121 |
unsetAjaxLoading(); |
|
122 |
if(edit_open) { |
|
123 |
c=confirm('Do you really want to revert your changes?'); |
|
124 |
if(!c) return; |
|
125 |
} |
|
126 |
edit_open = true; |
|
127 |
selectButtonMajor('article'); |
|
128 |
selectButtonMinor('edit'); |
|
129 |
if(in_array('ajaxEditArea', grippied_textareas)) |
|
130 |
{ |
|
131 |
// Allow the textarea grippifier to re-create the resizer control on the textarea |
|
132 |
grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
|
133 |
} |
|
134 |
document.getElementById('ajaxEditContainer').innerHTML = '\ |
|
135 |
<form method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
|
136 |
<textarea readonly="readonly" id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\ |
|
137 |
<a href="#" onclick="void(ajaxReset()); return false;">close viewer</a>\ |
|
138 |
</form>'; |
|
139 |
initTextareas(); |
|
140 |
} |
|
141 |
}); |
|
142 |
} |
|
143 |
||
144 |
function ajaxShowPreview() |
|
145 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
146 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
147 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
148 |
return true; |
1 | 149 |
goBusy('Loading preview...'); |
150 |
var text = ajaxEscape($('ajaxEditArea').getContent()); |
|
151 |
if(document.mdgAjaxEditor.minor.checked) minor='&minor'; |
|
152 |
else minor=''; |
|
153 |
ajaxPost(stdAjaxPrefix+'&_mode=preview', 'summary='+document.getElementById('ajaxEditSummary').value+minor+'&text='+text, function() { |
|
154 |
if(ajax.readyState == 4) { |
|
155 |
unBusy(); |
|
156 |
edit_open = false; |
|
157 |
document.getElementById('mdgPreviewContainer').innerHTML = ajax.responseText; |
|
158 |
} |
|
159 |
}); |
|
160 |
} |
|
161 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
162 |
function ajaxSavePage() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
163 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
164 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
165 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
166 |
return true; |
1 | 167 |
goBusy('Saving page...'); |
168 |
var text = ajaxEscape($('ajaxEditArea').getContent()); |
|
169 |
if(document.mdgAjaxEditor.minor.checked) minor='&minor'; |
|
170 |
else minor=''; |
|
171 |
ajaxPost(stdAjaxPrefix+'&_mode=savepage', 'summary='+document.getElementById('ajaxEditSummary').value+minor+'&text='+text, function() { |
|
172 |
if(ajax.readyState == 4) { |
|
173 |
unBusy(); |
|
174 |
edit_open = false; |
|
175 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
176 |
enableUnload(); |
|
177 |
unselectAllButtonsMinor(); |
|
178 |
} |
|
179 |
}); |
|
180 |
} |
|
181 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
182 |
function ajaxDiscard() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
183 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
184 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
185 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
186 |
return true; |
1 | 187 |
c = confirm('Do you really want to discard your changes?'); |
188 |
if(!c) return; |
|
189 |
ajaxReset(); |
|
190 |
} |
|
191 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
192 |
function ajaxReset() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
193 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
194 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
195 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
196 |
return true; |
1 | 197 |
enableUnload(); |
198 |
setAjaxLoading(); |
|
199 |
ajaxGet(stdAjaxPrefix+'&_mode=getpage&noheaders', function() { |
|
200 |
if(ajax.readyState == 4) { |
|
201 |
unsetAjaxLoading(); |
|
202 |
edit_open = false; |
|
203 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
204 |
selectButtonMajor('article'); |
|
205 |
unselectAllButtonsMinor(); |
|
206 |
} |
|
207 |
}); |
|
208 |
} |
|
209 |
||
210 |
// Miscellaneous AJAX applets |
|
211 |
||
212 |
function ajaxProtect(l) { |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
213 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
214 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
215 |
return true; |
1 | 216 |
if(shift) { |
217 |
r = 'NO_REASON'; |
|
218 |
} else { |
|
219 |
r = prompt('Reason for (un)protecting:'); |
|
220 |
if(!r || r=='') return; |
|
221 |
} |
|
222 |
setAjaxLoading(); |
|
223 |
document.getElementById('protbtn_0').style.textDecoration = 'none'; |
|
224 |
document.getElementById('protbtn_1').style.textDecoration = 'none'; |
|
225 |
document.getElementById('protbtn_2').style.textDecoration = 'none'; |
|
226 |
document.getElementById('protbtn_'+l).style.textDecoration = 'underline'; |
|
227 |
ajaxPost(stdAjaxPrefix+'&_mode=protect', 'reason='+escape(r)+'&level='+l, function() { |
|
228 |
if(ajax.readyState == 4) { |
|
229 |
unsetAjaxLoading(); |
|
230 |
if(ajax.responseText != 'good') |
|
231 |
alert(ajax.responseText); |
|
232 |
} |
|
233 |
}); |
|
234 |
} |
|
235 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
236 |
function ajaxRename() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
237 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
238 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
239 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
240 |
return true; |
1 | 241 |
r = prompt('What title should this page be renamed to?\nNote: This does not and will never change the URL of this page, that must be done from the admin panel.'); |
242 |
if(!r || r=='') return; |
|
243 |
setAjaxLoading(); |
|
244 |
ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+escape(r), function() { |
|
245 |
if(ajax.readyState == 4) { |
|
246 |
unsetAjaxLoading(); |
|
247 |
alert(ajax.responseText); |
|
248 |
} |
|
249 |
}); |
|
250 |
} |
|
251 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
252 |
function ajaxMakePage() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
253 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
254 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
255 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
256 |
return true; |
1 | 257 |
setAjaxLoading(); |
258 |
ajaxPost(ENANO_SPECIAL_CREATEPAGE, ENANO_CREATEPAGE_PARAMS, function() { |
|
259 |
if(ajax.readyState == 4) { |
|
260 |
unsetAjaxLoading(); |
|
261 |
window.location.reload(); |
|
262 |
} |
|
263 |
}); |
|
264 |
} |
|
265 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
266 |
function ajaxDeletePage() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
267 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
268 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
269 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
270 |
return true; |
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
30
diff
changeset
|
271 |
var reason = prompt('Please enter your reason for deleting this page.'); |
28 | 272 |
if ( !reason || reason == '' ) |
273 |
{ |
|
274 |
return false; |
|
275 |
} |
|
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
30
diff
changeset
|
276 |
c = confirm('You are about to REVERSIBLY delete this page. Do you REALLY want to do this?\n\n(Comments and categorization data, as well as any attached files, will be permanently lost)'); |
28 | 277 |
if(!c) |
278 |
{ |
|
279 |
return; |
|
280 |
} |
|
1 | 281 |
setAjaxLoading(); |
28 | 282 |
ajaxPost(stdAjaxPrefix+'&_mode=deletepage', 'reason=' + escape(reason), function() { |
1 | 283 |
if(ajax.readyState == 4) { |
284 |
unsetAjaxLoading(); |
|
285 |
alert(ajax.responseText); |
|
286 |
window.location.reload(); |
|
287 |
} |
|
288 |
}); |
|
289 |
} |
|
290 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
291 |
function ajaxDelVote() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
292 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
293 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
294 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
295 |
return true; |
1 | 296 |
c = confirm('Are you sure that you want to vote that this page be deleted?'); |
297 |
if(!c) return; |
|
298 |
setAjaxLoading(); |
|
299 |
ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() { |
|
300 |
if(ajax.readyState == 4) { |
|
301 |
unsetAjaxLoading(); |
|
302 |
alert(ajax.responseText); |
|
303 |
} |
|
304 |
}); |
|
305 |
} |
|
306 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
307 |
function ajaxResetDelVotes() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
308 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
309 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
310 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
311 |
return true; |
1 | 312 |
c = confirm('This will reset the number of votes against this page to zero. Do you really want to do this?'); |
313 |
if(!c) return; |
|
314 |
setAjaxLoading(); |
|
315 |
ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() { |
|
316 |
if(ajax.readyState == 4) { |
|
317 |
unsetAjaxLoading(); |
|
318 |
alert(ajax.responseText); |
|
319 |
item = document.getElementById('mdgDeleteVoteNoticeBox'); |
|
320 |
if(item) |
|
321 |
{ |
|
322 |
opacity('mdgDeleteVoteNoticeBox', 100, 0, 1000); |
|
323 |
setTimeout("document.getElementById('mdgDeleteVoteNoticeBox').style.display = 'none';", 1000); |
|
324 |
} |
|
325 |
} |
|
326 |
}); |
|
327 |
} |
|
328 |
||
329 |
function ajaxSetWikiMode(val) { |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
330 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
331 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
332 |
return true; |
1 | 333 |
setAjaxLoading(); |
334 |
document.getElementById('wikibtn_0').style.textDecoration = 'none'; |
|
335 |
document.getElementById('wikibtn_1').style.textDecoration = 'none'; |
|
336 |
document.getElementById('wikibtn_2').style.textDecoration = 'none'; |
|
337 |
document.getElementById('wikibtn_'+val).style.textDecoration = 'underline'; |
|
338 |
ajaxGet(stdAjaxPrefix+'&_mode=setwikimode&mode='+val, function() { |
|
339 |
if(ajax.readyState == 4) { |
|
340 |
unsetAjaxLoading(); |
|
341 |
if(ajax.responseText!='GOOD') |
|
342 |
{ |
|
343 |
alert(ajax.responseText); |
|
344 |
} |
|
345 |
} |
|
346 |
}); |
|
347 |
} |
|
348 |
||
349 |
// Editing/saving category information |
|
350 |
// This was not easy to write, I hope enjoy it, and dang I swear I'm gonna |
|
351 |
// find someone to work on just the Javascript part of Enano... |
|
352 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
353 |
function ajaxCatEdit() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
354 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
355 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
356 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
357 |
return true; |
1 | 358 |
setAjaxLoading(); |
359 |
ajaxGet(stdAjaxPrefix+'&_mode=catedit', function() { |
|
360 |
if(ajax.readyState == 4) { |
|
361 |
unsetAjaxLoading(); |
|
362 |
edit_open = false; |
|
363 |
eval(ajax.responseText); |
|
364 |
} |
|
365 |
}); |
|
366 |
} |
|
367 |
||
368 |
function ajaxCatSave() |
|
369 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
370 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
371 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
372 |
return true; |
1 | 373 |
if(!catlist) |
374 |
{ |
|
375 |
alert('Var catlist has no properties'); |
|
376 |
return; |
|
377 |
} |
|
378 |
query=''; |
|
379 |
for(i=0;i<catlist.length;i++) |
|
380 |
{ |
|
381 |
l = 'if(document.forms.mdgCatForm.mdgCat_'+catlist[i]+'.checked) s = true; else s = false;'; |
|
382 |
eval(l); |
|
383 |
if(s) query = query + '&' + catlist[i] + '=true'; |
|
384 |
} |
|
385 |
setAjaxLoading(); |
|
386 |
query = query.substring(1, query.length); |
|
387 |
ajaxPost(stdAjaxPrefix+'&_mode=catsave', query, function() { |
|
388 |
if(ajax.readyState == 4) { |
|
389 |
unsetAjaxLoading(); |
|
390 |
edit_open = false; |
|
391 |
if(ajax.responseText != 'GOOD') alert(ajax.responseText); |
|
392 |
ajaxReset(); |
|
393 |
} |
|
394 |
}); |
|
395 |
} |
|
396 |
||
397 |
// History stuff |
|
398 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
399 |
function ajaxHistory() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
400 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
401 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
402 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
403 |
return true; |
1 | 404 |
setAjaxLoading(); |
405 |
ajaxGet(stdAjaxPrefix+'&_mode=histlist', function() { |
|
406 |
if(ajax.readyState == 4) { |
|
407 |
unsetAjaxLoading(); |
|
408 |
edit_open = false; |
|
409 |
selectButtonMajor('article'); |
|
410 |
selectButtonMinor('history'); |
|
411 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
412 |
buildDiffList(); |
|
413 |
} |
|
414 |
}); |
|
415 |
} |
|
416 |
||
417 |
function ajaxHistView(oldid, tit) { |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
418 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
419 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
420 |
return true; |
1 | 421 |
if(!tit) tit=title; |
422 |
setAjaxLoading(); |
|
423 |
ajaxGet(append_sid(scriptPath+'/ajax.php?title='+tit+'&_mode=getpage&oldid='+oldid), function() { |
|
424 |
if(ajax.readyState == 4) { |
|
425 |
unsetAjaxLoading(); |
|
426 |
edit_open = false; |
|
427 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
428 |
} |
|
429 |
}); |
|
430 |
} |
|
431 |
||
432 |
function ajaxRollback(id) { |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
433 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
434 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
435 |
return true; |
1 | 436 |
setAjaxLoading(); |
437 |
ajaxGet(stdAjaxPrefix+'&_mode=rollback&id='+id, function() { |
|
438 |
if(ajax.readyState == 4) { |
|
439 |
unsetAjaxLoading(); |
|
440 |
alert(ajax.responseText); |
|
441 |
} |
|
442 |
}); |
|
443 |
} |
|
444 |
||
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
445 |
function ajaxClearLogs() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
446 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
447 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
448 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
449 |
return true; |
1 | 450 |
c = confirm('You are about to DESTROY all log entries for this page. As opposed to (example) deleting this page, this action is completely IRREVERSIBLE and should not be used except in dire circumstances. Do you REALLY want to do this?'); |
451 |
if(!c) return; |
|
452 |
c = confirm('You\'re ABSOLUTELY sure???'); |
|
453 |
if(!c) return; |
|
454 |
setAjaxLoading(); |
|
455 |
ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() { |
|
456 |
if(ajax.readyState == 4) { |
|
457 |
unsetAjaxLoading(); |
|
458 |
alert(ajax.responseText); |
|
459 |
window.location.reload(); |
|
460 |
} |
|
461 |
}); |
|
462 |
} |
|
463 |
||
464 |
var timelist; |
|
465 |
||
466 |
function buildDiffList() |
|
467 |
{ |
|
468 |
arrDiff1Buttons = getElementsByClassName(document, 'input', 'clsDiff1Radio'); |
|
469 |
arrDiff2Buttons = getElementsByClassName(document, 'input', 'clsDiff2Radio'); |
|
470 |
var len = arrDiff1Buttons.length; |
|
471 |
if ( len < 1 ) |
|
472 |
return false; |
|
473 |
timelist = new Array(); |
|
474 |
for ( var i = 0; i < len; i++ ) |
|
475 |
{ |
|
476 |
timelist.push( arrDiff2Buttons[i].id.substr(6) ); |
|
477 |
} |
|
478 |
timelist.push( arrDiff1Buttons[len-1].id.substr(6) ); |
|
479 |
delete(timelist.toJSONString); |
|
480 |
for ( var i = 1; i < timelist.length-1; i++ ) |
|
481 |
{ |
|
482 |
if ( i >= timelist.length ) break; |
|
483 |
arrDiff2Buttons[i].style.display = 'none'; |
|
484 |
} |
|
485 |
} |
|
486 |
||
487 |
function selectDiff1Button(obj) |
|
488 |
{ |
|
489 |
var this_time = obj.id.substr(6); |
|
490 |
var index = parseInt(in_array(this_time, timelist)); |
|
491 |
for ( var i = 0; i < timelist.length - 1; i++ ) |
|
492 |
{ |
|
493 |
if ( i < timelist.length - 1 ) |
|
494 |
{ |
|
495 |
var state = ( i < index ) ? 'inline' : 'none'; |
|
496 |
var id = 'diff2_' + timelist[i]; |
|
497 |
document.getElementById(id).style.display = state; |
|
498 |
||
499 |
// alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i); |
|
500 |
} |
|
501 |
} |
|
502 |
} |
|
503 |
||
504 |
function selectDiff2Button(obj) |
|
505 |
{ |
|
506 |
var this_time = obj.id.substr(6); |
|
507 |
var index = parseInt(in_array(this_time, timelist)); |
|
508 |
for ( var i = 1; i < timelist.length; i++ ) |
|
509 |
{ |
|
510 |
if ( i < timelist.length - 1 ) |
|
511 |
{ |
|
512 |
var state = ( i > index ) ? 'inline' : 'none'; |
|
513 |
var id = 'diff1_' + timelist[i]; |
|
514 |
document.getElementById(id).style.display = state; |
|
515 |
||
516 |
// alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i); |
|
517 |
} |
|
518 |
} |
|
519 |
} |
|
520 |
||
521 |
function ajaxHistDiff() |
|
522 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
523 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
524 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
525 |
return true; |
1 | 526 |
var id1=false; |
527 |
var id2=false; |
|
528 |
for ( i = 0; i < arrDiff1Buttons.length; i++ ) |
|
529 |
{ |
|
530 |
k = i + ''; |
|
531 |
kpp = i + 1; |
|
532 |
kpp = kpp + ''; |
|
533 |
if(arrDiff1Buttons[k].checked) id1 = arrDiff1Buttons[k].id.substr(6); |
|
534 |
if(arrDiff2Buttons[k].checked) id2 = arrDiff2Buttons[k].id.substr(6); |
|
535 |
} |
|
536 |
if(!id1 || !id2) { alert('BUG: Couldn\'t get checked radiobutton state'); return; } |
|
537 |
setAjaxLoading(); |
|
538 |
ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function() |
|
539 |
{ |
|
540 |
if(ajax.readyState==4) |
|
541 |
{ |
|
542 |
unsetAjaxLoading(); |
|
543 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
544 |
} |
|
545 |
}); |
|
546 |
} |
|
547 |
||
548 |
// Change the user's preferred style/theme |
|
549 |
||
550 |
function ajaxChangeStyle() |
|
551 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
552 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
553 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
554 |
return true; |
15
ad5986a53197
Fixed complicated SQL injection vulnerability in URL handler, updated license info for Tigra Tree Menu, and killed one XSS vulnerability
Dan
parents:
11
diff
changeset
|
555 |
var inner_html = ''; |
29
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
556 |
inner_html += '<p><label>Theme: '; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
557 |
inner_html += ' <select id="chtheme_sel_theme" onchange="ajaxGetStyles(this.value);">'; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
558 |
inner_html += ' <option value="_blank" selected="selected">[Select]</option>'; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
559 |
inner_html += ENANO_THEME_LIST; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
560 |
inner_html += ' </select>'; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
561 |
inner_html += '</label></p>'; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
562 |
var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, 'Change your theme', inner_html); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
563 |
chtheme_mb.onbeforeclick['OK'] = ajaxChangeStyleComplete; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
564 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
565 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
566 |
function ajaxGetStyles(id) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
567 |
{ |
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
568 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
569 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
570 |
return true; |
29
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
571 |
var thediv = document.getElementById('chtheme_sel_style_parent'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
572 |
if ( thediv ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
573 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
574 |
thediv.parentNode.removeChild(thediv); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
575 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
576 |
if ( id == '_blank' ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
577 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
578 |
return null; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
579 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
580 |
ajaxGet(stdAjaxPrefix + '&_mode=getstyles&id=' + id, function() { |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
581 |
if ( ajax.readyState == 4 ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
582 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
583 |
// IE doesn't like substr() on ajax.responseText |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
584 |
var response = String(ajax.responseText + ' '); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
585 |
response = response.substr(0, response.length - 1); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
586 |
if ( response.substr(0,1) != '[' ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
587 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
588 |
alert('Invalid or unexpected JSON response from server:\n' + response); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
589 |
return null; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
590 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
591 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
592 |
// Build a selector and matching label |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
593 |
var data = parseJSON(response); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
594 |
var options = new Array(); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
595 |
for( var i in data ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
596 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
597 |
var item = data[i]; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
598 |
var title = themeid_to_title(item); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
599 |
var option = document.createElement('option'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
600 |
option.value = item; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
601 |
option.appendChild(document.createTextNode(title)); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
602 |
options.push(option); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
603 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
604 |
var p_parent = document.createElement('p'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
605 |
var label = document.createElement('label'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
606 |
p_parent.id = 'chtheme_sel_style_parent'; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
607 |
label.appendChild(document.createTextNode('Style: ')); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
608 |
var select = document.createElement('select'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
609 |
select.id = 'chtheme_sel_style'; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
610 |
for ( var i in options ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
611 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
612 |
select.appendChild(options[i]); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
613 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
614 |
label.appendChild(select); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
615 |
p_parent.appendChild(label); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
616 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
617 |
// Stick it onto the messagebox |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
618 |
var div = document.getElementById('messageBox'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
619 |
var kid = div.firstChild.nextSibling; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
620 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
621 |
kid.appendChild(p_parent); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
622 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
623 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
624 |
}); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
625 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
626 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
627 |
function ajaxChangeStyleComplete() |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
628 |
{ |
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
629 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
630 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
631 |
return true; |
29
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
632 |
var theme = $('chtheme_sel_theme'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
633 |
var style = $('chtheme_sel_style'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
634 |
if ( !theme.object || !style.object ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
635 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
636 |
alert('Please select a theme from the list.'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
637 |
return true; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
638 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
639 |
var theme_id = theme.object.value; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
640 |
var style_id = style.object.value; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
641 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
642 |
if ( typeof(theme_id) != 'string' || typeof(style_id) != 'string' ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
643 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
644 |
alert('Couldn\'t get theme or style ID'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
645 |
return true; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
646 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
647 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
648 |
if ( theme_id.length < 1 || style_id.length < 1 ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
649 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
650 |
alert('Theme or style ID is zero length'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
651 |
return true; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
652 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
653 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
654 |
ajaxPost(stdAjaxPrefix + '&_mode=change_theme', 'theme_id=' + escape(theme_id) + '&style_id=' + escape(style_id), function() |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
655 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
656 |
if ( ajax.readyState == 4 ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
657 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
658 |
if ( ajax.responseText == 'GOOD' ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
659 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
660 |
var c = confirm('Your theme preference has been changed.\nWould you like to reload the page now to see the changes?'); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
661 |
if ( c ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
662 |
window.location.reload(); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
663 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
664 |
else |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
665 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
666 |
alert('Error occurred during attempt to change theme:\n' + ajax.responseText); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
667 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
668 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
669 |
}); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
670 |
|
30 | 671 |
return false; |
29
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
672 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
673 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
674 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
675 |
function themeid_to_title(id) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
676 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
677 |
if ( typeof(id) != 'string' ) |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
678 |
return false; |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
679 |
id = id.substr(0, 1).toUpperCase() + id.substr(1); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
680 |
id = id.replace(/_/g, ' '); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
681 |
id = id.replace(/-/g, ' '); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
682 |
return id; |
15
ad5986a53197
Fixed complicated SQL injection vulnerability in URL handler, updated license info for Tigra Tree Menu, and killed one XSS vulnerability
Dan
parents:
11
diff
changeset
|
683 |
} |
ad5986a53197
Fixed complicated SQL injection vulnerability in URL handler, updated license info for Tigra Tree Menu, and killed one XSS vulnerability
Dan
parents:
11
diff
changeset
|
684 |
|
ad5986a53197
Fixed complicated SQL injection vulnerability in URL handler, updated license info for Tigra Tree Menu, and killed one XSS vulnerability
Dan
parents:
11
diff
changeset
|
685 |
/* |
ad5986a53197
Fixed complicated SQL injection vulnerability in URL handler, updated license info for Tigra Tree Menu, and killed one XSS vulnerability
Dan
parents:
11
diff
changeset
|
686 |
function ajaxChangeStyle() |
ad5986a53197
Fixed complicated SQL injection vulnerability in URL handler, updated license info for Tigra Tree Menu, and killed one XSS vulnerability
Dan
parents:
11
diff
changeset
|
687 |
{ |
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
688 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
689 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
690 |
return true; |
1 | 691 |
var win = document.getElementById("cn2"); |
692 |
win.innerHTML = ' \ |
|
693 |
<form action="'+ENANO_SPECIAL_CHANGESTYLE+'" onsubmit="jws.closeWin(\'root2\');" method="post" style="text-align: center"> \ |
|
694 |
<h3>Select a theme...</h3>\ |
|
695 |
<select id="mdgThemeID" name="theme" onchange="ajaxGetStyles(this.value);"> \ |
|
696 |
'+ENANO_THEME_LIST+' \ |
|
697 |
</select> \ |
|
698 |
<div id="styleSelector"></div>\ |
|
699 |
<br /><br />\ |
|
700 |
<input type="hidden" name="return_to" value="'+title+'" />\ |
|
701 |
<input id="styleSubmitter" type="submit" style="display: none; font-weight: bold" value="Change theme" /> \ |
|
702 |
<input type="button" value="Cancel" onclick="jws.closeWin(\'root2\');" /> \ |
|
703 |
</form> \ |
|
704 |
'; |
|
705 |
ajaxGetStyles(ENANO_CURRENT_THEME); |
|
706 |
jws.openWin('root2', 340, 300); |
|
707 |
} |
|
708 |
||
709 |
function ajaxGetStyles(id) { |
|
710 |
setAjaxLoading(); |
|
711 |
ajaxGet(stdAjaxPrefix+'&_mode=getstyles&id='+id, function() { |
|
712 |
if(ajax.readyState == 4) { |
|
713 |
unsetAjaxLoading(); |
|
714 |
eval(ajax.responseText); |
|
715 |
html = '<h3>And a style...</h3><select id="mdgStyleID" name="style">'; |
|
716 |
for(i=0;i<list.length;i++) { |
|
717 |
lname = list[i].substr(0, 1).toUpperCase() + list[i].substr(1, list[i].length); |
|
718 |
html = html + '<option value="'+list[i]+'">'+lname+'</option>'; |
|
719 |
} |
|
720 |
html = html + '</select>'; |
|
721 |
document.getElementById('styleSelector').innerHTML = html; |
|
722 |
document.getElementById('styleSubmitter').style.display = 'inline'; |
|
723 |
} |
|
724 |
}); |
|
725 |
} |
|
15
ad5986a53197
Fixed complicated SQL injection vulnerability in URL handler, updated license info for Tigra Tree Menu, and killed one XSS vulnerability
Dan
parents:
11
diff
changeset
|
726 |
*/ |
1 | 727 |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
728 |
function ajaxSwapCSS() |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
729 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
730 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
731 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
732 |
return true; |
1 | 733 |
setAjaxLoading(); |
734 |
if(_css) { |
|
735 |
document.getElementById('mdgCss').href = main_css; |
|
736 |
_css = false; |
|
737 |
} else { |
|
738 |
document.getElementById('mdgCss').href = print_css; |
|
739 |
_css = true; |
|
740 |
} |
|
741 |
unsetAjaxLoading(); |
|
742 |
menuOff(); |
|
743 |
} |
|
744 |
||
745 |
function ajaxSetPassword() |
|
746 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
747 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
748 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
749 |
return true; |
1 | 750 |
pass = hex_sha1(document.getElementById('mdgPassSetField').value); |
751 |
setAjaxLoading(); |
|
752 |
ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function() |
|
753 |
{ |
|
754 |
unsetAjaxLoading(); |
|
755 |
if(ajax.readyState==4) |
|
756 |
{ |
|
757 |
alert(ajax.responseText); |
|
758 |
} |
|
759 |
} |
|
760 |
); |
|
761 |
} |
|
762 |
||
763 |
function ajaxWikiEditHelp() |
|
764 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
765 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
766 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
767 |
return true; |
1 | 768 |
jws.openWin('root3', 640, 480); |
769 |
setAjaxLoading(); |
|
770 |
ajaxGet(stdAjaxPrefix+'&_mode=wikihelp', function() { |
|
771 |
if(ajax.readyState==4) |
|
772 |
{ |
|
773 |
unsetAjaxLoading(); |
|
774 |
document.getElementById('cn3').innerHTML = ajax.responseText; |
|
775 |
} |
|
776 |
}); |
|
777 |
} |
|
778 |
||
779 |
function ajaxStartLogin() |
|
780 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
781 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
782 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
783 |
return true; |
1 | 784 |
ajaxPromptAdminAuth(function(k) { |
785 |
window.location.reload(); |
|
60
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
786 |
}, USER_LEVEL_MEMBER); |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
787 |
} |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
788 |
|
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
789 |
function ajaxStartAdminLogin() |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
790 |
{ |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
791 |
// IE <6 pseudo-compatibility |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
792 |
if ( KILL_SWITCH ) |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
793 |
return true; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
794 |
if ( auth_level < USER_LEVEL_ADMIN ) |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
795 |
{ |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
796 |
ajaxPromptAdminAuth(function(k) { |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
797 |
ENANO_SID = k; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
798 |
auth_level = USER_LEVEL_ADMIN; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
799 |
var loc = makeUrlNS('Special', 'Administration'); |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
800 |
if ( (ENANO_SID + ' ').length > 1 ) |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
801 |
window.location = loc; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
802 |
}, USER_LEVEL_ADMIN); |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
803 |
return false; |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
804 |
} |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
805 |
var loc = makeUrlNS('Special', 'Administration'); |
71b50f8c8f85
Changed administration login request to use the AJAX login form; made high-level authentication more apparent in the AJAX box; recompiled Oxygen Mint
Dan
parents:
57
diff
changeset
|
806 |
window.location = loc; |
1 | 807 |
} |
808 |
||
809 |
function ajaxAdminPage() |
|
810 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
811 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
812 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
813 |
return true; |
1 | 814 |
if ( auth_level < USER_LEVEL_ADMIN ) |
815 |
{ |
|
816 |
ajaxPromptAdminAuth(function(k) { |
|
817 |
ENANO_SID = k; |
|
818 |
auth_level = USER_LEVEL_ADMIN; |
|
819 |
var loc = String(window.location + ''); |
|
820 |
window.location = append_sid(loc); |
|
821 |
var loc = makeUrlNS('Special', 'Administration', 'module=' + namespace_list['Admin'] + 'PageManager&source=ajax&page_id=' + ajaxEscape(title)); |
|
822 |
if ( (ENANO_SID + ' ').length > 1 ) |
|
823 |
window.location = loc; |
|
824 |
}, 9); |
|
825 |
return false; |
|
826 |
} |
|
827 |
var loc = makeUrlNS('Special', 'Administration', 'module=' + namespace_list['Admin'] + 'PageManager&source=ajax&page_id=' + ajaxEscape(title)); |
|
828 |
window.location = loc; |
|
829 |
} |
|
830 |
||
11
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
831 |
function ajaxDisableEmbeddedPHP() |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
832 |
{ |
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
833 |
// IE <6 pseudo-compatibility |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
834 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
40
diff
changeset
|
835 |
return true; |
11
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
836 |
if ( !confirm('Are you really sure you want to do this? Some pages might not function if this emergency-only feature is activated.') ) |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
837 |
return false; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
838 |
var $killdiv = $dynano('php_killer'); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
839 |
if ( !$killdiv.object ) |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
840 |
{ |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
841 |
alert('Can\'t get kill div object'); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
842 |
return false; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
843 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
844 |
$killdiv.object.innerHTML = '<img alt="Loading..." src="' + scriptPath + '/images/loading-big.gif" /><br />Making request...'; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
845 |
var url = makeUrlNS('Admin', 'Home', 'src=ajax'); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
846 |
ajaxPost(url, 'act=kill_php', function() { |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
847 |
if ( ajax.readyState == 4 ) |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
848 |
{ |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
849 |
if ( ajax.responseText == '1' ) |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
850 |
{ |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
851 |
var $killdiv = $dynano('php_killer'); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
852 |
//$killdiv.object.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />Embedded PHP in pages has been disabled.'; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
853 |
$killdiv.object.parentNode.removeChild($killdiv.object); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
854 |
var newdiv = document.createElement('div'); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
855 |
// newdiv.style = $killdiv.object.style; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
856 |
newdiv.className = $killdiv.object.className; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
857 |
newdiv.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />Embedded PHP in pages has been disabled.'; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
858 |
$killdiv.object.parentNode.appendChild(newdiv); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
859 |
$killdiv.object.parentNode.removeChild($killdiv.object); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
860 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
861 |
else |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
862 |
{ |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
863 |
var $killdiv = $dynano('php_killer'); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
864 |
$killdiv.object.innerHTML = ajax.responseText; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
865 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
866 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
867 |
}); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
868 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
869 |