annotate majax.inc.php @ 511:6fe66ea0e954

Move most of the results code to site module, remove the support for HTML type output.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 08 Dec 2013 02:16:26 +0200
parents 7d732915dce9
children ed2247111fdd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
1 <?
136
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
2 //
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
3 // FAPWeb Simple Demoparty System
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
4 // Common AJAX Javascript code module
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
5 // (C) Copyright 2012-2013 Tecnic Software productions (TNSP)
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
6 //
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
7
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
8
445
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
9 function stCommonAJAX($backend, $failover, $script = FALSE, $tabs = FALSE)
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
10 {
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
11 if ($script)
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
12 echo "<script type=\"text/javascript\">\n";
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
13
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
14 ?>
399
23f22fb6f2d8 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
15 function jsCloseMessageBox(callback, cb_data)
340
87e57f0aa0e5 Use a wrapper function for alert(), we might be changing the functionality
Matti Hamalainen <ccr@tnsp.org>
parents: 317
diff changeset
16 {
349
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
17 var nitem = document.getElementById("messageBox");
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
18 if (nitem && nitem.style.display != "none")
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
19 {
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
20 nitem.style.display = "none";
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
21
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
22 if (callback && typeof(callback) === "function")
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
23 callback(cb_data);
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
24 }
340
87e57f0aa0e5 Use a wrapper function for alert(), we might be changing the functionality
Matti Hamalainen <ccr@tnsp.org>
parents: 317
diff changeset
25 }
87e57f0aa0e5 Use a wrapper function for alert(), we might be changing the functionality
Matti Hamalainen <ccr@tnsp.org>
parents: 317
diff changeset
26
349
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
27
343
e799da13c0f3 Rename messageBox() to jsMessageBox().
Matti Hamalainen <ccr@tnsp.org>
parents: 342
diff changeset
28 function jsMessageBox(msg)
349
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
29 {
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
30 var nitem = document.getElementById("messageBox");
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
31 if (nitem)
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
32 {
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
33 nitem.innerHTML = "<div class='messageBoxInner'>"+ msg +
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
34 "<div class='messageBoxControls'>"+
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
35 "<input id='msgBoxConfirmClose' type='button' value=' OK '>"+
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
36 "</div></div>";
340
87e57f0aa0e5 Use a wrapper function for alert(), we might be changing the functionality
Matti Hamalainen <ccr@tnsp.org>
parents: 317
diff changeset
37
399
23f22fb6f2d8 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
38 document.getElementById("msgBoxConfirmClose").onclick = function () { jsCloseMessageBox(0, 0); }
349
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
39
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
40 nitem.style.display = "block";
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
41 }
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
42 }
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
43
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
44
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
45 function jsConfirmBox(msg, cb_ok, cb_cancel, cb_data)
341
eaf435c99fe4 Add confirmBox() wrapper function as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 340
diff changeset
46 {
349
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
47 var nitem = document.getElementById("messageBox");
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
48 if (nitem)
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
49 {
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
50 nitem.innerHTML = "<div class='messageBoxInner'><h1>Confirmation</h1><p>"+ msg +"</p>"+
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
51 "<div class='messageBoxControls'>"+
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
52 "<input id='msgBoxConfirmCancel' type='button' value=' Cancel '>"+
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
53 "<input id='msgBoxConfirmOK' type='button' value=' OK '>"+
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
54 "</div></div>";
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
55
399
23f22fb6f2d8 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
56 document.getElementById("msgBoxConfirmCancel").onclick = function () { jsCloseMessageBox(cb_cancel, cb_data); }
23f22fb6f2d8 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
57 document.getElementById("msgBoxConfirmOK").onclick = function () { jsCloseMessageBox(cb_ok, cb_data); }
349
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
58
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
59 nitem.style.display = "block";
61c4dda0ec03 New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents: 348
diff changeset
60 }
341
eaf435c99fe4 Add confirmBox() wrapper function as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 340
diff changeset
61 }
eaf435c99fe4 Add confirmBox() wrapper function as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 340
diff changeset
62
eaf435c99fe4 Add confirmBox() wrapper function as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 340
diff changeset
63
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 function statusMsg(msg)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 {
361
842e35d13e6c Check for existence of statusline element.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
66 var nitem = document.getElementById("nstatus");
842e35d13e6c Check for existence of statusline element.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
67 if (nitem) nstatus.innerHTML = msg;
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 function strtrim(str)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 if (!str || str == null)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 return "";
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 return str.replace(/^\s+|\s+$/g,'')
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 function strencode(str)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 return encodeURIComponent(str);
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84
344
6d50238a2d50 Rename createXMLRequest() to jsCreateXMLRequest().
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
85 function jsCreateXMLRequest()
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 var req;
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 if (window.XMLHttpRequest)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 // Modern browsers
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 req = new XMLHttpRequest();
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 else
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 // Old IE versions
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 req = new ActiveXObject("Microsoft.XMLHTTP");
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 return req;
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101
342
3175ec252c73 Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
102 function jsSendPOSTRequest(params, success, failure)
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 {
359
f7a806d5060f Add preliminary code for CSRF prevention via unique hash tokens. Not fully
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
104 <?
f7a806d5060f Add preliminary code for CSRF prevention via unique hash tokens. Not fully
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
105 if (($csrfID = stGetSessionItem("csrfID", FALSE)) !== FALSE)
f7a806d5060f Add preliminary code for CSRF prevention via unique hash tokens. Not fully
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
106 echo " params += \"&csrfID=".$csrfID."\";\n";
f7a806d5060f Add preliminary code for CSRF prevention via unique hash tokens. Not fully
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
107 ?>
344
6d50238a2d50 Rename createXMLRequest() to jsCreateXMLRequest().
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
108 var req = jsCreateXMLRequest();
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
109 req.open("POST", "<? echo $backend ?>", true);
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 req.setRequestHeader("Content-length", params.length);
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 req.setRequestHeader("Connection", "close");
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 req.onreadystatechange = function()
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 if (req.readyState == 4)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 if (req.status == 404)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 {
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
120 window.location = "<? echo $failover ?>";
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 else
208
8985d2bdb29b More work on error handling etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
123 if (req.status == 902)
8985d2bdb29b More work on error handling etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
124 {
8985d2bdb29b More work on error handling etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
125 statusMsg(req.statusText);
348
e48abbbbb3b2 Oops, some messageBox() -> jsMessageBox() renames were missing.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
126 jsMessageBox(req.responseText);
208
8985d2bdb29b More work on error handling etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
127 }
8985d2bdb29b More work on error handling etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
128 else
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 if (req.status == 200)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 if (success)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 success(req.responseText);
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 statusMsg(req.statusText);
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 else
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 if (failure)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 failure(req.status, req.statusText, req.responseText);
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 else
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 statusMsg("["+req.status+" - "+req.statusText+"] "+ req.responseText);
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 req.send(params);
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153
115
87d3ce535834 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 114
diff changeset
154 //
87d3ce535834 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 114
diff changeset
155 // Function for creating AJAX POST request arguments list based
87d3ce535834 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 114
diff changeset
156 // on fields and giving them specified types. Also basic check
87d3ce535834 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 114
diff changeset
157 // for validity can be performed (e.g. field empty or not)
87d3ce535834 Comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 114
diff changeset
158 //
287
71442d864367 Add variable for retrieving parsed data from latest makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 286
diff changeset
159 var lastPostArgs = Object();
346
c922e5200c55 Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 344
diff changeset
160 function jsMakePostArgs(fields, fprefix, fsuffix)
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 var res = [];
287
71442d864367 Add variable for retrieving parsed data from latest makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 286
diff changeset
163 lastPostArgs = Object();
71442d864367 Add variable for retrieving parsed data from latest makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 286
diff changeset
164
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 for (var id in fields)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 {
300
fd8296895588 Improve error situation reporting in makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 287
diff changeset
167 var elname = fprefix + id + fsuffix;
fd8296895588 Improve error situation reporting in makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 287
diff changeset
168 var elem = document.getElementById(elname);
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 if (!elem)
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 {
348
e48abbbbb3b2 Oops, some messageBox() -> jsMessageBox() renames were missing.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
171 jsMessageBox("No such DOM element '"+ elname +"'.");
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 return "";
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 switch (fields[id])
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 {
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 case 1:
286
daa9e22045ad Simplify and remove remnants of the frontend-based input checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
178 var vstr = strtrim(elem.value);
daa9e22045ad Simplify and remove remnants of the frontend-based input checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
179 res.push(id+"="+strencode(vstr));
287
71442d864367 Add variable for retrieving parsed data from latest makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 286
diff changeset
180 lastPostArgs[id] = vstr;
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 break;
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 case 2:
286
daa9e22045ad Simplify and remove remnants of the frontend-based input checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
184 var vint = parseInt(strtrim(elem.value));
daa9e22045ad Simplify and remove remnants of the frontend-based input checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
185 res.push(id+"="+vint);
287
71442d864367 Add variable for retrieving parsed data from latest makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 286
diff changeset
186 lastPostArgs[id] = vint;
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 break;
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 case 3:
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 res.push(id+"="+(elem.checked ? "1" : "0"));
287
71442d864367 Add variable for retrieving parsed data from latest makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 286
diff changeset
191 lastPostArgs[id] = elem.checked;
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 break;
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193
401
b42438e09087 Add new type for select options in jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 399
diff changeset
194 case 4:
403
05debbea33c1 Fix functionality of the option select stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
195 var vval = (elem.selectedValue != -1) ? elem.options[elem.selectedValue].value : -1;
05debbea33c1 Fix functionality of the option select stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
196 res.push(id+"="+vval);
05debbea33c1 Fix functionality of the option select stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
197 lastPostArgs[id] = vval;
401
b42438e09087 Add new type for select options in jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 399
diff changeset
198 break;
b42438e09087 Add new type for select options in jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 399
diff changeset
199
286
daa9e22045ad Simplify and remove remnants of the frontend-based input checking.
Matti Hamalainen <ccr@tnsp.org>
parents: 218
diff changeset
200 default:
348
e48abbbbb3b2 Oops, some messageBox() -> jsMessageBox() renames were missing.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
201 jsMessageBox("Unsupported field type in "+ elname);
317
cacd5ceed4ab Return empty string in case of unsupported type in makePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents: 300
diff changeset
202 return "";
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 }
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 return res.join("&");
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 }
402
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
207
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
208
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
209 function jsGetValue(elname, eltype)
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
210 {
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
211 var elem = document.getElementById(elname);
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
212 if (!elem)
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
213 {
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
214 jsMessageBox("No such DOM element '"+ elname +"'.");
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
215 return "";
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
216 }
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
217
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
218 switch (eltype)
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
219 {
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
220 case 1:
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
221 var vstr = strtrim(elem.value);
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
222 return strencode(vstr);
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
223
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
224 case 2:
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
225 var vint = parseInt(strtrim(elem.value));
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
226 return vint;
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
227
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
228 case 3:
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
229 return elem.checked ? "1" : "0";
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
230
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
231 case 4:
403
05debbea33c1 Fix functionality of the option select stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
232 if (elem.selectedIndex != -1)
05debbea33c1 Fix functionality of the option select stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
233 return elem.options[elem.selectedIndex].value;
05debbea33c1 Fix functionality of the option select stuff.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
234 else
460
7d732915dce9 Return null instead of -1.
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
235 return null;
402
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
236
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
237 default:
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
238 jsMessageBox("Unsupported field type in "+ elname);
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
239 return "";
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
240 }
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
241 }
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
242
445
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
243 <? if ($tabs) { ?>
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
244
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
245 //
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
246 // Tab related code
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
247 //
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
248 var registeredTabs = Object();
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
249 var activeTabs = Object();
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
250
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
251
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
252 function jsUpdateTabList(tabset, extra)
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
253 {
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
254 var tabs = "";
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
255 var content = "";
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
256
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
257 for (var id in registeredTabs[tabset])
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
258 {
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
259 var thead = registeredTabs[tabset][id];
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
260 tabs += "<a id=\"tabHead"+ tabset + id +
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
261 "\"href=\"#\" onClick=\"jsSwitchActiveTab('"+tabset+"', '"+id+
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
262 "')\">"+ thead.replace(/\s/g, "&nbsp;") +"</a> ";
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
263
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
264 content += "<div id=\"tabCont"+ tabset + id +"\"></div>";
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
265 }
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
266
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
267 var item = document.getElementById("tabHeaders"+ tabset);
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
268 if (item) item.innerHTML = tabs + extra;
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
269
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
270 item = document.getElementById("tabContents"+ tabset);
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
271 if (item) item.innerHTML = content;
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
272 }
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
273
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
274
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
275 function jsRegisterTab(tabset, id, name)
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
276 {
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
277 if (!registeredTabs[tabset])
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
278 registeredTabs[tabset] = Object();
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
279
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
280 registeredTabs[tabset][id] = name;
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
281 }
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
282
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
283
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
284 function jsSwitchActiveTab(tabset, tab)
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
285 {
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
286 for (var id in registeredTabs[tabset])
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
287 {
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
288 var tabContent = document.getElementById("tabCont"+ tabset + id);
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
289 var tabHead = document.getElementById("tabHead"+ tabset + id);
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
290 if (tabContent && tabHead)
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
291 {
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
292 tabContent.style.display = (tab == id) ? "block" : "none";
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
293 tabHead.style.borderTop = (tab == id) ? "4px solid white" : "none";
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
294 if (tab == id)
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
295 {
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
296 activeTabs[tabset] = id;
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
297 setTimeout("refreshDispatch"+ tabset +"('"+ id +"');", 10);
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
298 }
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
299 }
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
300 }
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
301 }
402
82e40d45f4dd Add new utility function jsGetValue().
Matti Hamalainen <ccr@tnsp.org>
parents: 401
diff changeset
302
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
303 <?
445
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
304 } // if (tabs)
cf7053f04e88 Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
305
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
306 if ($script)
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
307 echo "</script>\n";
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
308 }
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
309 ?>