annotate admajax.js.php @ 1071:76e11ae923a7

Use long tags.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 24 Jan 2017 17:44:50 +0200
parents e23057465ca2
children 08900352f420
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1069
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?php
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // FAPWeb - Simple Web-based Demoparty Management System
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 // Party administration page AJAX javascript module
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 // (C) Copyright 2012-2017 Tecnic Software productions (TNSP)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 $sessionType = "admin";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 header("Content-Type: application/javascript");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 require_once "mconfig.inc.php";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 require_once "msite.inc.php";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 require_once "msession.inc.php";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
1071
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
13
1069
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 // Initiate SQL database connection
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 if (!stConnectSQLDB())
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 // Error occured, bail out early
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 cmPrintPageFooter();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 exit;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 // Fetch non-"hardcoded" settings from SQL database
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 stReloadSettings();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 // Check if sessions are enabled
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 if (!stChkSetting("admPassword") || !stAdmSessionAuth(FALSE))
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 exit;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
1071
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
29
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1070
diff changeset
30 // Output JavaScript settings
1069
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 echo
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 "\n".
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 "var jsSettingsArgs = [];\n";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 foreach (stExecSQL("SELECT * FROM settings_groups") as $group)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 $args = array();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 if (($res = stExecSQL("SELECT * FROM settings WHERE vgroup=".$group["id"])) !== false)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 foreach ($res as $item)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 switch ($item["vtype"])
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 case VT_STR:
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 case VT_TEXT: $type = 1; break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 case VT_INT: $type = 2; break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 case VT_BOOL: $type = 3; break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 $args[] = "\"".$item["key"]."\":".$type;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 echo "jsSettingsArgs[".$group["id"]."] = {".implode(",", $args)."};\n";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 echo
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 "\n".
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 "function jsUpdateSettings(id)\n".
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 "{\n".
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 " if (id in jsSettingsArgs)\n".
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 " jsSendPOSTRequest(\"action=update&type=settings&id=\"+id+\"&\"+jsMakePostArgs(jsSettingsArgs[id], \"st\", \"\"));\n".
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 " return false;\n".
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 "}\n".
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 "\n";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 stCommonAJAX("admajax.php", "admlogout.php");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 ?>
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 var activeAttendee = -1, prevAttendee = -1, activeAttendeeTmp = "";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 var activeEntry = -1, prevEntry = -1, activeEntryTmp = "";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 var registeredTabs = Object();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 var activeTabs = Object();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 // Tab related code
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 function jsUpdateTabList(tabset, extra)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 var tabs = "";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 var content = "";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 // Update the tab header list for this tabset
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 for (var id in registeredTabs[tabset])
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 var thead = registeredTabs[tabset][id];
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 tabs += "<a id=\"tabHead"+ tabset + id +
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 "\" href=\"#\" onClick=\"jsSwitchActiveTab('"+tabset+"', '"+id+
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 "')\">"+ thead +"</a> ";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 content += "<div id=\"tabCont"+ tabset + id +"\"></div>";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 // Update the DOM elements
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 var item = document.getElementById("tabHeaders"+ tabset);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 if (item) item.innerHTML = tabs + extra;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 item = document.getElementById("tabContents"+ tabset);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 if (item) item.innerHTML = content;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 function jsRegisterTab(tabset, id, name)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 // Create tabset object "array" if it does not exist
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 if (!registeredTabs[tabset])
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 registeredTabs[tabset] = Object();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 // Register tab
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 registeredTabs[tabset][id] = name;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 function jsSwitchActiveTab(tabset, tab)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 // Go through all registered tabs to update their state
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 for (var id in registeredTabs[tabset])
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 var tabContent = document.getElementById("tabCont"+ tabset + id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 var tabHead = document.getElementById("tabHead"+ tabset + id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 if (tabContent && tabHead)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 tabContent.style.display = (tab == id) ? "block" : "none";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 tabHead.className = (tab == id) ? "active" : "inactive";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 if (tab == id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 // Set active tab and refresh contents
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 activeTabs[tabset] = id;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 setTimeout(function(qtabset, qid) {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 switch (qtabset)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 case "CM": refreshDispatchCM(qid); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 case "CC": refreshDispatchCC(qid); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 case "CS": refreshDispatchCS(qid); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 default: jsMessageBox("Invalid tabset value: '"+ qtabset +"'.");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 }, 10, tabset, id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 jsCancelUploadCBS();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 // Clear inactive tabs
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 tabContent.innerHTML = "";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 // Admin interface specific popups
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 function jsHandleAdminPopupKeys(ev)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 ev = ev || window.event;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 var key = ev.keyCode ? ev.keyCode : ev.which;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 if (key == 27)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 jsCloseAdminPopup();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 return false;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 return true;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 function jsCloseAdminPopup()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 var nitem = document.getElementById("adminPopup");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 document.onkeydown = null;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 nitem.innerHTML = "";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 nitem.style.display = "none";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 function jsOpenAdminPopup(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 var nitem = document.getElementById("adminPopup");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 document.onkeydown = jsHandleAdminPopupKeys;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 nitem.innerHTML = txt;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 nitem.style.display = "block";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 // Generic element refresh
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 function jsRefreshItems(id,name,extra)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 var nitem = document.getElementById(id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 if (nitem) nitem.innerHTML = txt;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 jsSendPOSTRequest("action=get&type="+name+extra, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 function jsDeleteItem(id,prefix,type,func,dsc,dsc2)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 var item = document.getElementById(prefix+id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 item.style.display = "none";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 setTimeout(func, 50);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 // Clearly mark the element when asking confirmation
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 var item = document.getElementById(prefix+id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 var tmp = item.className;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 item.className += " deleteWarning";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 // Ask confirmation for deletion
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 var mcb_ok = function (data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 jsSendPOSTRequest("action=delete&type="+type+"&id="+id, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 item.className = tmp;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 var mcb_cancel = function (data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 item.className = tmp;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 if (dsc)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 jsConfirmBox("Are you sure you want to delete "+dsc+" #"+id+"?", mcb_ok, mcb_cancel, 0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 jsConfirmBox(dsc2, mcb_ok, mcb_cancel, 0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 function jsRefreshPanels(id, tab, args, set_default)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246 var nitem = document.getElementById(tab);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 if (nitem.innerHTML == "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 nitem.innerHTML =
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 "<div id=\"tabHeaders"+id+"\" class=\"tabHeadersSub\"></div>" +
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 "<div id=\"tabContents"+id+"\" class=\"tabContentsSub\"></div>";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 try {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 var tmp = JSON.parse("{"+ txt +"}");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 registeredTabs[id] = tmp;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 jsUpdateTabList(id, "");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260 if (activeTabs[id])
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 jsSwitchActiveTab(id, activeTabs[id]);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 if (set_default == "*")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 for (var nid in registeredTabs[id])
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 jsSwitchActiveTab(id, nid);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 if (set_default != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 jsSwitchActiveTab(id, set_default);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 catch (err) {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 jsErrorMessageBox("JSON.parse("+ txt +") failure: "+ err);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 jsSendPOSTRequest("action=get&type="+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 function refreshDispatchCC(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 switch (id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 case "News" : jsRefreshItems("tabContCCNews", "news", ""); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 case "Attendees" : jsRefreshItems("tabContCCAttendees", "attendees", ""); activeAttendee = -1; break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 case "Voting" : jsRefreshItems("tabContCCVoting", "voters", ""); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 case "Compos" : jsRefreshItems("tabContCCCompos", "compos", ""); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 case "InfoSys" : jsRefreshItems("tabContCCInfoSys", "infoMain", ""); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 case "Settings" : jsRefreshPanels("CS", "tabContCCSettings", "settingslist", "*"); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 case "Entries" : jsRefreshPanels("CM", "tabContCCEntries", "compolist", ""); break;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 default : alert("Invalid id: '"+ id +"'.'");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 function refreshDispatchCS(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 jsRefreshItems("tabContCS"+ id, "settings", "&id="+ id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 function refreshDispatchCM(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 prevEntry = activeEntry = -1;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 jsRefreshItems("tabContCM"+ id, "entries", "&id="+ id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315 // Site news management
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 function addNews()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 var args = jsMakePostArgs({"title":1,"text":1,"author":1}, "nn", "");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 setTimeout(function () { refreshDispatchCC("News"); }, 50);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
324 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
326 if (args != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327 jsSendPOSTRequest("action=add&type=news&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
329 return false;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 function deleteNews(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335 jsDeleteItem(id, "news", "news", function() { refreshDispatchCC("News"); }, "news item");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 function updateNews(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341 var args = jsMakePostArgs({"title":1,"text":1,"author":1}, "ne", id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
342
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 jsRefreshItems("news"+id, "newsitem", "&id="+id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 if (args != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 jsSendPOSTRequest("action=update&type=news&id="+id+"&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
352
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
353 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
354 // Visitor/attendee management
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
356 function addAttendee()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "ne", "x");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
359
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362 setTimeout(function() { refreshDispatchCC("Attendees"); }, 50);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
364
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 if (args != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366 jsSendPOSTRequest("action=add&type=attendees&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368 return false;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 function deleteAttendee(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
374 jsDeleteItem(id, "attendee", "attendees", function () { refreshDispatchCC("Attendees"); }, "attendee");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
378 function updateAttendee(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1,"reghost":1}, "at", id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
384 activateAttendee(-1);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
385 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 if (args != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 jsSendPOSTRequest("action=update&type=attendees&id="+id+"&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
390
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392 function activateAttendee(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394 var msuccess1 = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
395 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396 var nitem = document.getElementById("attendee"+prevAttendee);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 nitem.innerHTML = txt;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400 nitem.className = activeAttendeeTmp;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
401 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
402 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
403
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
404 var msuccess2 = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
406 var nitem = document.getElementById("attendee"+activeAttendee);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
407 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
408 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 nitem.innerHTML = txt;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410 activeAttendeeTmp = nitem.className;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 nitem.className += " active";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412 activeAttendee = id;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
415
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416 if (activeAttendee != id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
418 prevAttendee = activeAttendee;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419 activeAttendee = id;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
420
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421 if (prevAttendee != -1)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422 jsSendPOSTRequest("action=get&type=attendee&id="+prevAttendee+"&edit=0", msuccess1);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
423
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
424 if (activeAttendee != -1)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
425 jsSendPOSTRequest("action=get&type=attendee&id="+activeAttendee+"&edit=1", msuccess2);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
427 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
431 // Compo management
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
432 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433 function addCompo()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
435 var args = jsMakePostArgs({"name":1, "description":1}, "nc", "");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
436
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
438 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439 setTimeout(function () { refreshDispatchCC("Compos"); }, 50);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442 if (args != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443 jsSendPOSTRequest("action=add&type=compo&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
444 return false;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 function updateCompoType(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
451 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
452 jsRefreshItems("compo"+id, "compo", "&id="+id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
453 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
455 jsSendPOSTRequest("action=update&type=compotype&id="+id+"&ctype="+jsGetValue("cotype"+id+"Sel", 4), msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
456 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
457
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
458
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
459 function updateCompoVoting(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
460 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
461 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
462 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
463 jsRefreshItems("covoting"+id, "compovoting", "&id="+id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
464 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
466 jsSendPOSTRequest("action=update&type=compovoting&id="+id+"&voting="+jsGetValue("covotingbutton"+id, 3), msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
467 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
468
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470 function updateCompo(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
471 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
472 var args = jsMakePostArgs({"name":1, "description":1, "notes":1, "visible":3, "voting":3, "show_authors":3, "cpath":1, "preview_type":4}, "co", id, true);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
473
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
474 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
475 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
476 jsRefreshItems("compo"+id, "compo", "&id="+id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
478
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
479 if (args != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
480 jsSendPOSTRequest("action=update&type=compo&id="+id+"&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
481 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
482
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
483
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
484 function deleteCompo(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
485 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
486 jsDeleteItem(id, "compo", "compo", function () { refreshDispatchCC("Compos"); }, 0,
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
487 "Are you ABSOLUTELY sure you want to delete compo #"+id+"? "+
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
488 "This will delete all votes AND entries related to it!");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
489 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
490
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
491
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 // Entry management
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
494 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495 function refreshEntryCompos()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
497 setTimeout(function () { refreshDispatchCC("Entries"); }, 50);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
498 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
499
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
500
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
501 function activateEntry(id, force)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
502 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
503 var msuccess1 = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
504 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
505 var nitem = document.getElementById("entry"+prevEntry);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
506 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
507 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
508 nitem.innerHTML = txt;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
509 nitem.className = activeEntryTmp;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
510 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
511 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
512
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
513 var msuccess2 = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
515 var nitem = document.getElementById("entry"+activeEntry);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
516 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
518 nitem.innerHTML = txt;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
519 activeEntryTmp = nitem.className;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
520 nitem.className += " active";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521 activeEntry = id;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
522 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
524
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
525 if (activeEntry != id || force)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
526 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527 jsCancelUploadCBS();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
528
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529 prevEntry = activeEntry;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 activeEntry = id;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
531
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532 if (prevEntry != -1)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533 jsSendPOSTRequest("action=get&type=entry&id="+prevEntry+"&edit=0", msuccess1);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
535 if (activeEntry != -1)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
536 jsSendPOSTRequest("action=get&type=entry&id="+activeEntry+"&edit=1", msuccess2);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
537 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
538 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
539
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
540
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541 function addEntry(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
542 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "evalue":2}, "ne", id, true);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545 jsCancelUploadCBS();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
548 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
549 setTimeout(function (q) { refreshDispatchCM(qid); }, 50, id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
550 refreshEntryCompos();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
551 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
552
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
553 if (args != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
554 jsSendPOSTRequest("action=add&type=entry&compo_id="+id+"&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
555
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
556 return false;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
557 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
558
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
559
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560 function updateEntry(cid, id, edit)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
561 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "compo_id":4, "evalue":2, "preview_type":4}, "en", id, true);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
563 var has_id = "compo_id" in lastPostArgs;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
564 var compo_id = lastPostArgs["compo_id"];
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
565
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
566 jsCancelUploadCBS();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
568 if (!("compo_id" in lastPostArgs))
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
569 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
570 args += "&compo_id=" + cid;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
571 compo_id = cid;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
572 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
573
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
574 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
575 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
576 if (cid != compo_id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
577 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
578 var nitem = document.getElementById("entry"+ id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
579 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
580 nitem.style.display = "none";
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
581 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
582 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
583 activateEntry(edit ? id : -1, true);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
584 refreshEntryCompos();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
585 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
586
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
587 var mcb_ok = function(data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
588 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589 jsSendPOSTRequest("action=update&type=entry&id="+id+"&edit="+edit+"&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590 refreshEntryCompos();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
592
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 var mcb_cancel = function(data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595 activeEntry = -1;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
596 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
597
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
598 if (args != "")
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
599 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600 if (cid != compo_id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
601 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
602 jsConfirmBox("Are you sure you want to change entry #"+id+
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
603 "'s compo from "+cid+" to "+compo_id+"?", mcb_ok, mcb_cancel);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
604 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606 mcb_ok();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
607 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
609
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
610
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
611 function deleteEntry(cid, id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
612 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
613 jsCancelUploadCBS();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614 jsDeleteItem(id, "entry", "entries", function() { refreshDispatchCM(cid); refreshEntryCompos(); }, "entry");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
615 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
616
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 // Votekey management
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621 function voteKeyInfoRefresh()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
623 jsRefreshItems("vkeyInfo", "votekey", "info");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
627 function voteKeyRefresh(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
628 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
629 var msuccess2 = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
630 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
631 var nitem = document.getElementById("vkey"+id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
632 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
633 nitem.className = txt;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
634 voteKeyInfoRefresh();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
635 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
636
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
637 var msuccess1 = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
638 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
639 var nitem = document.getElementById("vkey"+id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
640 if (nitem)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
641 nitem.innerHTML = txt;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
642 voteKeyInfoRefresh();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
643 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
644
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
645 jsSendPOSTRequest("action=get&type=votekey&id="+id, msuccess1);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 jsSendPOSTRequest("action=get&type=votekeyclass&id="+id, msuccess2);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
649
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
650 function voteKeyUpdate(id, type, args)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
651 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
654 voteKeyRefresh(id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 voteKeyInfoRefresh();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
656 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
657
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
658 jsSendPOSTRequest("action=votekey&type="+type+"&id="+id+"&"+args, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
659 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
660
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
661
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
662 function voteKeySetActive(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
664 var args = jsMakePostArgs({"active":3}, "vk", id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
665
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
666 var mcb_ok = function (data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
667 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
668 voteKeyUpdate(id, "active", args);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
669 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
670
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
671 var mcb_cancel = function (data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
672 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
673 voteKeyRefresh(id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
674 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
676 if (lastPostArgs["active"] == 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677 jsConfirmBox("Are you sure you want to deactivate vote key #"+id+"?", mcb_ok, mcb_cancel, 0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
678 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
679 mcb_ok(0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
680 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
681
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
682
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
683 function voteKeyAssign(id, mode)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
684 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
685 var args = jsMakePostArgs({"key_id":2}, "vk", id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
686
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
687 var mcb_ok = function (data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
688 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
689 voteKeyUpdate(id, (mode ? "assign" : "clear"), args);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
690 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
691
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
692 if (mode == 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
693 jsConfirmBox("Are you sure you want to clear vote key assign #"+id+"?", mcb_ok, 0, 0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
694 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
695 mcb_ok(0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
696 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
697
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
698
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
699 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
700 // Misc functions
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
701 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
702 function showScreenCmd(str)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
703 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
704 jsSendPOSTRequest("action=screencmd&cmd="+str);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
705 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
706
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
707
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
708 function performSystemCheck()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
709 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
710 jsSendPOSTRequest("action=check", jsMessageBox);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
711 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
712
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
713
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
714 function generateEntryPositions(id, patch)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
715 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
716 var msuccess = function (data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
717 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
718 refreshDispatchCM(id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
719 refreshCurrEntryData();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
720 refreshCurrEntryListData();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
721 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
722
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
723 var mcb_ok = function (data)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
724 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
725 if (id == 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
726 jsSendPOSTRequest("action=randomize&type=all&patch="+patch, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
727 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
728 jsSendPOSTRequest("action=randomize&type=compo&id="+id+"&patch="+patch, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
729 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
730
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
731 if (patch == 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
732 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
733 jsConfirmBox("Are you <b>ABSOLUTELY CERTAIN</b> you want to delete and regenerate entry show positions "+
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
734 (id == 0 ? "for ALL compos" : "for this compo") +"? "+
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
735 "<b>This will completely annihilate current show position numbers! AND FUCK UP YOUR EXPORTED FILE ORDER (ask ccr to know what that means.)</b>", mcb_ok, 0, 0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
736 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
737 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
738 mcb_ok(0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
739 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
740
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
741
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
742 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
743 // Competition control
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
744 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
745 function setShowMode(mode)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
746 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
747 jsSendPOSTRequest("action=ctrl&type=setShowMode&mode="+mode);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
748 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
749
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
750
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
751 function refreshCurrEntryData()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
752 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
753 jsRefreshItems("ctrlCurrCompoData", "infoCurrCompoData", "");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
754 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
755
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
756
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
757 function refreshCurrEntryListData()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
758 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
759 jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
760 refreshCurrEntryData();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
761 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
762
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
763
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
764 function activateCompo()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
765 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
766 jsSendPOSTRequest("action=ctrl&type=setCompoID&id="+jsGetValue("ctrlCompoListSel", 4), refreshCurrEntryListData);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
767 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
768
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
769
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
770 function setSelectedEntry()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
771 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
772 jsSendPOSTRequest("action=ctrl&type=setEntry&index="+jsGetValue("ctrlEntryListSel", 4), refreshCurrEntryData);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
773 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
774
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
775
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
776 function switchEntry(dir)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
777 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
778 jsSendPOSTRequest("action=ctrl&type="+ (dir < 0 ? "prevEntry" : "nextEntry"), refreshCurrEntryListData);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
779 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
780
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
781
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
782 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
783 // Rotation list editing and handling
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
784 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
785 function refreshRotationListSel()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
786 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
787 jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", "");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
788 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
789
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
790
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
791 function refreshRotationListEdit(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
792 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
793 jsRefreshItems("ctrlRotationListEdit", "infoRotationListEdit", "&id="+id+"&full=0");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
794 refreshRotationListSel();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
795 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
796
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
797
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
798 function refreshActiveRotationList()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
799 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
800 jsRefreshItems("ctrlActiveRotationList", "infoActiveRotationList", "");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
801 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
802
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
803
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
804 function setRotateDuration()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
805 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
806 var duration = jsGetValue("ctrlRotSlideDuration", 2);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
807 jsSendPOSTRequest("action=ctrl&type=setRotateDuration&duration="+duration);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
808 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
809
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
810
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
811 function setActiveRotationList()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
812 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
813 var id = jsGetValue("ctrlRotationListsSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
814 if (id > 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
815 jsSendPOSTRequest("action=ctrl&type=setActiveRotationList&id="+id, refreshActiveRotationList);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
816 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
817 jsErrorMessageBox("No rotation list selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
818 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
819
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
820
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
821 function updateRotationList(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
822 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
823 var name = jsGetValue("ctrlEDRotationListName", 1);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
824 jsSendPOSTRequest("action=ctrl&type=updateRotationList&id="+id+"&name="+name, refreshRotationListSel);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
825 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
826
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
827
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
828 function moveRotationListSlide(list_id, dir)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
829 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
830 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
831 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
832 refreshRotationListEdit(list_id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
833 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
834
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
835 var slide = jsGetValue("ctrlEDRotationListSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
836 if (slide)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
837 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
838 var str = slide.split("_");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
839 jsSendPOSTRequest("action=ctrl&type=moveRotationListSlide&list_id="+list_id+
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
840 "&slide_id="+parseInt(str[0])+"&order_num="+parseInt(str[1])+"&dir="+dir, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
841 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
842 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
843 jsErrorMessageBox("No slide selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
844 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
845
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
846
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
847 function addRotationListSlide(list_id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
848 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
849 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
850 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
851 refreshRotationListEdit(list_id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
852 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
853
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
854 var slide_id = jsGetValue("ctrlEDDisplaySlidesSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
855 if (slide_id > 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
856 jsSendPOSTRequest("action=ctrl&type=addRotationListSlide&list_id="+list_id+"&slide_id="+slide_id, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
857 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
858 jsErrorMessageBox("No slide selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
859 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
860
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
861
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
862 function removeRotationListSlide(list_id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
863 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
864 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
865 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
866 refreshRotationListEdit(list_id);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
867 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
868
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
869 var slide = jsGetValue("ctrlEDRotationListSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
870 if (slide)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
871 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
872 var str = slide.split("_");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
873 jsSendPOSTRequest("action=ctrl&type=removeRotationListSlide&list_id="+list_id+
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
874 "&slide_id="+parseInt(str[0])+"&order_num="+parseInt(str[1]), msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
875 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
876 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
877 jsErrorMessageBox("No slide selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
878 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
879
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
880
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
881 function editRotationList()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
882 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
883 var id = jsGetValue("ctrlRotationListsSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
884 if (id > 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
885 jsSendPOSTRequest("action=get&type=infoRotationListEdit&id="+id, jsOpenAdminPopup);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
886 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
887 jsErrorMessageBox("No rotation list selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
888 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
889
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
890
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
891 function newRotationList()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
892 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
893 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
894 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
895 refreshRotationListSel();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
896 jsOpenAdminPopup(txt);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
897 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
898
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
899 jsSendPOSTRequest("action=ctrl&type=newRotationList", msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
900 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
901
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
902
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
903 function deleteRotationList()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
904 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
905 var mcb_ok = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
906 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
907 jsSendPOSTRequest("action=ctrl&type=deleteRotationList&id="+id, refreshRotationListSel);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
908 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
909
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
910 var id = jsGetValue("ctrlRotationListsSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
911 if (id > 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
912 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
913 jsConfirmBox("Are you <b>sure</b> you want to delete rotation list #"+id+"?",
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
914 mcb_ok, 0, 0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
915 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
916 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
917 jsErrorMessageBox("No rotation list selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
918 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
919
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
920
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
921 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
922 // Display slide editing and handling
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
923 //
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
924 function refreshDisplaySlideListSel()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
925 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
926 jsRefreshItems("ctrlDisplaySlidesSel", "infoDisplaySlides", "");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
927 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
928
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
929
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
930 function updateDisplaySlide(id)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
931 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
932 var vtitle = jsGetValue("ctrlDisplaySlideTitle", 1);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
933 var vtext = jsGetValue("ctrlDisplaySlideText", 1);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
934 jsSendPOSTRequest("action=ctrl&type=updateDisplaySlide&id="+id+"&title="+vtitle+"&text="+vtext, refreshDisplaySlideListSel);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
935 jsCloseAdminPopup();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
936 return false;
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
937 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
938
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
939
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
940 function editDisplaySlide()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
941 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
942 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
943 if (id > 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
944 jsSendPOSTRequest("action=get&type=infoDisplaySlideEdit&id="+id, jsOpenAdminPopup);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
945 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
946 jsErrorMessageBox("No display slide selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
947 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
948
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
949
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
950 function copyDisplaySlide()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
951 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
952 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
953 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
954 refreshDisplaySlideListSel();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
955 jsOpenAdminPopup(txt);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
956 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
957
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
958 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
959 if (id > 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
960 jsSendPOSTRequest("action=ctrl&type=copyDisplaySlide&id="+id, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
961 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
962 jsErrorMessageBox("No display slide selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
963 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
964
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
965
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
966 function newDisplaySlide()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
967 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
968 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
969 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
970 refreshDisplaySlideListSel();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
971 jsOpenAdminPopup(txt);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
972 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
973
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
974 jsSendPOSTRequest("action=ctrl&type=newDisplaySlide", msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
975 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
976
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
977
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
978 function deleteDisplaySlide()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
979 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
980 var msuccess = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
981 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
982 refreshDisplaySlideListSel();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
983 refreshRotationListSel();
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
984 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
985
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
986 var mcb_ok = function(txt)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
987 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
988 jsSendPOSTRequest("action=ctrl&type=deleteDisplaySlide&id="+id, msuccess);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
989 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
990
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
991 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
992 if (id > 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
993 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
994 jsConfirmBox("Are you <b>sure</b> you want to delete slide list #"+id+"?",
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
995 mcb_ok, 0, 0);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
996 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
997 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
998 jsErrorMessageBox("No display slide selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
999 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1000
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1001
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1002 function activateTempSlide()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1003 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1004 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1005 var duration = jsGetValue("ctrlTempSlideDuration", 2);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1006 if (id > 0)
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1007 jsSendPOSTRequest("action=ctrl&type=setTempSlide&id="+id+"&duration="+duration, jsMessageBox);
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1008 else
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1009 jsErrorMessageBox("No slide selected?");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1010 }
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1011
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1012
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1013 function skipToNextSlide()
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1014 {
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1015 jsSendPOSTRequest("action=ctrl&type=skipToNextSlide");
5f92fa5e683a Refactor how the "AJAX" stuff works.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1016 }
1070
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1017
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1018
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1019 document.addEventListener("DOMContentLoaded",
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1020 function ()
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1021 {
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1022 jsRegisterTab("CC", "Settings", "Settings");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1023 jsRegisterTab("CC", "News", "News");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1024 jsRegisterTab("CC", "Attendees", "Attendees");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1025 jsRegisterTab("CC", "Voting", "Voting");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1026 jsRegisterTab("CC", "Compos", "Compos");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1027 jsRegisterTab("CC", "Entries", "Entries");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1028 jsRegisterTab("CC", "InfoSys", "Infosystem");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1029 jsUpdateTabList("CC",
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1030 "<a class=\"admin\" href=\"admlogout.php\">Logout</a> " +
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1031 "<a class=\"admin\" href=\"about\">Mainpage</a>");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1032 jsSwitchActiveTab("CC", "Settings");
e23057465ca2 Some more AJAX fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1069
diff changeset
1033 });