author | Dan |
Sun, 17 Aug 2008 08:38:15 -0400 | |
changeset 303 | 4c2d4833a968 |
parent 259 | 112debff64bd |
child 335 | 59fee40b4644 |
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 |
||
259
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
45 |
/** |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
46 |
* Show a friendly error message depicting an AJAX response that is not valid JSON |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
47 |
* @param string Response text |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
48 |
* @param string Custom error message. If omitted, the default will be shown. |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
49 |
*/ |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
50 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
51 |
function handle_invalid_json(response, customerror) |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
52 |
{ |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
53 |
var mainwin = $('ajaxEditContainer').object; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
54 |
mainwin.innerHTML = ''; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
55 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
56 |
// Title |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
57 |
var h3 = document.createElement('h3'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
58 |
h3.appendChild(document.createTextNode('The site encountered an error while processing your request.')); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
59 |
mainwin.appendChild(h3); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
60 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
61 |
if ( typeof(customerror) == 'string' ) |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
62 |
{ |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
63 |
var el = document.createElement('p'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
64 |
el.appendChild(document.createTextNode(customerror)); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
65 |
mainwin.appendChild(el); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
66 |
} |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
67 |
else |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
68 |
{ |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
69 |
customerror = 'We unexpectedly received the following response from the server. The response should have been in the JSON '; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
70 |
customerror += 'serialization format, but the response wasn\'t composed only of the JSON response. There are three possible triggers'; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
71 |
customerror += 'for this problem:'; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
72 |
var el = document.createElement('p'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
73 |
el.appendChild(document.createTextNode(customerror)); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
74 |
mainwin.appendChild(el); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
75 |
var ul = document.createElement('ul'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
76 |
var li1 = document.createElement('li'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
77 |
var li2 = document.createElement('li'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
78 |
var li3 = document.createElement('li'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
79 |
li1.appendChild(document.createTextNode('The server sent back a bad HTTP response code and thus sent an error page instead of running Enano. This indicates a possible problem with your server, and is not likely to be a bug with Enano.')); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
80 |
var osc_exception = ( window.location.hostname == 'demo.opensourcecms.com' ) ? ' This is KNOWN to be the case with the OpenSourceCMS.com demo version of Enano.' : ''; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
81 |
li2.appendChild(document.createTextNode('The server sent back the expected JSON response, but also injected some code into the response that should not be there. Typically this consists of advertisement code. In this case, the administrator of this site will have to contact their web host to have advertisements disabled.' + osc_exception)); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
82 |
li3.appendChild(document.createTextNode('It\'s possible that Enano triggered a PHP error or warning. In this case, you may be looking at a bug in Enano.')); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
83 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
84 |
ul.appendChild(li1); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
85 |
ul.appendChild(li2); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
86 |
ul.appendChild(li3); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
87 |
mainwin.appendChild(ul); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
88 |
} |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
89 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
90 |
var p2 = document.createElement('p'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
91 |
p2.appendChild(document.createTextNode('The response received from the server is as follows:')); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
92 |
mainwin.appendChild(p2); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
93 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
94 |
var pre = document.createElement('pre'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
95 |
pre.appendChild(document.createTextNode(response)); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
96 |
mainwin.appendChild(pre); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
97 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
98 |
var p3 = document.createElement('p'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
99 |
p3.appendChild(document.createTextNode('You may also choose to view the response as HTML. ')); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
100 |
var a = document.createElement('a'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
101 |
a.appendChild(document.createTextNode('View as HTML...')); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
102 |
a._resp = response; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
103 |
a.id = 'invalidjson_link'; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
104 |
a.onclick = function() |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
105 |
{ |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
106 |
var mb = new messagebox(MB_YESNO | MB_ICONEXCLAMATION, 'Do you really want to view this response as HTML?', 'If the response was changed during transmission to include malicious code, you may be allowing that malicious code to run by viewing the response as HTML. Only do this if you have reviewed the response text and have found no suspicious code in it.'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
107 |
mb.onclick['Yes'] = function() |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
108 |
{ |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
109 |
var html = $('invalidjson_link').object._resp; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
110 |
var win = window.open('about:blank', 'invalidjson_htmlwin', 'width=550,height=400,status=no,toolbars=no,toolbar=no,address=no,scroll=yes'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
111 |
win.document.write(html); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
112 |
} |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
113 |
return false; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
114 |
} |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
115 |
a.href = '#'; |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
116 |
p3.appendChild(a); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
117 |
mainwin.appendChild(p3); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
118 |
} |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
119 |
|
1 | 120 |
function ajaxEscape(text) |
121 |
{ |
|
133
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
122 |
/* |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
123 |
text = escape(text); |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
124 |
text = text.replace(/\+/g, '%2B', text); |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
125 |
*/ |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
126 |
text = window.encodeURIComponent(text); |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
127 |
return text; |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
128 |
} |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
129 |
|
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
130 |
function ajaxAltEscape(text) |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
118
diff
changeset
|
131 |
{ |
1 | 132 |
text = escape(text); |
133 |
text = text.replace(/\+/g, '%2B', text); |
|
134 |
return text; |
|
135 |
} |
|
136 |
||
137 |
// Page editor |
|
138 |
||
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
|
139 |
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
|
140 |
{ |
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
|
141 |
// 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
|
142 |
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
|
143 |
return true; |
1 | 144 |
setAjaxLoading(); |
145 |
ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() { |
|
146 |
if(ajax.readyState == 4) { |
|
147 |
unsetAjaxLoading(); |
|
148 |
if(edit_open) { |
|
149 |
c=confirm('Do you really want to revert your changes?'); |
|
150 |
if(!c) return; |
|
151 |
} |
|
152 |
edit_open = true; |
|
153 |
selectButtonMajor('article'); |
|
154 |
selectButtonMinor('edit'); |
|
155 |
if(in_array('ajaxEditArea', grippied_textareas)) |
|
156 |
{ |
|
157 |
// Allow the textarea grippifier to re-create the resizer control on the textarea |
|
158 |
grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
|
159 |
} |
|
160 |
disableUnload('If you do, any changes that you have made to this page will be lost.'); |
|
161 |
var switcher = ( readCookie('enano_editor_mode') == 'tinymce' ) ? |
|
162 |
'<a href="#" onclick="setEditorText(); return false;">wikitext editor</a> | graphical editor' : |
|
163 |
'wikitext editor | <a href="#" onclick="setEditorMCE(); return false;">graphical editor</a>' ; |
|
164 |
document.getElementById('ajaxEditContainer').innerHTML = '\ |
|
165 |
<div id="mdgPreviewContainer"></div> \ |
|
166 |
<span id="switcher">' + switcher + '</span><br />\ |
|
167 |
<form name="mdgAjaxEditor" method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
|
168 |
<textarea id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\ |
|
169 |
Edit summary: <input id="ajaxEditSummary" size="40" /><br />\ |
|
170 |
<input id="ajaxEditMinor" name="minor" type="checkbox" /> <label for="ajaxEditMinor">This is a minor edit</label><br />\ |
|
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
171 |
<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>\ |
1 | 172 |
<br />\ |
173 |
'+editNotice+'\ |
|
174 |
</form>'; |
|
175 |
// initTextareas(); |
|
176 |
if(readCookie('enano_editor_mode') == 'tinymce') |
|
177 |
{ |
|
178 |
$('ajaxEditArea').switchToMCE(); |
|
179 |
} |
|
180 |
} |
|
181 |
}); |
|
182 |
} |
|
183 |
||
184 |
function setEditorMCE() |
|
185 |
{ |
|
186 |
$('ajaxEditArea').switchToMCE(); |
|
187 |
createCookie('enano_editor_mode', 'tinymce', 365); |
|
188 |
$('switcher').object.innerHTML = '<a href="#" onclick="setEditorText(); return false;">wikitext editor</a> | graphical editor'; |
|
189 |
} |
|
190 |
||
191 |
function setEditorText() |
|
192 |
{ |
|
193 |
$('ajaxEditArea').destroyMCE(); |
|
194 |
createCookie('enano_editor_mode', 'text', 365); |
|
195 |
$('switcher').object.innerHTML = 'wikitext editor | <a href="#" onclick="setEditorMCE(); return false;">graphical editor</a>'; |
|
196 |
} |
|
197 |
||
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
|
198 |
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
|
199 |
{ |
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
|
200 |
// 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
|
201 |
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
|
202 |
return true; |
1 | 203 |
setAjaxLoading(); |
204 |
ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() { |
|
205 |
if(ajax.readyState == 4) { |
|
206 |
unsetAjaxLoading(); |
|
207 |
if(edit_open) { |
|
208 |
c=confirm('Do you really want to revert your changes?'); |
|
209 |
if(!c) return; |
|
210 |
} |
|
211 |
edit_open = true; |
|
212 |
selectButtonMajor('article'); |
|
213 |
selectButtonMinor('edit'); |
|
214 |
if(in_array('ajaxEditArea', grippied_textareas)) |
|
215 |
{ |
|
216 |
// Allow the textarea grippifier to re-create the resizer control on the textarea |
|
217 |
grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas)); |
|
218 |
} |
|
219 |
document.getElementById('ajaxEditContainer').innerHTML = '\ |
|
220 |
<form method="get" action="#" onsubmit="ajaxSavePage(); return false;">\ |
|
221 |
<textarea readonly="readonly" id="ajaxEditArea" rows="20" cols="60" style="display: block; margin: 1em 0 1em 1em; width: 96.5%;">'+ajax.responseText+'</textarea><br />\ |
|
222 |
<a href="#" onclick="void(ajaxReset()); return false;">close viewer</a>\ |
|
223 |
</form>'; |
|
224 |
initTextareas(); |
|
225 |
} |
|
226 |
}); |
|
227 |
} |
|
228 |
||
229 |
function ajaxShowPreview() |
|
230 |
{ |
|
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
|
231 |
// 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
|
232 |
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
|
233 |
return true; |
1 | 234 |
goBusy('Loading preview...'); |
235 |
var text = ajaxEscape($('ajaxEditArea').getContent()); |
|
236 |
if(document.mdgAjaxEditor.minor.checked) minor='&minor'; |
|
237 |
else minor=''; |
|
238 |
ajaxPost(stdAjaxPrefix+'&_mode=preview', 'summary='+document.getElementById('ajaxEditSummary').value+minor+'&text='+text, function() { |
|
239 |
if(ajax.readyState == 4) { |
|
240 |
unBusy(); |
|
241 |
edit_open = false; |
|
242 |
document.getElementById('mdgPreviewContainer').innerHTML = ajax.responseText; |
|
243 |
} |
|
244 |
}); |
|
245 |
} |
|
246 |
||
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
|
247 |
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
|
248 |
{ |
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
|
249 |
// 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
|
250 |
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
|
251 |
return true; |
78
4df25dfdde63
Modified Text_Wiki parser to fully support UTF-8 strings; several other UTF-8 fixes, international characters seem to work reasonably well now
Dan
parents:
76
diff
changeset
|
252 |
//goBusy('Saving page...'); |
1 | 253 |
var text = ajaxEscape($('ajaxEditArea').getContent()); |
254 |
if(document.mdgAjaxEditor.minor.checked) minor='&minor'; |
|
255 |
else minor=''; |
|
256 |
ajaxPost(stdAjaxPrefix+'&_mode=savepage', 'summary='+document.getElementById('ajaxEditSummary').value+minor+'&text='+text, function() { |
|
257 |
if(ajax.readyState == 4) { |
|
258 |
unBusy(); |
|
259 |
edit_open = false; |
|
260 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
261 |
enableUnload(); |
|
262 |
unselectAllButtonsMinor(); |
|
263 |
} |
|
264 |
}); |
|
265 |
} |
|
266 |
||
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
|
267 |
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
|
268 |
{ |
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 |
// 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
|
270 |
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
|
271 |
return true; |
1 | 272 |
c = confirm('Do you really want to discard your changes?'); |
273 |
if(!c) return; |
|
274 |
ajaxReset(); |
|
275 |
} |
|
276 |
||
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
|
277 |
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
|
278 |
{ |
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
|
279 |
// 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
|
280 |
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
|
281 |
return true; |
1 | 282 |
enableUnload(); |
283 |
setAjaxLoading(); |
|
284 |
ajaxGet(stdAjaxPrefix+'&_mode=getpage&noheaders', function() { |
|
285 |
if(ajax.readyState == 4) { |
|
286 |
unsetAjaxLoading(); |
|
287 |
edit_open = false; |
|
288 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
289 |
selectButtonMajor('article'); |
|
290 |
unselectAllButtonsMinor(); |
|
291 |
} |
|
292 |
}); |
|
293 |
} |
|
294 |
||
295 |
// Miscellaneous AJAX applets |
|
296 |
||
297 |
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
|
298 |
// 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
|
299 |
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
|
300 |
return true; |
1 | 301 |
if(shift) { |
302 |
r = 'NO_REASON'; |
|
303 |
} else { |
|
304 |
r = prompt('Reason for (un)protecting:'); |
|
305 |
if(!r || r=='') return; |
|
306 |
} |
|
307 |
setAjaxLoading(); |
|
308 |
document.getElementById('protbtn_0').style.textDecoration = 'none'; |
|
309 |
document.getElementById('protbtn_1').style.textDecoration = 'none'; |
|
310 |
document.getElementById('protbtn_2').style.textDecoration = 'none'; |
|
311 |
document.getElementById('protbtn_'+l).style.textDecoration = 'underline'; |
|
241
39c132e69781
Hopefully now all calls to escape() are replaced with ajaxEscape() in response to Tomasz's forum post; remove deprecated version of show_category_info() from functions.php
Dan
parents:
171
diff
changeset
|
312 |
ajaxPost(stdAjaxPrefix+'&_mode=protect', 'reason='+ajaxEscape(r)+'&level='+l, function() { |
1 | 313 |
if(ajax.readyState == 4) { |
314 |
unsetAjaxLoading(); |
|
315 |
if(ajax.responseText != 'good') |
|
316 |
alert(ajax.responseText); |
|
317 |
} |
|
318 |
}); |
|
319 |
} |
|
320 |
||
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
|
321 |
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
|
322 |
{ |
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
|
323 |
// 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
|
324 |
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
|
325 |
return true; |
1 | 326 |
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.'); |
327 |
if(!r || r=='') return; |
|
328 |
setAjaxLoading(); |
|
241
39c132e69781
Hopefully now all calls to escape() are replaced with ajaxEscape() in response to Tomasz's forum post; remove deprecated version of show_category_info() from functions.php
Dan
parents:
171
diff
changeset
|
329 |
ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+ajaxEscape(r), function() { |
1 | 330 |
if(ajax.readyState == 4) { |
331 |
unsetAjaxLoading(); |
|
332 |
alert(ajax.responseText); |
|
333 |
} |
|
334 |
}); |
|
335 |
} |
|
336 |
||
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
|
337 |
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
|
338 |
{ |
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
|
339 |
// 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
|
340 |
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
|
341 |
return true; |
1 | 342 |
setAjaxLoading(); |
343 |
ajaxPost(ENANO_SPECIAL_CREATEPAGE, ENANO_CREATEPAGE_PARAMS, function() { |
|
344 |
if(ajax.readyState == 4) { |
|
345 |
unsetAjaxLoading(); |
|
346 |
window.location.reload(); |
|
347 |
} |
|
348 |
}); |
|
349 |
} |
|
350 |
||
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
|
351 |
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
|
352 |
{ |
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 |
// 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
|
354 |
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
|
355 |
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
|
356 |
var reason = prompt('Please enter your reason for deleting this page.'); |
28 | 357 |
if ( !reason || reason == '' ) |
358 |
{ |
|
359 |
return false; |
|
360 |
} |
|
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
|
361 |
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 | 362 |
if(!c) |
363 |
{ |
|
364 |
return; |
|
365 |
} |
|
1 | 366 |
setAjaxLoading(); |
241
39c132e69781
Hopefully now all calls to escape() are replaced with ajaxEscape() in response to Tomasz's forum post; remove deprecated version of show_category_info() from functions.php
Dan
parents:
171
diff
changeset
|
367 |
ajaxPost(stdAjaxPrefix+'&_mode=deletepage', 'reason=' + ajaxEscape(reason), function() { |
1 | 368 |
if(ajax.readyState == 4) { |
369 |
unsetAjaxLoading(); |
|
370 |
alert(ajax.responseText); |
|
371 |
window.location.reload(); |
|
372 |
} |
|
373 |
}); |
|
374 |
} |
|
375 |
||
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
|
376 |
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
|
377 |
{ |
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
|
378 |
// 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
|
379 |
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
|
380 |
return true; |
1 | 381 |
c = confirm('Are you sure that you want to vote that this page be deleted?'); |
382 |
if(!c) return; |
|
383 |
setAjaxLoading(); |
|
384 |
ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() { |
|
385 |
if(ajax.readyState == 4) { |
|
386 |
unsetAjaxLoading(); |
|
387 |
alert(ajax.responseText); |
|
388 |
} |
|
389 |
}); |
|
390 |
} |
|
391 |
||
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
|
392 |
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
|
393 |
{ |
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
|
394 |
// 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
|
395 |
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
|
396 |
return true; |
1 | 397 |
c = confirm('This will reset the number of votes against this page to zero. Do you really want to do this?'); |
398 |
if(!c) return; |
|
399 |
setAjaxLoading(); |
|
400 |
ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() { |
|
401 |
if(ajax.readyState == 4) { |
|
402 |
unsetAjaxLoading(); |
|
403 |
alert(ajax.responseText); |
|
404 |
item = document.getElementById('mdgDeleteVoteNoticeBox'); |
|
405 |
if(item) |
|
406 |
{ |
|
407 |
opacity('mdgDeleteVoteNoticeBox', 100, 0, 1000); |
|
408 |
setTimeout("document.getElementById('mdgDeleteVoteNoticeBox').style.display = 'none';", 1000); |
|
409 |
} |
|
410 |
} |
|
411 |
}); |
|
412 |
} |
|
413 |
||
414 |
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
|
415 |
// 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
|
416 |
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
|
417 |
return true; |
1 | 418 |
setAjaxLoading(); |
419 |
document.getElementById('wikibtn_0').style.textDecoration = 'none'; |
|
420 |
document.getElementById('wikibtn_1').style.textDecoration = 'none'; |
|
421 |
document.getElementById('wikibtn_2').style.textDecoration = 'none'; |
|
422 |
document.getElementById('wikibtn_'+val).style.textDecoration = 'underline'; |
|
423 |
ajaxGet(stdAjaxPrefix+'&_mode=setwikimode&mode='+val, function() { |
|
424 |
if(ajax.readyState == 4) { |
|
425 |
unsetAjaxLoading(); |
|
426 |
if(ajax.responseText!='GOOD') |
|
427 |
{ |
|
428 |
alert(ajax.responseText); |
|
429 |
} |
|
430 |
} |
|
431 |
}); |
|
432 |
} |
|
433 |
||
434 |
// Editing/saving category information |
|
435 |
// This was not easy to write, I hope enjoy it, and dang I swear I'm gonna |
|
436 |
// find someone to work on just the Javascript part of Enano... |
|
437 |
||
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
|
438 |
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
|
439 |
{ |
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
|
440 |
// 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
|
441 |
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
|
442 |
return true; |
1 | 443 |
setAjaxLoading(); |
444 |
ajaxGet(stdAjaxPrefix+'&_mode=catedit', function() { |
|
445 |
if(ajax.readyState == 4) { |
|
446 |
unsetAjaxLoading(); |
|
447 |
edit_open = false; |
|
448 |
eval(ajax.responseText); |
|
449 |
} |
|
450 |
}); |
|
451 |
} |
|
452 |
||
453 |
function ajaxCatSave() |
|
454 |
{ |
|
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
|
455 |
// 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
|
456 |
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
|
457 |
return true; |
1 | 458 |
if(!catlist) |
459 |
{ |
|
460 |
alert('Var catlist has no properties'); |
|
461 |
return; |
|
462 |
} |
|
463 |
query=''; |
|
464 |
for(i=0;i<catlist.length;i++) |
|
465 |
{ |
|
466 |
l = 'if(document.forms.mdgCatForm.mdgCat_'+catlist[i]+'.checked) s = true; else s = false;'; |
|
467 |
eval(l); |
|
468 |
if(s) query = query + '&' + catlist[i] + '=true'; |
|
469 |
} |
|
470 |
setAjaxLoading(); |
|
471 |
query = query.substring(1, query.length); |
|
472 |
ajaxPost(stdAjaxPrefix+'&_mode=catsave', query, function() { |
|
473 |
if(ajax.readyState == 4) { |
|
474 |
unsetAjaxLoading(); |
|
475 |
edit_open = false; |
|
476 |
if(ajax.responseText != 'GOOD') alert(ajax.responseText); |
|
477 |
ajaxReset(); |
|
478 |
} |
|
479 |
}); |
|
480 |
} |
|
481 |
||
482 |
// History stuff |
|
483 |
||
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
|
484 |
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
|
485 |
{ |
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
|
486 |
// 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
|
487 |
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
|
488 |
return true; |
1 | 489 |
setAjaxLoading(); |
490 |
ajaxGet(stdAjaxPrefix+'&_mode=histlist', function() { |
|
491 |
if(ajax.readyState == 4) { |
|
492 |
unsetAjaxLoading(); |
|
493 |
edit_open = false; |
|
494 |
selectButtonMajor('article'); |
|
495 |
selectButtonMinor('history'); |
|
496 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
497 |
buildDiffList(); |
|
498 |
} |
|
499 |
}); |
|
500 |
} |
|
501 |
||
502 |
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
|
503 |
// 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
|
504 |
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
|
505 |
return true; |
1 | 506 |
if(!tit) tit=title; |
507 |
setAjaxLoading(); |
|
508 |
ajaxGet(append_sid(scriptPath+'/ajax.php?title='+tit+'&_mode=getpage&oldid='+oldid), function() { |
|
509 |
if(ajax.readyState == 4) { |
|
510 |
unsetAjaxLoading(); |
|
511 |
edit_open = false; |
|
512 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
513 |
} |
|
514 |
}); |
|
515 |
} |
|
516 |
||
517 |
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
|
518 |
// 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
|
519 |
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
|
520 |
return true; |
1 | 521 |
setAjaxLoading(); |
522 |
ajaxGet(stdAjaxPrefix+'&_mode=rollback&id='+id, function() { |
|
523 |
if(ajax.readyState == 4) { |
|
524 |
unsetAjaxLoading(); |
|
525 |
alert(ajax.responseText); |
|
526 |
} |
|
527 |
}); |
|
528 |
} |
|
529 |
||
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
|
530 |
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
|
531 |
{ |
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
|
532 |
// 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
|
533 |
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
|
534 |
return true; |
1 | 535 |
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?'); |
536 |
if(!c) return; |
|
537 |
c = confirm('You\'re ABSOLUTELY sure???'); |
|
538 |
if(!c) return; |
|
539 |
setAjaxLoading(); |
|
540 |
ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() { |
|
541 |
if(ajax.readyState == 4) { |
|
542 |
unsetAjaxLoading(); |
|
543 |
alert(ajax.responseText); |
|
544 |
window.location.reload(); |
|
545 |
} |
|
546 |
}); |
|
547 |
} |
|
548 |
||
549 |
var timelist; |
|
550 |
||
551 |
function buildDiffList() |
|
552 |
{ |
|
553 |
arrDiff1Buttons = getElementsByClassName(document, 'input', 'clsDiff1Radio'); |
|
554 |
arrDiff2Buttons = getElementsByClassName(document, 'input', 'clsDiff2Radio'); |
|
555 |
var len = arrDiff1Buttons.length; |
|
556 |
if ( len < 1 ) |
|
557 |
return false; |
|
558 |
timelist = new Array(); |
|
559 |
for ( var i = 0; i < len; i++ ) |
|
560 |
{ |
|
561 |
timelist.push( arrDiff2Buttons[i].id.substr(6) ); |
|
562 |
} |
|
563 |
timelist.push( arrDiff1Buttons[len-1].id.substr(6) ); |
|
564 |
delete(timelist.toJSONString); |
|
565 |
for ( var i = 1; i < timelist.length-1; i++ ) |
|
566 |
{ |
|
567 |
if ( i >= timelist.length ) break; |
|
568 |
arrDiff2Buttons[i].style.display = 'none'; |
|
569 |
} |
|
570 |
} |
|
571 |
||
572 |
function selectDiff1Button(obj) |
|
573 |
{ |
|
574 |
var this_time = obj.id.substr(6); |
|
575 |
var index = parseInt(in_array(this_time, timelist)); |
|
576 |
for ( var i = 0; i < timelist.length - 1; i++ ) |
|
577 |
{ |
|
578 |
if ( i < timelist.length - 1 ) |
|
579 |
{ |
|
580 |
var state = ( i < index ) ? 'inline' : 'none'; |
|
581 |
var id = 'diff2_' + timelist[i]; |
|
582 |
document.getElementById(id).style.display = state; |
|
583 |
||
584 |
// alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i); |
|
585 |
} |
|
586 |
} |
|
587 |
} |
|
588 |
||
589 |
function selectDiff2Button(obj) |
|
590 |
{ |
|
591 |
var this_time = obj.id.substr(6); |
|
592 |
var index = parseInt(in_array(this_time, timelist)); |
|
593 |
for ( var i = 1; i < timelist.length; i++ ) |
|
594 |
{ |
|
595 |
if ( i < timelist.length - 1 ) |
|
596 |
{ |
|
597 |
var state = ( i > index ) ? 'inline' : 'none'; |
|
598 |
var id = 'diff1_' + timelist[i]; |
|
599 |
document.getElementById(id).style.display = state; |
|
600 |
||
601 |
// alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i); |
|
602 |
} |
|
603 |
} |
|
604 |
} |
|
605 |
||
606 |
function ajaxHistDiff() |
|
607 |
{ |
|
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
|
608 |
// 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
|
609 |
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
|
610 |
return true; |
1 | 611 |
var id1=false; |
612 |
var id2=false; |
|
613 |
for ( i = 0; i < arrDiff1Buttons.length; i++ ) |
|
614 |
{ |
|
615 |
k = i + ''; |
|
616 |
kpp = i + 1; |
|
617 |
kpp = kpp + ''; |
|
618 |
if(arrDiff1Buttons[k].checked) id1 = arrDiff1Buttons[k].id.substr(6); |
|
619 |
if(arrDiff2Buttons[k].checked) id2 = arrDiff2Buttons[k].id.substr(6); |
|
620 |
} |
|
621 |
if(!id1 || !id2) { alert('BUG: Couldn\'t get checked radiobutton state'); return; } |
|
622 |
setAjaxLoading(); |
|
623 |
ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function() |
|
624 |
{ |
|
625 |
if(ajax.readyState==4) |
|
626 |
{ |
|
627 |
unsetAjaxLoading(); |
|
628 |
document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText; |
|
629 |
} |
|
630 |
}); |
|
631 |
} |
|
632 |
||
633 |
// Change the user's preferred style/theme |
|
634 |
||
635 |
function ajaxChangeStyle() |
|
636 |
{ |
|
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
|
637 |
// 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
|
638 |
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
|
639 |
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
|
640 |
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
|
641 |
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
|
642 |
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
|
643 |
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
|
644 |
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
|
645 |
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
|
646 |
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
|
647 |
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
|
648 |
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
|
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 |
|
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 |
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
|
652 |
{ |
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
|
653 |
// 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
|
654 |
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
|
655 |
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
|
656 |
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
|
657 |
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
|
658 |
{ |
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 |
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
|
660 |
} |
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 ( 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
|
662 |
{ |
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 |
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
|
664 |
} |
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 |
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
|
666 |
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
|
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 |
// 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
|
669 |
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
|
670 |
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
|
671 |
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
|
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 |
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
|
674 |
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
|
675 |
} |
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 |
// 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
|
678 |
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
|
679 |
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
|
680 |
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
|
681 |
{ |
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 |
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
|
683 |
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
|
684 |
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
|
685 |
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
|
686 |
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
|
687 |
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
|
688 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
689 |
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
|
690 |
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
|
691 |
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
|
692 |
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
|
693 |
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
|
694 |
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
|
695 |
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
|
696 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
697 |
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
|
698 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
699 |
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
|
700 |
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
|
701 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
702 |
// 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
|
703 |
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
|
704 |
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
|
705 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
706 |
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
|
707 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
708 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
709 |
}); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
710 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
711 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
712 |
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
|
713 |
{ |
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
|
714 |
// 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
|
715 |
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
|
716 |
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
|
717 |
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
|
718 |
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
|
719 |
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
|
720 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
721 |
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
|
722 |
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
|
723 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
724 |
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
|
725 |
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
|
726 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
727 |
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
|
728 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
729 |
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
|
730 |
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
|
731 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
732 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
733 |
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
|
734 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
735 |
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
|
736 |
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
|
737 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
738 |
|
241
39c132e69781
Hopefully now all calls to escape() are replaced with ajaxEscape() in response to Tomasz's forum post; remove deprecated version of show_category_info() from functions.php
Dan
parents:
171
diff
changeset
|
739 |
ajaxPost(stdAjaxPrefix + '&_mode=change_theme', 'theme_id=' + ajaxEscape(theme_id) + '&style_id=' + ajaxEscape(style_id), function() |
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
|
740 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
741 |
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
|
742 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
743 |
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
|
744 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
745 |
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
|
746 |
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
|
747 |
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
|
748 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
749 |
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
|
750 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
751 |
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
|
752 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
753 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
754 |
}); |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
755 |
|
30 | 756 |
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
|
757 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
758 |
} |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
759 |
|
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
760 |
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
|
761 |
{ |
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
28
diff
changeset
|
762 |
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
|
763 |
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
|
764 |
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
|
765 |
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
|
766 |
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
|
767 |
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
|
768 |
} |
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
|
769 |
|
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
|
770 |
/* |
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
|
771 |
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
|
772 |
{ |
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
|
773 |
// 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
|
774 |
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
|
775 |
return true; |
1 | 776 |
var win = document.getElementById("cn2"); |
777 |
win.innerHTML = ' \ |
|
778 |
<form action="'+ENANO_SPECIAL_CHANGESTYLE+'" onsubmit="jws.closeWin(\'root2\');" method="post" style="text-align: center"> \ |
|
779 |
<h3>Select a theme...</h3>\ |
|
780 |
<select id="mdgThemeID" name="theme" onchange="ajaxGetStyles(this.value);"> \ |
|
781 |
'+ENANO_THEME_LIST+' \ |
|
782 |
</select> \ |
|
783 |
<div id="styleSelector"></div>\ |
|
784 |
<br /><br />\ |
|
785 |
<input type="hidden" name="return_to" value="'+title+'" />\ |
|
786 |
<input id="styleSubmitter" type="submit" style="display: none; font-weight: bold" value="Change theme" /> \ |
|
787 |
<input type="button" value="Cancel" onclick="jws.closeWin(\'root2\');" /> \ |
|
788 |
</form> \ |
|
789 |
'; |
|
790 |
ajaxGetStyles(ENANO_CURRENT_THEME); |
|
791 |
jws.openWin('root2', 340, 300); |
|
792 |
} |
|
793 |
||
794 |
function ajaxGetStyles(id) { |
|
795 |
setAjaxLoading(); |
|
796 |
ajaxGet(stdAjaxPrefix+'&_mode=getstyles&id='+id, function() { |
|
797 |
if(ajax.readyState == 4) { |
|
798 |
unsetAjaxLoading(); |
|
799 |
eval(ajax.responseText); |
|
800 |
html = '<h3>And a style...</h3><select id="mdgStyleID" name="style">'; |
|
801 |
for(i=0;i<list.length;i++) { |
|
802 |
lname = list[i].substr(0, 1).toUpperCase() + list[i].substr(1, list[i].length); |
|
803 |
html = html + '<option value="'+list[i]+'">'+lname+'</option>'; |
|
804 |
} |
|
805 |
html = html + '</select>'; |
|
806 |
document.getElementById('styleSelector').innerHTML = html; |
|
807 |
document.getElementById('styleSubmitter').style.display = 'inline'; |
|
808 |
} |
|
809 |
}); |
|
810 |
} |
|
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
|
811 |
*/ |
1 | 812 |
|
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
|
813 |
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
|
814 |
{ |
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
|
815 |
// 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
|
816 |
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
|
817 |
return true; |
1 | 818 |
setAjaxLoading(); |
819 |
if(_css) { |
|
820 |
document.getElementById('mdgCss').href = main_css; |
|
821 |
_css = false; |
|
822 |
} else { |
|
823 |
document.getElementById('mdgCss').href = print_css; |
|
824 |
_css = true; |
|
825 |
} |
|
826 |
unsetAjaxLoading(); |
|
827 |
menuOff(); |
|
828 |
} |
|
829 |
||
830 |
function ajaxSetPassword() |
|
831 |
{ |
|
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
|
832 |
// 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
|
833 |
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
|
834 |
return true; |
1 | 835 |
pass = hex_sha1(document.getElementById('mdgPassSetField').value); |
836 |
setAjaxLoading(); |
|
837 |
ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function() |
|
838 |
{ |
|
839 |
unsetAjaxLoading(); |
|
840 |
if(ajax.readyState==4) |
|
841 |
{ |
|
842 |
alert(ajax.responseText); |
|
843 |
} |
|
844 |
} |
|
845 |
); |
|
846 |
} |
|
847 |
||
848 |
function ajaxStartLogin() |
|
849 |
{ |
|
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
|
850 |
// 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
|
851 |
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
|
852 |
return true; |
1 | 853 |
ajaxPromptAdminAuth(function(k) { |
854 |
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
|
855 |
}, 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
|
856 |
} |
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
|
857 |
|
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
|
858 |
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
|
859 |
{ |
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
|
860 |
// 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
|
861 |
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
|
862 |
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
|
863 |
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
|
864 |
{ |
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
|
865 |
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
|
866 |
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
|
867 |
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
|
868 |
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
|
869 |
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
|
870 |
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
|
871 |
}, 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
|
872 |
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
|
873 |
} |
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
|
874 |
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
|
875 |
window.location = loc; |
1 | 876 |
} |
877 |
||
878 |
function ajaxAdminPage() |
|
879 |
{ |
|
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
|
880 |
// 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
|
881 |
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
|
882 |
return true; |
1 | 883 |
if ( auth_level < USER_LEVEL_ADMIN ) |
884 |
{ |
|
885 |
ajaxPromptAdminAuth(function(k) { |
|
886 |
ENANO_SID = k; |
|
887 |
auth_level = USER_LEVEL_ADMIN; |
|
888 |
var loc = String(window.location + ''); |
|
889 |
window.location = append_sid(loc); |
|
890 |
var loc = makeUrlNS('Special', 'Administration', 'module=' + namespace_list['Admin'] + 'PageManager&source=ajax&page_id=' + ajaxEscape(title)); |
|
891 |
if ( (ENANO_SID + ' ').length > 1 ) |
|
892 |
window.location = loc; |
|
893 |
}, 9); |
|
894 |
return false; |
|
895 |
} |
|
896 |
var loc = makeUrlNS('Special', 'Administration', 'module=' + namespace_list['Admin'] + 'PageManager&source=ajax&page_id=' + ajaxEscape(title)); |
|
897 |
window.location = loc; |
|
898 |
} |
|
899 |
||
171
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
900 |
var navto_ns; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
901 |
var navto_pg; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
902 |
var navto_ul; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
903 |
|
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
904 |
function ajaxLoginNavTo(namespace, page_id, min_level) |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
905 |
{ |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
906 |
// IE <6 pseudo-compatibility |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
907 |
if ( KILL_SWITCH ) |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
908 |
return true; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
909 |
navto_pg = page_id; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
910 |
navto_ns = namespace; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
911 |
navto_ul = min_level; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
912 |
if ( auth_level < min_level ) |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
913 |
{ |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
914 |
ajaxPromptAdminAuth(function(k) { |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
915 |
ENANO_SID = k; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
916 |
auth_level = navto_ul; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
917 |
var loc = makeUrlNS(navto_ns, navto_pg); |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
918 |
if ( (ENANO_SID + ' ').length > 1 ) |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
919 |
window.location = loc; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
920 |
}, min_level); |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
921 |
return false; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
922 |
} |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
923 |
var loc = makeUrlNS(navto_ns, navto_pg); |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
924 |
window.location = loc; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
925 |
} |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
169
diff
changeset
|
926 |
|
103
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
927 |
function ajaxAdminUser(username) |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
928 |
{ |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
929 |
// IE <6 pseudo-compatibility |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
930 |
if ( KILL_SWITCH ) |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
931 |
return true; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
932 |
if ( auth_level < USER_LEVEL_ADMIN ) |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
933 |
{ |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
934 |
ajaxPromptAdminAuth(function(k) { |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
935 |
ENANO_SID = k; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
936 |
auth_level = USER_LEVEL_ADMIN; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
937 |
var loc = String(window.location + ''); |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
938 |
window.location = append_sid(loc); |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
939 |
var loc = makeUrlNS('Special', 'Administration', 'module=' + namespace_list['Admin'] + 'UserManager&src=get&user=' + ajaxEscape(username)); |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
940 |
if ( (ENANO_SID + ' ').length > 1 ) |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
941 |
window.location = loc; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
942 |
}, 9); |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
943 |
return false; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
944 |
} |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
945 |
var loc = makeUrlNS('Special', 'Administration', 'module=' + namespace_list['Admin'] + 'UserManager&src=get&user=' + ajaxEscape(username)); |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
946 |
window.location = loc; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
947 |
} |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
87
diff
changeset
|
948 |
|
11
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
949 |
function ajaxDisableEmbeddedPHP() |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
950 |
{ |
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
|
951 |
// 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
|
952 |
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
|
953 |
return true; |
11
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
954 |
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
|
955 |
return false; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
956 |
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
|
957 |
if ( !$killdiv.object ) |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
958 |
{ |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
959 |
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
|
960 |
return false; |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
961 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
962 |
$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
|
963 |
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
|
964 |
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
|
965 |
if ( ajax.readyState == 4 ) |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
966 |
{ |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
967 |
if ( ajax.responseText == '1' ) |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
968 |
{ |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
969 |
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
|
970 |
//$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
|
971 |
$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
|
972 |
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
|
973 |
// 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
|
974 |
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
|
975 |
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
|
976 |
$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
|
977 |
$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
|
978 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
979 |
else |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
980 |
{ |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
981 |
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
|
982 |
$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
|
983 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
984 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
985 |
}); |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
986 |
} |
ccad6026a168
Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents:
1
diff
changeset
|
987 |
|
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
988 |
var catHTMLBuf = false; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
989 |
|
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
990 |
function ajaxCatToTag() |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
991 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
992 |
if ( KILL_SWITCH ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
993 |
return false; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
994 |
setAjaxLoading(); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
995 |
ajaxGet(stdAjaxPrefix + '&_mode=get_tags', function() |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
996 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
997 |
if ( ajax.readyState == 4 ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
998 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
999 |
unsetAjaxLoading(); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1000 |
var resptext = String(ajax.responseText + ' '); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1001 |
resptext = resptext.substr(0, resptext.length-1); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1002 |
if ( resptext.substr(0, 1) != '{' ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1003 |
{ |
259
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
1004 |
handle_invalid_json(resptext); |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1005 |
return false; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1006 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1007 |
var json = parseJSON(resptext); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1008 |
var catbox = document.getElementById('mdgCatBox'); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1009 |
if ( !catbox ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1010 |
return false; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1011 |
var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1012 |
linkbox.firstChild.nodeValue = 'show page categorization'; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1013 |
linkbox.onclick = function() { ajaxTagToCat(); return false; }; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1014 |
catHTMLBuf = catbox.innerHTML; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1015 |
catbox.innerHTML = ''; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1016 |
catbox.appendChild(document.createTextNode('Page tags: ')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1017 |
if ( json.tags.length < 1 ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1018 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1019 |
catbox.appendChild(document.createTextNode('No tags on this page')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1020 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1021 |
for ( var i = 0; i < json.tags.length; i++ ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1022 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1023 |
catbox.appendChild(document.createTextNode(json.tags[i].name)); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1024 |
if ( json.tags[i].can_del ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1025 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1026 |
catbox.appendChild(document.createTextNode(' ')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1027 |
var a = document.createElement('a'); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1028 |
a.appendChild(document.createTextNode('[X]')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1029 |
a.href = '#'; |
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1030 |
a._js_tag_id = json.tags[i].id; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1031 |
a.onclick = function() { ajaxDeleteTag(this, this._js_tag_id); return false; } |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1032 |
catbox.appendChild(a); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1033 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1034 |
if ( ( i + 1 ) < json.tags.length ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1035 |
catbox.appendChild(document.createTextNode(', ')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1036 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1037 |
if ( json.can_add ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1038 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1039 |
catbox.appendChild(document.createTextNode(' ')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1040 |
var addlink = document.createElement('a'); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1041 |
addlink.href = '#'; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1042 |
addlink.onclick = function() { try { ajaxAddTagStage1(); } catch(e) { }; return false; }; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1043 |
addlink.appendChild(document.createTextNode('(add a tag)')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1044 |
catbox.appendChild(addlink); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1045 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1046 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1047 |
}); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1048 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1049 |
|
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1050 |
var addtag_open = false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1051 |
|
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1052 |
function ajaxAddTagStage1() |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1053 |
{ |
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1054 |
if ( addtag_open ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1055 |
return false; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1056 |
var catbox = document.getElementById('mdgCatBox'); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1057 |
var adddiv = document.createElement('div'); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1058 |
var text = document.createElement('input'); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1059 |
var addlink = document.createElement('a'); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1060 |
addlink.href = '#'; |
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1061 |
addlink.onclick = function() { ajaxAddTagStage2(this.parentNode.firstChild.nextSibling.value, this.parentNode); return false; }; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1062 |
addlink.appendChild(document.createTextNode('+ Add')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1063 |
text.type = 'text'; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1064 |
text.size = '15'; |
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1065 |
text.onkeyup = function(e) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1066 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1067 |
if ( e.keyCode == 13 ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1068 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1069 |
ajaxAddTagStage2(this.value, this.parentNode); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1070 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1071 |
} |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1072 |
|
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1073 |
adddiv.style.margin = '5px 0 0 0'; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1074 |
adddiv.appendChild(document.createTextNode('Add a tag: ')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1075 |
adddiv.appendChild(text); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1076 |
adddiv.appendChild(document.createTextNode(' ')); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1077 |
adddiv.appendChild(addlink); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1078 |
catbox.appendChild(adddiv); |
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1079 |
addtag_open = true; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1080 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1081 |
|
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1082 |
var addtag_nukeme = false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1083 |
|
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1084 |
function ajaxAddTagStage2(tag, nukeme) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1085 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1086 |
if ( !addtag_open ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1087 |
return false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1088 |
if ( addtag_nukeme ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1089 |
return false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1090 |
addtag_nukeme = nukeme; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1091 |
tag = ajaxEscape(tag); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1092 |
setAjaxLoading(); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1093 |
ajaxPost(stdAjaxPrefix + '&_mode=addtag', 'tag=' + tag, function() |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1094 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1095 |
if ( ajax.readyState == 4 ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1096 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1097 |
unsetAjaxLoading(); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1098 |
var nukeme = addtag_nukeme; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1099 |
addtag_nukeme = false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1100 |
var resptext = String(ajax.responseText + ' '); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1101 |
resptext = resptext.substr(0, resptext.length-1); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1102 |
if ( resptext.substr(0, 1) != '{' ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1103 |
{ |
259
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
241
diff
changeset
|
1104 |
handle_invalid_json(resptext); |
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1105 |
return false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1106 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1107 |
var json = parseJSON(resptext); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1108 |
var parent = nukeme.parentNode; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1109 |
parent.removeChild(nukeme); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1110 |
addtag_open = false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1111 |
if ( json.success ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1112 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1113 |
var node = parent.childNodes[1]; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1114 |
var insertafter = false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1115 |
var nukeafter = false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1116 |
if ( node.nodeValue == 'No tags on this page' ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1117 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1118 |
nukeafter = true; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1119 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1120 |
insertafter = parent.childNodes[ parent.childNodes.length - 3 ]; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1121 |
// these need to be inserted in reverse order |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1122 |
if ( json.can_del ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1123 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1124 |
var a = document.createElement('a'); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1125 |
a.appendChild(document.createTextNode('[X]')); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1126 |
a.href = '#'; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1127 |
a._js_tag_id = json.tag_id; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1128 |
a.onclick = function() { ajaxDeleteTag(this, this._js_tag_id); return false; } |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1129 |
insertAfter(parent, a, insertafter); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1130 |
insertAfter(parent, document.createTextNode(' '), insertafter); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1131 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1132 |
insertAfter(parent, document.createTextNode(json.tag), insertafter); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1133 |
if ( !nukeafter ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1134 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1135 |
insertAfter(parent, document.createTextNode(', '), insertafter); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1136 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1137 |
if ( nukeafter ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1138 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1139 |
parent.removeChild(insertafter); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1140 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1141 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1142 |
else |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1143 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1144 |
alert(json.error); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1145 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1146 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1147 |
}); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1148 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1149 |
|
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1150 |
function ajaxDeleteTag(parentobj, tag_id) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1151 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1152 |
var arrDelete = [ parentobj, parentobj.previousSibling, parentobj.previousSibling.previousSibling ]; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1153 |
var parent = parentobj.parentNode; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1154 |
var writeNoTags = false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1155 |
if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == ', ' ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1156 |
arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1157 |
else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1158 |
arrDelete.push(parentobj.nextSibling); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1159 |
|
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1160 |
if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' && |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1161 |
parentobj.nextSibling.nextSibling.firstChild ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1162 |
if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == '(add a tag)') |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1163 |
writeNoTags = true; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1164 |
|
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1165 |
ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function() |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1166 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1167 |
if ( ajax.readyState == 4 ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1168 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1169 |
if ( ajax.responseText == 'success' ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1170 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1171 |
for ( var i = 0; i < arrDelete.length; i++ ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1172 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1173 |
try |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1174 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1175 |
parent.removeChild(arrDelete[i]); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1176 |
} catch(e) {} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1177 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1178 |
if ( writeNoTags ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1179 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1180 |
var node1 = document.createTextNode('No tags on this page'); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1181 |
var node2 = document.createTextNode(' '); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1182 |
insertAfter(parent, node1, parent.firstChild); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1183 |
insertAfter(parent, node2, node1); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1184 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1185 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1186 |
else |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1187 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1188 |
alert(ajax.responseText); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1189 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1190 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
78
diff
changeset
|
1191 |
}); |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1192 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1193 |
|
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1194 |
function ajaxTagToCat() |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1195 |
{ |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1196 |
if ( !catHTMLBuf ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1197 |
return false; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1198 |
var catbox = document.getElementById('mdgCatBox'); |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1199 |
if ( !catbox ) |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1200 |
return false; |
87
570f68c3fe36
Redid stupid fading button code and fixed several RC2 bugs in the upgrade schema; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
1201 |
addtag_open = false; |
76
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1202 |
var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1203 |
linkbox.firstChild.nodeValue = 'show page tags'; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1204 |
linkbox.onclick = function() { ajaxCatToTag(); return false; }; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1205 |
catbox.innerHTML = catHTMLBuf; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1206 |
catHTMLBuf = false; |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1207 |
} |
608dee512bf0
Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents:
60
diff
changeset
|
1208 |
|
118
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1209 |
var keepalive_interval = false; |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1210 |
|
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1211 |
function ajaxPingServer() |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1212 |
{ |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1213 |
ajaxGet(stdAjaxPrefix + '&_mode=ping', function() |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1214 |
{ |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1215 |
}); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1216 |
} |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1217 |
|
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1218 |
function ajaxToggleKeepalive() |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1219 |
{ |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1220 |
if ( readCookie('admin_keepalive') == '1' ) |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1221 |
{ |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1222 |
createCookie('admin_keepalive', '0', 3650); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1223 |
if ( keepalive_interval ) |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1224 |
clearInterval(keepalive_interval); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1225 |
var span = document.getElementById('keepalivestat'); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1226 |
span.firstChild.nodeValue = 'Turn on keep-alive'; |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1227 |
} |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1228 |
else |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1229 |
{ |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1230 |
createCookie('admin_keepalive', '1', 3650); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1231 |
if ( !keepalive_interval ) |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1232 |
keepalive_interval = setInterval('ajaxPingServer();', 600000); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1233 |
var span = document.getElementById('keepalivestat'); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1234 |
span.firstChild.nodeValue = 'Turn off keep-alive'; |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1235 |
ajaxPingServer(); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1236 |
} |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1237 |
} |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1238 |
|
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1239 |
var keepalive_onload = function() |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1240 |
{ |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1241 |
if ( readCookie('admin_keepalive') == '1' ) |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1242 |
{ |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1243 |
if ( !keepalive_interval ) |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1244 |
keepalive_interval = setInterval('ajaxPingServer();', 600000); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1245 |
var span = document.getElementById('keepalivestat'); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1246 |
span.firstChild.nodeValue = 'Turn off keep-alive'; |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1247 |
} |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1248 |
else |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1249 |
{ |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1250 |
if ( keepalive_interval ) |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1251 |
clearInterval(keepalive_interval); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1252 |
var span = document.getElementById('keepalivestat'); |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1253 |
span.firstChild.nodeValue = 'Turn on keep-alive'; |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1254 |
} |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1255 |
}; |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1256 |
|
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1257 |
function aboutKeepAlive() |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1258 |
{ |
169
250aeb408ed7
Minor text change + link to docs for "about keep-alive" help dialog
Dan
parents:
133
diff
changeset
|
1259 |
new messagebox(MB_OK|MB_ICONINFORMATION, 'About the keep-alive feature', 'Keep-alive is a new Enano feature that keeps your administrative session from timing out while you are using the administration panel. This feature can be useful if you are editing a large page or doing something in the administration interface that will take longer than 15 minutes.<br /><br />For security reasons, Enano mandates that high-privilege logins last only 15 minutes, with the time being reset each time a page is loaded (or, more specifically, each time the session API is started). The consequence of this is that if you are performing an action in the administration panel that takes more than 15 minutes, your session may be terminated. The keep-alive feature attempts to relieve this by sending a "ping" to the server every 10 minutes.<br /><br />Please note that keep-alive state is determined by a cookie. Thus, if you log out and then back in as a different administrator, keep-alive will use the same setting that was used when you were logged in as the first administrative user. In the same way, if you log into the administration panel under your account from another computer, keep-alive will be set to "off".<br /><br /><b>For more information:</b><br /><a href="http://docs.enanocms.org/Help:Appendix_B" onclick="window.open(this.href); return false;">Overview of Enano'+"'"+'s security model'); |
118
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1260 |
} |
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
103
diff
changeset
|
1261 |