Mercurial > hg > fapweb
annotate admin.php @ 511:6fe66ea0e954
Move most of the results code to site module, remove the support for HTML
type output.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 08 Dec 2013 02:16:26 +0200 |
parents | 7061683be67e |
children | 8c1a53532be0 |
rev | line source |
---|---|
0 | 1 <? |
136
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
2 // |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
3 // FAPWeb Simple Demoparty System |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
4 // Party administration page frontend module |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
5 // (C) Copyright 2012-2013 Tecnic Software productions (TNSP) |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
6 // |
32 | 7 $sessionType = "admin"; |
175
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
8 require_once "mconfig.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
9 require_once "msite.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
174
diff
changeset
|
10 require_once "msession.inc.php"; |
384
357b81e39ab3
Rename majax.php -> majax.inc.php.
Matti Hamalainen <ccr@tnsp.org>
parents:
378
diff
changeset
|
11 require_once "majax.inc.php"; |
32 | 12 |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
13 function stCreateSettingsData() |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
14 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
15 $args = array(); |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
16 |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
17 if (($res = stExecSQL("SELECT * FROM settings")) !== FALSE) |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
18 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
19 foreach ($res as $item) |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
20 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
21 switch ($item["vtype"]) |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
22 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
23 case VT_STR: |
298
2f35c4b90ee7
Fix site settings javascript generator.
Matti Hamalainen <ccr@tnsp.org>
parents:
289
diff
changeset
|
24 case VT_TEXT: $type = 1; break; |
2f35c4b90ee7
Fix site settings javascript generator.
Matti Hamalainen <ccr@tnsp.org>
parents:
289
diff
changeset
|
25 case VT_INT: $type = 2; break; |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
26 case VT_BOOL: $type = 3; break; |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
27 } |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
28 $args[] = "\"".$item["key"]."\":".$type; |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
29 } |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
30 } |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
31 |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
32 echo |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
33 "\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
34 "function updateSettings()\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
35 "{\n". |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
36 " var args = jsMakePostArgs({".implode(",", $args)."}, \"st\", \"\");\n". |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
37 " jsSendPOSTRequest(\"action=update&type=settings&\"+args);\n". |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
38 " return false;\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
39 "}\n"; |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
40 } |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
41 |
347 | 42 function stAdminContent() |
43 { | |
44 echo "<div id=\"adminContent\">\n"; | |
45 } | |
46 | |
47 // Switch to https first, if needed | |
48 if (!stCheckHTTPS()) | |
49 { | |
50 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); | |
51 exit; | |
52 } | |
53 | |
54 // Start output | |
55 $pageCSS["admin.css"] = ""; | |
56 cmLocaleInit(); | |
57 cmPrintPageHeader("FAPWeb Administration", | |
364 | 58 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />\n", |
347 | 59 FALSE); |
60 | |
61 | |
62 // Initiate SQL database connection | |
63 if (!stConnectSQLDB()) | |
64 { | |
65 // Error occured, bail out early | |
66 cmPrintPageFooter(); | |
67 exit; | |
68 } | |
69 | |
70 // Fetch non-"hardcoded" settings from SQL database | |
71 stReloadSettings(); | |
72 | |
0 | 73 // Check if sessions are enabled |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
74 if (!stChkSetting("admPassword")) |
0 | 75 { |
347 | 76 stAdminContent(); |
171
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
77 echo |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
78 "<h1>Oh noes, admin configuration not done!</h1>\n". |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
79 "<p>Better go and prod that, so you get to use the fine admin interface.</p>\n"; |
347 | 80 cmPrintPageFooter(); |
81 exit; | |
0 | 82 } |
83 else | |
107 | 84 if (!stAdmSessionAuth(FALSE)) |
0 | 85 { |
86 // Perform authentication if we are not in session already | |
347 | 87 stAdminContent(); |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
88 echo |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
89 "<h1>Party admin login</h1>\n". |
0 | 90 "<p>Please use illegal telepathy over HTTP to provide a password to enter the party administration systembolaget.</p>\n". |
347 | 91 " ".stGetFormStart("admlogin", "admlogin.php"). |
92 " ".stGetFormHiddenInput("mode", "check")."\n". | |
93 " ".stGetFormPasswordInput("admpass", "", "", "autofocus=\"autofocus\"")."\n". | |
94 " ".stGetFormSubmitInput("submit", "Login")."\n". | |
95 " </form>\n"; | |
96 cmPrintPageFooter(); | |
97 exit; | |
0 | 98 } |
107 | 99 else |
0 | 100 { |
101 ?> | |
102 <script type="text/javascript"> | |
445
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
103 // <? stCreateSettingsData(); stCommonAJAX("admajax.php", "admlogout.php", FALSE, TRUE); ?> |
124
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
104 |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
105 |
258 | 106 var activeAttendee = -1, prevAttendee = -1; |
107 var activeTmp = ""; | |
108 | |
109 | |
428 | 110 function jsCloseAdminPopup() |
111 { | |
112 var nitem = document.getElementById("adminPopup"); | |
113 if (nitem) | |
114 { | |
115 nitem.innerHTML = ""; | |
116 nitem.style.display = "none"; | |
117 } | |
118 } | |
119 | |
120 | |
121 function jsOpenAdminPopup(txt) | |
122 { | |
123 var nitem = document.getElementById("adminPopup"); | |
124 if (nitem) | |
125 { | |
126 nitem.innerHTML = txt; | |
127 nitem.style.display = "block"; | |
128 } | |
129 } | |
130 | |
131 | |
400 | 132 function jsRefreshItems(id,name,extra) |
124
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
133 { |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
134 var msuccess = function(txt) |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
135 { |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
136 var nitem = document.getElementById(id); |
201
a4be19c4d99d
Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
137 if (nitem) nitem.innerHTML = txt; |
124
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
138 } |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
139 |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
140 jsSendPOSTRequest("action=get&type="+name+extra, msuccess); |
124
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
141 } |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
142 |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
143 |
400 | 144 function jsDeleteItem(id,prefix,type,func,dsc) |
124
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
145 { |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
146 var msuccess = function(txt) |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
147 { |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
148 var item = document.getElementById(prefix+id); |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
149 item.style.display = "none"; |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
150 setTimeout(func, 50); |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
151 } |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
152 |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
153 // Clearly mark the element when asking confirmation |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
154 var item = document.getElementById(prefix+id); |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
155 var tmp = item.style.background; |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
156 item.style.background = "red"; |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
157 |
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
158 // Ask confirmation for deletion |
349
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
159 var mcb_ok = function (data) |
124
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
160 { |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
161 jsSendPOSTRequest("action=delete&type="+type+"&id="+id, msuccess); |
349
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
162 item.style.background = tmp; |
124
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
163 } |
349
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
164 |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
165 var mcb_cancel = function (data) |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
166 { |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
167 item.style.background = tmp; |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
168 } |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
169 |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
170 jsConfirmBox("Are you sure you want to delete "+dsc+" #"+id+"?", mcb_ok, mcb_cancel, 0); |
124
986c25c2e2bc
Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents:
107
diff
changeset
|
171 } |
0 | 172 |
173 | |
253
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
174 function refreshDispatchCC(id) |
0 | 175 { |
253
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
176 switch (id) |
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
177 { |
400 | 178 case "Settings": jsRefreshItems("tabContCCSettings", "settings", ""); break; |
179 case "News": jsRefreshItems("tabContCCNews", "news", ""); break; | |
180 case "Attendees": jsRefreshItems("tabContCCAttendees", "attendees", ""); break; | |
181 case "Voting": jsRefreshItems("tabContCCVoting", "voters", ""); break; | |
182 case "Compos": jsRefreshItems("tabContCCCompos", "compos", ""); break; | |
419 | 183 case "InfoSys": jsRefreshItems("tabContCCInfoSys", "infoMain", ""); break; |
253
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
184 case "Entries": refreshCCEntries(); break; |
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
185 } |
0 | 186 } |
187 | |
188 | |
255
16d453f1b23d
Simplify refreshing function.
Matti Hamalainen <ccr@tnsp.org>
parents:
254
diff
changeset
|
189 function refreshCCAttendee(id) |
209 | 190 { |
400 | 191 jsRefreshItems("attendee"+ id, "attendee", "&id="+ id); |
209 | 192 } |
193 | |
194 | |
201
a4be19c4d99d
Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
195 function refreshCCEntries() |
0 | 196 { |
254
c26167a096bf
Rename a callback function.
Matti Hamalainen <ccr@tnsp.org>
parents:
253
diff
changeset
|
197 var msuccess = function(txt) |
250
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
198 { |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
199 var nitem = document.getElementById("tabContCCEntries"); |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
200 if (nitem) |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
201 { |
299
617c44197983
Preserve generated content in sub-tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
298
diff
changeset
|
202 if (nitem.innerHTML == "") |
617c44197983
Preserve generated content in sub-tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
298
diff
changeset
|
203 { |
617c44197983
Preserve generated content in sub-tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
298
diff
changeset
|
204 nitem.innerHTML = |
617c44197983
Preserve generated content in sub-tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
298
diff
changeset
|
205 "<div id=\"tabHeadersCM\" class=\"tabHeadersSub\"></div>" + |
617c44197983
Preserve generated content in sub-tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
298
diff
changeset
|
206 "<div id=\"tabContentsCM\" class=\"tabContentsSub\"></div>"; |
617c44197983
Preserve generated content in sub-tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
298
diff
changeset
|
207 } |
617c44197983
Preserve generated content in sub-tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
298
diff
changeset
|
208 |
250
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
209 try { |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
210 var tmp = JSON.parse("{"+ txt +"}"); |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
211 registeredTabs["CM"] = tmp; |
445
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
212 jsUpdateTabList("CM", ""); |
260
6a1f1f2f2141
Make tab selection in subtabs persistent.
Matti Hamalainen <ccr@tnsp.org>
parents:
259
diff
changeset
|
213 if (activeTabs["CM"]) |
445
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
214 jsSwitchActiveTab("CM", activeTabs["CM"]); |
250
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
215 } |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
216 catch (err) { |
343
e799da13c0f3
Rename messageBox() to jsMessageBox().
Matti Hamalainen <ccr@tnsp.org>
parents:
342
diff
changeset
|
217 jsMessageBox("JSON.parse("+ txt +") failure: "+ err); |
250
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
218 } |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
219 } |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
220 } |
34f540cea1ff
Some work on compo entry listing.
Matti Hamalainen <ccr@tnsp.org>
parents:
247
diff
changeset
|
221 |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
222 jsSendPOSTRequest("action=get&type=compolist", msuccess); |
0 | 223 } |
224 | |
225 | |
256
ed8d8d016420
Add refreshCMEntry(id) function for updating one entry only.
Matti Hamalainen <ccr@tnsp.org>
parents:
255
diff
changeset
|
226 function refreshCMEntry(id) |
ed8d8d016420
Add refreshCMEntry(id) function for updating one entry only.
Matti Hamalainen <ccr@tnsp.org>
parents:
255
diff
changeset
|
227 { |
400 | 228 jsRefreshItems("entry"+ id, "entry", "&id="+ id); |
256
ed8d8d016420
Add refreshCMEntry(id) function for updating one entry only.
Matti Hamalainen <ccr@tnsp.org>
parents:
255
diff
changeset
|
229 } |
ed8d8d016420
Add refreshCMEntry(id) function for updating one entry only.
Matti Hamalainen <ccr@tnsp.org>
parents:
255
diff
changeset
|
230 |
ed8d8d016420
Add refreshCMEntry(id) function for updating one entry only.
Matti Hamalainen <ccr@tnsp.org>
parents:
255
diff
changeset
|
231 |
253
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
232 function refreshDispatchCM(id) |
0 | 233 { |
400 | 234 jsRefreshItems("tabContCM"+ id, "entries", "&id="+ id); |
0 | 235 } |
236 | |
237 | |
238 function addNews() | |
239 { | |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
240 var args = jsMakePostArgs({"title":1,"text":1,"author":1}, "nn", ""); |
0 | 241 |
242 var msuccess = function(txt) | |
243 { | |
253
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
244 setTimeout("refreshDispatchCC('News');", 50); |
0 | 245 } |
246 | |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
247 if (args != "") |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
248 jsSendPOSTRequest("action=add&type=news&"+args, msuccess); |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
249 |
0 | 250 return false; |
251 } | |
252 | |
253 | |
254 function deleteNews(id) | |
255 { | |
400 | 256 jsDeleteItem(id, "news", "news", "refreshDispatchCC('News');", "news item"); |
0 | 257 } |
258 | |
259 | |
223
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
260 |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
261 function updateNews(id) |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
262 { |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
263 var args = jsMakePostArgs({"title":1,"text":1,"author":1}, "ne", id); |
223
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
264 |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
265 var msuccess = function(txt) |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
266 { |
400 | 267 jsRefreshItems("news"+id, "newsitem", "&id="+id); |
223
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
268 } |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
269 |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
270 if (args != "") |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
271 jsSendPOSTRequest("action=update&type=news&id="+id+"&"+args, msuccess); |
223
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
272 } |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
273 |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
274 |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
275 function addAttendee() |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
276 { |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
277 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "ne", "x"); |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
278 |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
279 var msuccess = function(txt) |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
280 { |
253
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
281 setTimeout("refreshDispatchCC('Attendees');", 50); |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
282 } |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
283 |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
284 if (args != "") |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
285 jsSendPOSTRequest("action=add&type=attendees&"+args, msuccess); |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
286 |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
287 return false; |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
288 } |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
289 |
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
290 |
0 | 291 function deleteAttendee(id) |
292 { | |
400 | 293 jsDeleteItem(id, "attendee", "attendees", "refreshDispatchCC('Attendees');", "attendee"); |
0 | 294 } |
295 | |
296 | |
297 function updateAttendee(id) | |
298 { | |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
299 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "at", id); |
0 | 300 |
53
71256605546b
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
52
diff
changeset
|
301 var msuccess = function(txt) |
71256605546b
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
52
diff
changeset
|
302 { |
400 | 303 jsRefreshItems("attendee"+id, "attendee", "&id="+id+"&edit=1"); |
53
71256605546b
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
52
diff
changeset
|
304 } |
71256605546b
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
52
diff
changeset
|
305 |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
306 if (args != "") |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
307 jsSendPOSTRequest("action=update&type=attendees&id="+id+"&"+args, msuccess); |
0 | 308 } |
309 | |
310 | |
205
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
311 function activateAttendee(id) |
52
cba0b944da79
Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
312 { |
205
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
313 var msuccess1 = function(txt) |
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
314 { |
217
d313f9907610
Fix active attendee handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
315 var nitem = document.getElementById("attendee"+prevAttendee); |
206
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
316 if (nitem) |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
317 { |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
318 nitem.innerHTML = txt; |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
319 nitem.style.background = activeTmp; |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
320 } |
205
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
321 } |
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
322 |
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
323 var msuccess2 = function(txt) |
52
cba0b944da79
Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
324 { |
205
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
325 var nitem = document.getElementById("attendee"+id); |
206
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
326 if (nitem) |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
327 { |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
328 nitem.innerHTML = txt; |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
329 activeTmp = nitem.style.background; |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
330 nitem.style.background = "green"; |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
331 activeAttendee = id; |
1fa109a0c583
Change active attendee entry's background color as indicator.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
332 } |
52
cba0b944da79
Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
333 } |
205
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
334 |
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
335 if (activeAttendee != id) |
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
336 { |
217
d313f9907610
Fix active attendee handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
337 prevAttendee = activeAttendee; |
d313f9907610
Fix active attendee handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
338 activeAttendee = id; |
d313f9907610
Fix active attendee handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
339 |
d313f9907610
Fix active attendee handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
340 if (prevAttendee != -1) |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
341 jsSendPOSTRequest("action=get&type=attendee&id="+prevAttendee+"&edit=0", msuccess1); |
205
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
342 |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
343 jsSendPOSTRequest("action=get&type=attendee&id="+id+"&edit=1", msuccess2); |
205
77d33161f8be
More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
344 } |
52
cba0b944da79
Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
345 } |
cba0b944da79
Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
346 |
cba0b944da79
Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
347 |
0 | 348 function addCompo() |
349 { | |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
350 var args = jsMakePostArgs({"name":1, "description":1}, "nc", ""); |
0 | 351 |
352 var msuccess = function(txt) | |
353 { | |
253
bbe0d57d6ac9
Use a refresh function dispatcher.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
354 setTimeout("refreshDispatchCC('Compos');", 50); |
0 | 355 } |
356 | |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
357 if (args != "") |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
358 jsSendPOSTRequest("action=add&type=compo&"+args, msuccess); |
0 | 359 return false; |
360 } | |
361 | |
362 | |
363 function updateCompo(id) | |
364 { | |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
365 var args = jsMakePostArgs({"name":1, "description":1, "visible":3, "voting":3, "showAuthors":3}, "co", id); |
0 | 366 |
223
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
367 var msuccess = function(txt) |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
368 { |
400 | 369 jsRefreshItems("compo"+id, "compo", "&id="+id); |
223
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
370 } |
532704115290
Make it possible to update news entries.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
371 |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
372 if (args != "") |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
373 jsSendPOSTRequest("action=update&type=compo&id="+id+"&"+args, msuccess); |
0 | 374 } |
375 | |
59
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
376 |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
377 function addEntry(id) |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
378 { |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
379 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1}, "ne", id); |
59
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
380 |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
381 var msuccess = function(txt) |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
382 { |
256
ed8d8d016420
Add refreshCMEntry(id) function for updating one entry only.
Matti Hamalainen <ccr@tnsp.org>
parents:
255
diff
changeset
|
383 setTimeout("refreshDispatchCM("+ id +");", 50); |
59
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
384 } |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
385 |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
386 if (args != "") |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
387 jsSendPOSTRequest("action=add&type=entry&compo_id="+id+"&"+args, msuccess); |
289
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
388 |
59
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
389 return false; |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
390 } |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
391 |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
392 |
289
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
393 function updateEntry(cid, id) |
0 | 394 { |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
395 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "compo_id":2}, "en", id); |
289
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
396 var compo_id = lastPostArgs["compo_id"]; |
0 | 397 |
59
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
398 var msuccess = function(txt) |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
399 { |
289
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
400 if (cid != compo_id) |
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
401 { |
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
402 var nitem = document.getElementById("entry"+ id); |
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
403 if (nitem) |
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
404 nitem.style.display = "none"; |
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
405 } |
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
406 else |
b91e92f18cac
Make changing of entry's compo_id to work in a somewhat more userfriendly manner.
Matti Hamalainen <ccr@tnsp.org>
parents:
286
diff
changeset
|
407 setTimeout("refreshCMEntry("+ id +");", 50); |
59
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
408 } |
e5e38ed4e837
Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
409 |
61
e85ed35585fc
Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
410 if (args != "") |
342
3175ec252c73
Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
411 jsSendPOSTRequest("action=update&type=entry&id="+id+"&"+args, msuccess); |
0 | 412 } |
413 | |
414 | |
258 | 415 function deleteEntry(cid, id) |
0 | 416 { |
400 | 417 jsDeleteItem(id, "entry", "entries", "refreshDispatchCM("+ cid +");", "entry"); |
0 | 418 } |
419 | |
420 | |
350
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
421 function voteKeyRefresh(id) |
321
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
422 { |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
423 var msuccess2 = function(txt) |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
424 { |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
425 var nitem = document.getElementById("vkey"+id); |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
426 if (nitem) |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
427 nitem.className = txt; |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
428 } |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
429 |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
430 var msuccess1 = function(txt) |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
431 { |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
432 var nitem = document.getElementById("vkey"+id); |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
433 if (nitem) |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
434 nitem.innerHTML = txt; |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
435 } |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
436 |
350
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
437 jsSendPOSTRequest("action=get&type=votekey&id="+id, msuccess1); |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
438 jsSendPOSTRequest("action=get&type=votekeyclass&id="+id, msuccess2); |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
439 } |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
440 |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
441 |
435 | 442 function voteKeyUpdate(id, type, args) |
350
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
443 { |
321
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
444 var msuccess = function(txt) |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
445 { |
350
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
446 voteKeyRefresh(id); |
321
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
447 } |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
448 |
435 | 449 jsSendPOSTRequest("action=votekey&type="+type+"&id="+id+"&"+args, msuccess); |
321
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
450 } |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
451 |
9462a59d3ab3
Votekey activation usability improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
320
diff
changeset
|
452 |
320 | 453 function voteKeySetActive(id) |
308
3cfd95758377
A bit of work on vote key management backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
454 { |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
455 var args = jsMakePostArgs({"active":3}, "vk", id); |
350
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
456 |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
457 var mcb_ok = function (data) |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
458 { |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
459 voteKeyUpdate(id, "active", args); |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
460 } |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
461 |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
462 var mcb_cancel = function (data) |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
463 { |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
464 voteKeyRefresh(id); |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
465 } |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
466 |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
467 if (lastPostArgs["active"] == 0) |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
468 jsConfirmBox("Are you sure you want to deactivate vote key #"+id+"?", mcb_ok, mcb_cancel, 0); |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
469 else |
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
470 mcb_ok(0); |
308
3cfd95758377
A bit of work on vote key management backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
471 } |
3cfd95758377
A bit of work on vote key management backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
472 |
3cfd95758377
A bit of work on vote key management backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
473 |
319
623acd958944
Simplify things, add clear button to vote key assignation.
Matti Hamalainen <ccr@tnsp.org>
parents:
312
diff
changeset
|
474 function voteKeyAssign(id, mode) |
308
3cfd95758377
A bit of work on vote key management backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
475 { |
346
c922e5200c55
Rename makePostArgs() to jsMakePostArgs().
Matti Hamalainen <ccr@tnsp.org>
parents:
345
diff
changeset
|
476 var args = jsMakePostArgs({"key_id":2}, "vk", id); |
308
3cfd95758377
A bit of work on vote key management backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
477 |
349
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
478 var mcb_ok = function (data) |
319
623acd958944
Simplify things, add clear button to vote key assignation.
Matti Hamalainen <ccr@tnsp.org>
parents:
312
diff
changeset
|
479 { |
350
2a12f5c72b66
Modularize a bit and add confirmation for deactivating of votekeys.
Matti Hamalainen <ccr@tnsp.org>
parents:
349
diff
changeset
|
480 voteKeyUpdate(id, (mode ? "assign" : "clear"), args); |
319
623acd958944
Simplify things, add clear button to vote key assignation.
Matti Hamalainen <ccr@tnsp.org>
parents:
312
diff
changeset
|
481 } |
349
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
482 |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
483 if (mode == 0) |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
484 jsConfirmBox("Are you sure you want to clear vote key assign #"+id+"?", mcb_ok, 0, 0); |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
485 else |
61c4dda0ec03
New message/confirmation boxes code done in JS + CSS instead of relying on
Matti Hamalainen <ccr@tnsp.org>
parents:
347
diff
changeset
|
486 mcb_ok(0); |
308
3cfd95758377
A bit of work on vote key management backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
487 } |
3cfd95758377
A bit of work on vote key management backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
488 |
0 | 489 |
378 | 490 function performSystemCheck() |
491 { | |
492 jsSendPOSTRequest("action=check", jsMessageBox); | |
493 } | |
494 | |
495 | |
496 function generateEntryPositions(id, patch) | |
497 { | |
385
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
498 var msuccess = function (data) |
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
499 { |
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
500 refreshDispatchCM(id); |
493
7061683be67e
Refresh current entry and entrylist data in compo control if regenerating
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
501 refreshCurrEntryData(); |
7061683be67e
Refresh current entry and entrylist data in compo control if regenerating
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
502 refreshCurrEntryListData(); |
385
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
503 } |
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
504 |
378 | 505 var mcb_ok = function (data) |
506 { | |
507 if (id == 0) | |
493
7061683be67e
Refresh current entry and entrylist data in compo control if regenerating
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
508 jsSendPOSTRequest("action=randomize&type=all&patch="+patch, msuccess); |
378 | 509 else |
385
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
510 jsSendPOSTRequest("action=randomize&type=compo&id="+id+"&patch="+patch, msuccess); |
378 | 511 } |
512 | |
513 if (patch == 0) | |
385
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
514 { |
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
515 jsConfirmBox("Are you <b>sure</b> you want to delete and regenerate entry show positions "+ |
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
516 (id == 0 ? "for ALL compos" : "for this compo") +"? "+ |
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
517 "<b>This will completely annihilate current show position numbers!</b>", mcb_ok, 0, 0); |
8b8b0a83233b
Add compo entry show position buttons to individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
384
diff
changeset
|
518 } |
378 | 519 else |
520 mcb_ok(0); | |
521 } | |
522 | |
523 | |
448 | 524 // |
525 // Competition control | |
526 // | |
390
3257ae94ba1c
Work on show display backend logic.
Matti Hamalainen <ccr@tnsp.org>
parents:
385
diff
changeset
|
527 function setShowMode(mode) |
378 | 528 { |
390
3257ae94ba1c
Work on show display backend logic.
Matti Hamalainen <ccr@tnsp.org>
parents:
385
diff
changeset
|
529 jsSendPOSTRequest("action=ctrl&type=setShowMode&mode="+mode); |
378 | 530 } |
531 | |
532 | |
407 | 533 function refreshCurrEntryData() |
534 { | |
535 jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", ""); | |
536 } | |
537 | |
538 | |
539 function refreshCurrEntryListData() | |
540 { | |
541 jsRefreshItems("ctrlEntryList", "infoCurrEntryList", ""); | |
542 refreshCurrEntryData(); | |
543 } | |
544 | |
545 | |
404 | 546 function activateCompo() |
547 { | |
407 | 548 jsSendPOSTRequest("action=ctrl&type=setCompoID&id="+jsGetValue("ctrlCompoListSel", 4), refreshCurrEntryListData); |
408 | 549 } |
404 | 550 |
408 | 551 |
552 function setSelectedEntry() | |
553 { | |
554 jsSendPOSTRequest("action=ctrl&type=setEntry&index="+jsGetValue("ctrlEntryListSel", 4), refreshCurrEntryData); | |
555 } | |
556 | |
557 | |
558 function switchEntry(dir) | |
559 { | |
560 jsSendPOSTRequest("action=ctrl&type="+ (dir < 0 ? "prevEntry" : "nextEntry"), refreshCurrEntryListData); | |
561 } | |
562 | |
563 | |
448 | 564 // |
565 // Rotation list editing and handling | |
566 // | |
462
52d11e7e9d62
Refresh rotation list list when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
461
diff
changeset
|
567 function refreshRotationListSel() |
52d11e7e9d62
Refresh rotation list list when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
461
diff
changeset
|
568 { |
52d11e7e9d62
Refresh rotation list list when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
461
diff
changeset
|
569 jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", ""); |
52d11e7e9d62
Refresh rotation list list when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
461
diff
changeset
|
570 } |
52d11e7e9d62
Refresh rotation list list when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
461
diff
changeset
|
571 |
52d11e7e9d62
Refresh rotation list list when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
461
diff
changeset
|
572 |
459 | 573 function refreshRotationListEdit(id) |
422 | 574 { |
459 | 575 jsRefreshItems("ctrlRotationListEdit", "infoRotationListEdit", "&id="+id+"&full=0"); |
462
52d11e7e9d62
Refresh rotation list list when needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
461
diff
changeset
|
576 refreshRotationListSel(); |
422 | 577 } |
578 | |
579 | |
455 | 580 function refreshActiveRotationList() |
581 { | |
582 jsRefreshItems("ctrlActiveRotationList", "infoActiveRotationList", ""); | |
583 } | |
584 | |
585 | |
450 | 586 function setRotateDuration() |
587 { | |
588 var duration = jsGetValue("ctrlRotSlideDuration", 2); | |
589 jsSendPOSTRequest("action=ctrl&type=setRotateDuration&duration="+duration); | |
590 } | |
591 | |
592 | |
454 | 593 function setActiveRotationList() |
453 | 594 { |
595 var id = jsGetValue("ctrlRotationListsSel", 4); | |
596 if (id > 0) | |
455 | 597 jsSendPOSTRequest("action=ctrl&type=setActiveRotationList&id="+id, refreshActiveRotationList); |
453 | 598 else |
599 jsMessageBox("No rotation list selected?"); | |
600 } | |
601 | |
602 | |
603 function updateRotationList(id) | |
604 { | |
605 var name = jsGetValue("ctrlEDRotationListName", 1); | |
606 jsSendPOSTRequest("action=ctrl&type=updateRotationList&id="+id+"&name="+name, refreshRotationListSel); | |
607 } | |
608 | |
609 | |
450 | 610 function moveRotationListSlide(list_id, dir) |
422 | 611 { |
459 | 612 var msuccess = function(txt) |
613 { | |
614 refreshRotationListEdit(list_id); | |
615 } | |
616 | |
461 | 617 var slide = jsGetValue("ctrlEDRotationListSel", 4); |
618 if (slide) | |
619 { | |
620 var str = slide.split("_"); | |
621 jsSendPOSTRequest("action=ctrl&type=moveRotationListSlide&list_id="+list_id+ | |
622 "&slide_id="+parseInt(str[0])+"&order_num="+parseInt(str[1])+"&dir="+dir, msuccess); | |
623 } | |
450 | 624 else |
625 jsMessageBox("No slide selected?"); | |
422 | 626 } |
627 | |
628 | |
450 | 629 function addRotationListSlide(list_id) |
422 | 630 { |
459 | 631 var msuccess = function(txt) |
632 { | |
633 refreshRotationListEdit(list_id); | |
634 } | |
635 | |
636 var slide_id = jsGetValue("ctrlEDDisplaySlidesSel", 4); | |
450 | 637 if (slide_id > 0) |
459 | 638 jsSendPOSTRequest("action=ctrl&type=addRotationListSlide&list_id="+list_id+"&slide_id="+slide_id, msuccess); |
450 | 639 else |
640 jsMessageBox("No slide selected?"); | |
422 | 641 } |
642 | |
643 | |
461 | 644 function removeRotationListSlide(list_id) |
422 | 645 { |
459 | 646 var msuccess = function(txt) |
647 { | |
648 refreshRotationListEdit(list_id); | |
649 } | |
650 | |
461 | 651 var slide = jsGetValue("ctrlEDRotationListSel", 4); |
652 if (slide) | |
653 { | |
654 var str = slide.split("_"); | |
655 jsSendPOSTRequest("action=ctrl&type=removeRotationListSlide&list_id="+list_id+ | |
656 "&slide_id="+parseInt(str[0])+"&order_num="+parseInt(str[1]), msuccess); | |
657 } | |
450 | 658 else |
659 jsMessageBox("No slide selected?"); | |
422 | 660 } |
661 | |
416
876846d8ed5b
Rename some database things.
Matti Hamalainen <ccr@tnsp.org>
parents:
408
diff
changeset
|
662 |
423 | 663 function editRotationList() |
664 { | |
427 | 665 var id = jsGetValue("ctrlRotationListsSel", 4); |
666 if (id > 0) | |
428 | 667 jsSendPOSTRequest("action=get&type=infoRotationListEdit&id="+id, jsOpenAdminPopup); |
427 | 668 else |
669 jsMessageBox("No rotation list selected?"); | |
423 | 670 } |
671 | |
672 | |
673 function newRotationList() | |
674 { | |
427 | 675 var msuccess = function(txt) |
676 { | |
432
07d0dab94cdc
Add confirmation for deleting rotation lists.
Matti Hamalainen <ccr@tnsp.org>
parents:
429
diff
changeset
|
677 refreshRotationListSel(); |
428 | 678 jsOpenAdminPopup(txt); |
427 | 679 } |
680 | |
681 jsSendPOSTRequest("action=ctrl&type=newRotationList", msuccess); | |
682 } | |
683 | |
684 | |
685 function deleteRotationList() | |
686 { | |
432
07d0dab94cdc
Add confirmation for deleting rotation lists.
Matti Hamalainen <ccr@tnsp.org>
parents:
429
diff
changeset
|
687 var mcb_ok = function(txt) |
427 | 688 { |
432
07d0dab94cdc
Add confirmation for deleting rotation lists.
Matti Hamalainen <ccr@tnsp.org>
parents:
429
diff
changeset
|
689 jsSendPOSTRequest("action=ctrl&type=deleteRotationList&id="+id, refreshRotationListSel); |
427 | 690 } |
691 | |
692 var id = jsGetValue("ctrlRotationListsSel", 4); | |
693 if (id > 0) | |
432
07d0dab94cdc
Add confirmation for deleting rotation lists.
Matti Hamalainen <ccr@tnsp.org>
parents:
429
diff
changeset
|
694 { |
07d0dab94cdc
Add confirmation for deleting rotation lists.
Matti Hamalainen <ccr@tnsp.org>
parents:
429
diff
changeset
|
695 jsConfirmBox("Are you <b>sure</b> you want to delete rotation list #"+id+"?", |
07d0dab94cdc
Add confirmation for deleting rotation lists.
Matti Hamalainen <ccr@tnsp.org>
parents:
429
diff
changeset
|
696 mcb_ok, 0, 0); |
07d0dab94cdc
Add confirmation for deleting rotation lists.
Matti Hamalainen <ccr@tnsp.org>
parents:
429
diff
changeset
|
697 } |
427 | 698 else |
699 jsMessageBox("No rotation list selected?"); | |
423 | 700 } |
701 | |
702 | |
446 | 703 // |
704 // Display slide editing and handling | |
705 // | |
706 function refreshDisplaySlideListSel() | |
707 { | |
708 jsRefreshItems("ctrlDisplaySlidesSel", "infoDisplaySlides", ""); | |
709 } | |
710 | |
711 | |
438
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
712 function updateDisplaySlide(id) |
408 | 713 { |
438
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
714 var vtitle = jsGetValue("ctrlDisplaySlideTitle", 1); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
715 var vtext = jsGetValue("ctrlDisplaySlideText", 1); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
716 jsSendPOSTRequest("action=ctrl&type=updateDisplaySlide&id="+id+"&title="+vtitle+"&text="+vtext, refreshDisplaySlideListSel); |
428 | 717 jsCloseAdminPopup(); |
438
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
718 return false; |
408 | 719 } |
720 | |
721 | |
422 | 722 function editDisplaySlide() |
408 | 723 { |
438
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
724 var id = jsGetValue("ctrlDisplaySlidesSel", 4); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
725 if (id > 0) |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
726 jsSendPOSTRequest("action=get&type=infoDisplaySlideEdit&id="+id, jsOpenAdminPopup); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
727 else |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
728 jsMessageBox("No display slide selected?"); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
729 } |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
730 |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
731 |
457
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
732 function copyDisplaySlide() |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
733 { |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
734 var msuccess = function(txt) |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
735 { |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
736 refreshDisplaySlideListSel(); |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
737 jsOpenAdminPopup(txt); |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
738 } |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
739 |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
740 var id = jsGetValue("ctrlDisplaySlidesSel", 4); |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
741 if (id > 0) |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
742 jsSendPOSTRequest("action=ctrl&type=copyDisplaySlide&id="+id, msuccess); |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
743 else |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
744 jsMessageBox("No display slide selected?"); |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
745 } |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
746 |
3b5184c6b36f
Add slide copying function.
Matti Hamalainen <ccr@tnsp.org>
parents:
455
diff
changeset
|
747 |
408 | 748 function newDisplaySlide() |
749 { | |
438
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
750 var msuccess = function(txt) |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
751 { |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
752 refreshDisplaySlideListSel(); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
753 jsOpenAdminPopup(txt); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
754 } |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
755 |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
756 jsSendPOSTRequest("action=ctrl&type=newDisplaySlide", msuccess); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
757 } |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
758 |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
759 |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
760 function deleteDisplaySlide() |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
761 { |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
762 var msuccess = function(txt) |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
763 { |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
764 refreshDisplaySlideListSel(); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
765 refreshRotationListSel(); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
766 } |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
767 |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
768 var mcb_ok = function(txt) |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
769 { |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
770 jsSendPOSTRequest("action=ctrl&type=deleteDisplaySlide&id="+id, msuccess); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
771 } |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
772 |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
773 var id = jsGetValue("ctrlDisplaySlidesSel", 4); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
774 if (id > 0) |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
775 { |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
776 jsConfirmBox("Are you <b>sure</b> you want to delete slide list #"+id+"?", |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
777 mcb_ok, 0, 0); |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
778 } |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
779 else |
48903fd966cd
Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents:
435
diff
changeset
|
780 jsMessageBox("No display slide selected?"); |
404 | 781 } |
782 | |
783 | |
429 | 784 function activateTempSlide() |
785 { | |
786 var id = jsGetValue("ctrlDisplaySlidesSel", 4); | |
787 var duration = jsGetValue("ctrlTempSlideDuration", 2); | |
788 if (id > 0) | |
789 jsSendPOSTRequest("action=ctrl&type=setTempSlide&id="+id+"&duration="+duration, jsMessageBox); | |
790 else | |
791 jsMessageBox("No slide selected?"); | |
792 } | |
793 | |
472 | 794 function skipToNextSlide() |
795 { | |
796 jsSendPOSTRequest("action=ctrl&type=skipToNextSlide"); | |
797 } | |
798 | |
0 | 799 </script> |
800 | |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
801 <!-- ========================== --> |
0 | 802 |
427 | 803 <div id="adminPopup"></div> |
345 | 804 <div id="adminContent"> |
805 | |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
806 <div id="nstatus">-</div> |
201
a4be19c4d99d
Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
807 <div id="tabHeadersCC" class="tabHeaders"></div> |
a4be19c4d99d
Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
808 <div id="tabContentsCC" class="tabContents"></div> |
171
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
809 |
0 | 810 <script type="text/javascript"> |
445
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
811 jsRegisterTab("CC", "Settings", "Settings"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
812 jsRegisterTab("CC", "News", "News"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
813 jsRegisterTab("CC", "Attendees", "Attendees"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
814 jsRegisterTab("CC", "Voting", "Voting"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
815 jsRegisterTab("CC", "Compos", "Compos"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
816 jsRegisterTab("CC", "Entries", "Entries"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
817 jsRegisterTab("CC", "InfoSys", "Infosystem"); |
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
818 jsUpdateTabList("CC", |
263 | 819 "<a class=\"admin\" href=\"admlogout.php\">Logout</a> " + |
201
a4be19c4d99d
Modularize admin pages tab system.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
820 "<a class=\"admin\" href=\"about\">Mainpage</a>"); |
445
cf7053f04e88
Move tab handling code to majax module.
Matti Hamalainen <ccr@tnsp.org>
parents:
438
diff
changeset
|
821 jsSwitchActiveTab("CC", "Settings"); |
0 | 822 </script> |
171
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
823 <? |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
824 } |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
825 |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
826 cmPrintPageFooter(); |
705dabdc37d4
Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
827 ?> |