Mercurial > hg > fapweb
annotate admin.inc.php @ 32:36392d1d6b5f
Moar work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 10 Dec 2012 11:14:05 +0200 |
parents | ad25827304b6 |
children | 5bf22431176c |
rev | line source |
---|---|
0 | 1 <? |
32 | 2 $sessionType = "admin"; |
3 | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
4 function stCreateSettingsData() |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
5 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
6 $args = array(); |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
7 |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
8 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
|
9 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
10 foreach ($res as $item) |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
11 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
12 switch ($item["vtype"]) |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
13 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
14 case VT_STR: |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
15 case VT_TEXT: $type = 0; break; |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
16 case VT_INT: $type = 4; break; |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
17 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
|
18 } |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
19 $args[] = "\"".$item["key"]."\":".$type; |
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 } |
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 echo |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
24 "\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
25 "function updateSettings()\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
26 "{\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
27 " var args = makePostArgs({".implode(",", $args)."}, \"st\", \"\");\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
28 " sendPOSTRequest(\"action=update&type=settings&\"+args);\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
29 " return false;\n". |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
30 "}\n"; |
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 |
0 | 33 // Check if sessions are enabled |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
34 if (!stChkSetting("admPassword")) |
0 | 35 { |
36 echo "<h1>Oh noes, admin configuration not done!</h1>\n". | |
37 "<p>Better go and prod that, so you get to use the fine admin interface.</p>\n"; | |
38 $authState = "error"; | |
39 } | |
40 else | |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
41 if (stAdmSessionAuth()) |
0 | 42 { |
43 $authState = "ok"; | |
44 } | |
45 else | |
46 { | |
47 // Perform authentication if we are not in session already | |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
48 echo |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
49 "<h1>Party admin login</h1>\n". |
0 | 50 "<p>Please use illegal telepathy over HTTP to provide a password to enter the party administration systembolaget.</p>\n". |
32 | 51 stGetFormStart("admlogin", "admlogin.php"). |
0 | 52 stGetFormHiddenInput("mode", "check")."\n". |
32 | 53 stGetFormHiddenInput("goto", "admin")."\n". |
54 stGetFormPasswordInput("admpass", "", "")."\n". | |
55 stGetFormSubmitInput("submit", "Login"). | |
0 | 56 "</form>\n"; |
57 | |
58 $authState = "login"; | |
59 } | |
60 | |
61 if ($authState == "ok") | |
62 { | |
63 ?> | |
64 <script type="text/javascript"> | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
65 // <? stCreateSettingsData(); ?> |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
66 |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
67 |
0 | 68 function statusMsg(msg) |
69 { | |
70 document.getElementById("nstatus").innerHTML = msg; | |
71 } | |
72 | |
73 | |
74 function strtrim(str) | |
75 { | |
76 if (!str || str == null) | |
77 return ""; | |
78 return str.replace(/^\s+|\s+$/g,'') | |
79 } | |
80 | |
81 | |
82 function strencode(str) | |
83 { | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
84 return encodeURIComponent(str); |
0 | 85 } |
86 | |
87 | |
88 function createXMLRequest() | |
89 { | |
90 var req; | |
91 if (window.XMLHttpRequest) | |
92 { | |
93 // Modern browsers | |
94 req = new XMLHttpRequest(); | |
95 } | |
96 else | |
97 { | |
98 // Old IE versions | |
99 req = new ActiveXObject("Microsoft.XMLHTTP"); | |
100 } | |
101 return req; | |
102 } | |
103 | |
104 | |
105 function sendPOSTRequest(params, success, failure) | |
106 { | |
107 var req = createXMLRequest(); | |
108 req.open("POST", "ajax.php", true); | |
109 req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
110 req.setRequestHeader("Content-length", params.length); | |
111 req.setRequestHeader("Connection", "close"); | |
112 | |
113 req.onreadystatechange = function() | |
114 { | |
115 if (req.readyState == 4) | |
116 { | |
117 if (req.status == 404) | |
118 { | |
32 | 119 window.location = "admlogout.php"; |
0 | 120 } |
121 else | |
122 if (req.status == 200) | |
123 { | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
124 if (success) |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
125 { |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
126 success(req.responseText); |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
127 } |
0 | 128 statusMsg(req.statusText); |
129 } | |
130 else | |
131 { | |
132 if (failure) | |
133 { | |
134 failure(req.status, req.statusText, req.responseText); | |
135 } | |
136 else | |
137 { | |
138 statusMsg("["+req.status+" - "+req.statusText+"] "+ req.responseText); | |
139 } | |
140 } | |
141 } | |
142 } | |
143 req.send(params); | |
144 } | |
145 | |
146 | |
147 function makePostArgs(fields, fprefix, fsuffix) | |
148 { | |
149 var res = []; | |
150 for (var id in fields) | |
151 { | |
152 var elem = document.getElementById(fprefix + id + fsuffix); | |
153 if (!elem) | |
154 { | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
155 alert("No such DOM element '"+ fprefix + id + fsuffix +"'."); |
0 | 156 return ""; |
157 } | |
158 | |
159 switch (fields[id]) | |
160 { | |
161 case 0: | |
162 case 1: | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
163 case 4: |
0 | 164 { |
165 var str = strtrim(elem.value); | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
166 if ((fields[id] == 1 || fields[id] == 4) && str == "") |
0 | 167 { |
168 alert("One or more of the fields are empty."); | |
169 return ""; | |
170 } | |
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
171 if (fields[id] == 4) |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
172 res.push(id+"="+parseInt(elem.value)); |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
173 else |
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
10
diff
changeset
|
174 res.push(id+"="+strencode(str)); |
0 | 175 } |
176 break; | |
177 | |
178 case 2: | |
179 res.push(id+"="+parseInt(elem.value)); | |
180 break; | |
181 | |
182 case 3: | |
183 res.push(id+"="+(elem.checked ? "1" : "0")); | |
184 break; | |
185 | |
186 } | |
187 } | |
188 return res.join("&"); | |
189 } | |
190 | |
191 | |
192 function refreshItems(id,name,msgname) | |
193 { | |
194 var msuccess = function(txt) | |
195 { | |
196 var nitem = document.getElementById(id); | |
197 nitem.innerHTML = txt; | |
198 } | |
199 | |
200 sendPOSTRequest("action=get&type="+name, msuccess); | |
201 } | |
202 | |
203 | |
204 function deleteItem(id,prefix,type,func,dsc) | |
205 { | |
206 var msuccess = function(txt) | |
207 { | |
208 var item = document.getElementById(prefix+id); | |
209 item.style.display = "none"; | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
210 setTimeout(func, 50); |
0 | 211 } |
212 | |
213 if (confirm("Are you sure you want to delete "+dsc+" #"+id+"?")) | |
214 { | |
215 sendPOSTRequest("action=delete&type="+type+"&id="+id, msuccess); | |
216 } | |
217 } | |
218 | |
219 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
220 function refreshSettings() |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
221 { |
10
11816aad6967
Start work on settings interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
222 refreshItems("nsettings", "settings", "General settings"); |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
223 } |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
224 |
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
225 |
0 | 226 function refreshNews() |
227 { | |
228 refreshItems("nnews", "news", "News list"); | |
229 } | |
230 | |
231 | |
232 function refreshAttendees() | |
233 { | |
234 refreshItems("nattendees", "attendees", "Attendees list"); | |
235 } | |
236 | |
237 | |
238 function refreshDump() | |
239 { | |
240 var msuccess = function(txt) | |
241 { | |
242 var nitem = document.getElementById("ndump"); | |
243 nitem.innerHTML = txt; | |
244 } | |
245 | |
246 sendPOSTRequest("action=dump&type=attendees", msuccess); | |
247 } | |
248 | |
249 | |
250 function refreshCompos() | |
251 { | |
252 refreshItems("ncompos", "compos", "Compo list"); | |
253 } | |
254 | |
255 | |
256 function refreshEntries() | |
257 { | |
258 refreshItems("nentries", "entries", "Entry list"); | |
259 } | |
260 | |
261 | |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
262 function refreshUsers() |
0 | 263 { |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
264 refreshItems("nusers", "users", "Users list"); |
0 | 265 } |
266 | |
267 | |
268 function addNews() | |
269 { | |
270 var args = makePostArgs({"title":1,"text":1,"author":1}, "nn", ""); | |
271 | |
272 var msuccess = function(txt) | |
273 { | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
274 setTimeout("refreshNews();", 50); |
0 | 275 } |
276 | |
277 sendPOSTRequest( | |
278 "action=add&type=news&"+args, | |
279 msuccess); | |
280 return false; | |
281 } | |
282 | |
283 | |
284 function deleteNews(id) | |
285 { | |
286 deleteItem(id, "news", "news", "refreshNews();", "news item"); | |
287 } | |
288 | |
289 | |
290 function deleteAttendee(id) | |
291 { | |
292 deleteItem(id, "attendee", "attendees", "refreshAttendees();", "attendee"); | |
293 } | |
294 | |
295 | |
296 function updateAttendee(id) | |
297 { | |
298 var args = makePostArgs({"oneliner":0,"email":0}, "at", id); | |
299 | |
300 sendPOSTRequest("action=update&type=attendees&id="+id+"&"+args); | |
301 } | |
302 | |
303 | |
304 function addCompo() | |
305 { | |
306 var args = makePostArgs({"name":1, "description":1}, "nc", ""); | |
307 | |
308 var msuccess = function(txt) | |
309 { | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
310 setTimeout("refreshCompos();", 50); |
0 | 311 } |
312 | |
313 sendPOSTRequest("action=add&type=compo&"+args, msuccess); | |
314 return false; | |
315 } | |
316 | |
317 | |
318 function updateCompo(id) | |
319 { | |
24
5bc8bd5c7ecc
Make voting toggle for individual compos.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
320 var args = makePostArgs({"name":1, "description":1, "visible":3, "voting":3}, "co", id); |
0 | 321 |
322 sendPOSTRequest("action=update&type=compo&id="+id+"&"+args); | |
323 } | |
324 | |
325 function updateEntry(id) | |
326 { | |
30
ad25827304b6
Adding entries is now done via the regular entry submission system .. which
Matti Hamalainen <ccr@tnsp.org>
parents:
26
diff
changeset
|
327 var args = makePostArgs({"name":1, "author":1, "compo_id":2}, "en", id); |
0 | 328 |
329 sendPOSTRequest( | |
330 "action=update&type=entry&id="+id+"&"+args); | |
331 } | |
332 | |
333 | |
334 function deleteEntry(id) | |
335 { | |
336 deleteItem(id, "entry", "entries", "refreshEntries();", "entry"); | |
337 } | |
338 | |
339 | |
340 function updateVoter(id) | |
341 { | |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
342 var args = makePostArgs({"active":3, "name":0}, "vo", id); |
0 | 343 |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
344 var msuccess = function(txt) |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
345 { |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
346 setTimeout("refreshUsers();", 50); |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
347 } |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
348 |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
349 sendPOSTRequest("action=update&type=user&id="+id+"&"+args, msuccess); |
0 | 350 } |
351 | |
352 | |
19
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
353 function updateVoter2(id) |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
354 { |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
355 var elem = document.getElementById("voactive"+id); |
19
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
356 if (elem && !elem.checked) |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
357 { |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
358 if (confirm("Are you sure you want deactivate vote ID #"+id+"?")) |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
359 updateVoter(id); |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
360 else |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
361 setTimeout("refreshUsers();", 50); |
19
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
362 } |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
363 else |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
364 updateVoter(id); |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
365 } |
1e258de5511d
Add confirmation for deactivation of vote keys.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
366 |
0 | 367 var registeredTabs = Object(); |
368 | |
369 | |
370 function updateTabList() | |
371 { | |
372 var item = document.getElementById("pageTabs"); | |
373 var str = ""; | |
374 for (var id in registeredTabs) | |
375 { | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
376 str += "<a id=\"cc"+id+ |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
377 "\"href=\"#\" onClick=\"switchActiveTab('"+id+ |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
378 "')\">"+registeredTabs[id]+"</a>"; |
0 | 379 } |
380 | |
32 | 381 str += "<a class=\"admin\" href=\"admlogout.php\">Logout</a>"; |
0 | 382 |
383 item.innerHTML = str; | |
384 } | |
385 | |
386 | |
387 function registerTab(id, name) | |
388 { | |
389 registeredTabs[id] = name; | |
390 } | |
391 | |
392 | |
393 function refreshTabs() | |
394 { | |
395 for (var id in registeredTabs) | |
396 { | |
397 setTimeout("refresh"+ registeredTabs[id] +"();", 10); | |
398 } | |
399 } | |
400 | |
401 | |
402 function switchActiveTab(tab) | |
403 { | |
404 for (var id in registeredTabs) | |
405 { | |
406 var ob = document.getElementById(id); | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
407 var ccob = document.getElementById("cc"+id); |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
408 if (ob && ccob) |
0 | 409 { |
410 ob.style.display = (tab == id) ? "block" : "none"; | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
411 ccob.style.borderTop = (tab == id) ? "4px solid white" : "none"; |
0 | 412 if (tab == id) |
413 { | |
414 setTimeout("refresh"+ registeredTabs[id] +"();", 10); | |
415 } | |
416 } | |
417 } | |
418 } | |
419 </script> | |
420 | |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
421 <!-- ========================== --> |
0 | 422 |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
423 <div id="nstatus">-</div> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
424 |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
425 <div id="pageTabs"></div> |
0 | 426 |
427 <!-- ========================== --> | |
428 | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
429 <div id="tabSettings"> |
10
11816aad6967
Start work on settings interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
430 <form method="post" action="" onsubmit="return updateSettings()"> |
11816aad6967
Start work on settings interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
431 <div id="nsettings"></div> |
11816aad6967
Start work on settings interface.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
432 </form> |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
433 </div> |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
434 |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
435 <!-- ========================== --> |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
436 |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
437 <div id="tabNews"> |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
438 <form method="post" action="" onsubmit="return addNews()"> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
439 <input id="nntitle" type="text" size="40" /><br /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
440 <textarea id="nntext" rows="5" cols="60"></textarea><br /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
441 <input id="nnauthor" type="text" value="orgaz" /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
442 <input id="nnadd" type="submit" value=" Add post " /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
443 <input type="button" value=" Clear " onClick="this.form.reset()" /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
444 </form> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
445 <hr /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
446 <div id="nnews"></div> |
0 | 447 </div> |
448 | |
449 <!-- ========================== --> | |
450 | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
451 <div id="tabAttendees"> |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
452 <div id="nattendees"></div> |
0 | 453 </div> |
454 | |
455 <!-- ========================== --> | |
456 | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
457 <div id="tabDump"> |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
458 <div id="ndump"></div> |
0 | 459 </div> |
460 | |
461 <!-- ========================== --> | |
462 | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
463 <div id="tabCompos"> |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
464 <form method="post" action="" onsubmit="return addCompo()"> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
465 <input id="ncname" type="text" size="64" /><br /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
466 <textarea id="ncdescription" rows="5" cols="60"></textarea><br /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
467 <input id="nccompo" type="submit" value=" Add compo " /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
468 <input type="button" value=" Clear " onClick="this.form.reset()" /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
469 </form> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
470 <hr /> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
471 <div id="ncompos"></div> |
0 | 472 </div> |
473 | |
474 <!-- ========================== --> | |
475 | |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
476 <div id="tabEntries"> |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
477 <div id="nentries"></div> |
0 | 478 </div> |
479 | |
480 <!-- ========================== --> | |
481 | |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
482 <div id="tabUsers"> |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
483 <p> |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
484 Key entries can only be generated via the shell-utility 'keygen'. |
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
485 </p> |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
486 <div id="nusers"></div> |
0 | 487 </div> |
488 | |
489 <!-- ========================== --> | |
490 | |
491 <script type="text/javascript"> | |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
492 registerTab("tabSettings", "Settings"); |
7
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
493 registerTab("tabNews", "News"); |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
494 registerTab("tabAttendees", "Attendees"); |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
495 registerTab("tabDump", "Dump"); |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
496 registerTab("tabCompos", "Compos"); |
d76020022881
Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
497 registerTab("tabEntries", "Entries"); |
26
7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
498 registerTab("tabUsers", "Users"); |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
499 updateTabList(); |
17 | 500 switchActiveTab("tabSettings"); |
0 | 501 </script> |
5
76c3b89d7b11
Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
502 <? } ?> |