comparison admin.js @ 1067:82ecea33c477

Various cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 24 Jan 2017 16:43:58 +0200
parents fb5a468e647d
children
comparison
equal deleted inserted replaced
1065:511147c1e119 1067:82ecea33c477
63 tabHead.className = (tab == id) ? "active" : "inactive"; 63 tabHead.className = (tab == id) ? "active" : "inactive";
64 if (tab == id) 64 if (tab == id)
65 { 65 {
66 // Set active tab and refresh contents 66 // Set active tab and refresh contents
67 activeTabs[tabset] = id; 67 activeTabs[tabset] = id;
68 setTimeout("refreshDispatch"+ tabset +"('"+ id +"');", 10); 68 setTimeout(function(qtabset, qid) {
69 switch (qtabset)
70 {
71 case "CM": refreshDispatchCM(qid); break;
72 case "CC": refreshDispatchCC(qid); break;
73 case "CS": refreshDispatchCS(qid); break;
74 default: jsMessageBox("Invalid tabset value: '"+ qtabset +"'.");
75 }
76 }, 10, tabset, id);
69 jsCancelUploadCBS(); 77 jsCancelUploadCBS();
70 } 78 }
71 else 79 else
72 { 80 {
73 // Clear inactive tabs 81 // Clear inactive tabs
221 case "Voting" : jsRefreshItems("tabContCCVoting", "voters", ""); break; 229 case "Voting" : jsRefreshItems("tabContCCVoting", "voters", ""); break;
222 case "Compos" : jsRefreshItems("tabContCCCompos", "compos", ""); break; 230 case "Compos" : jsRefreshItems("tabContCCCompos", "compos", ""); break;
223 case "InfoSys" : jsRefreshItems("tabContCCInfoSys", "infoMain", ""); break; 231 case "InfoSys" : jsRefreshItems("tabContCCInfoSys", "infoMain", ""); break;
224 case "Settings" : jsRefreshPanels("CS", "tabContCCSettings", "settingslist", "*"); break; 232 case "Settings" : jsRefreshPanels("CS", "tabContCCSettings", "settingslist", "*"); break;
225 case "Entries" : jsRefreshPanels("CM", "tabContCCEntries", "compolist", ""); break; 233 case "Entries" : jsRefreshPanels("CM", "tabContCCEntries", "compolist", ""); break;
234 default : alert("Invalid id: '"+ id +"'.'");
226 } 235 }
227 } 236 }
228 237
229 238
230 function refreshDispatchCS(id) 239 function refreshDispatchCS(id)
247 { 256 {
248 var args = jsMakePostArgs({"title":1,"text":1,"author":1}, "nn", ""); 257 var args = jsMakePostArgs({"title":1,"text":1,"author":1}, "nn", "");
249 258
250 var msuccess = function(txt) 259 var msuccess = function(txt)
251 { 260 {
252 setTimeout("refreshDispatchCC('News');", 50); 261 setTimeout(function () { refreshDispatchCC("News"); }, 50);
253 } 262 }
254 263
255 if (args != "") 264 if (args != "")
256 jsSendPOSTRequest("action=add&type=news&"+args, msuccess); 265 jsSendPOSTRequest("action=add&type=news&"+args, msuccess);
257 266
259 } 268 }
260 269
261 270
262 function deleteNews(id) 271 function deleteNews(id)
263 { 272 {
264 jsDeleteItem(id, "news", "news", "refreshDispatchCC('News');", "news item"); 273 jsDeleteItem(id, "news", "news", function() { refreshDispatchCC("News"); }, "news item");
265 } 274 }
266 275
267 276
268 function updateNews(id) 277 function updateNews(id)
269 { 278 {
286 { 295 {
287 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "ne", "x"); 296 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "ne", "x");
288 297
289 var msuccess = function(txt) 298 var msuccess = function(txt)
290 { 299 {
291 setTimeout("refreshDispatchCC('Attendees');", 50); 300 setTimeout(function() { refreshDispatchCC("Attendees"); }, 50);
292 } 301 }
293 302
294 if (args != "") 303 if (args != "")
295 jsSendPOSTRequest("action=add&type=attendees&"+args, msuccess); 304 jsSendPOSTRequest("action=add&type=attendees&"+args, msuccess);
296 305
298 } 307 }
299 308
300 309
301 function deleteAttendee(id) 310 function deleteAttendee(id)
302 { 311 {
303 jsDeleteItem(id, "attendee", "attendees", "refreshDispatchCC('Attendees');", "attendee"); 312 jsDeleteItem(id, "attendee", "attendees", function () { refreshDispatchCC("Attendees"); }, "attendee");
304 } 313 }
305 314
306 315
307 function updateAttendee(id) 316 function updateAttendee(id)
308 { 317 {
363 { 372 {
364 var args = jsMakePostArgs({"name":1, "description":1}, "nc", ""); 373 var args = jsMakePostArgs({"name":1, "description":1}, "nc", "");
365 374
366 var msuccess = function(txt) 375 var msuccess = function(txt)
367 { 376 {
368 setTimeout("refreshDispatchCC('Compos');", 50); 377 setTimeout(function () { refreshDispatchCC("Compos"); }, 50);
369 } 378 }
370 379
371 if (args != "") 380 if (args != "")
372 jsSendPOSTRequest("action=add&type=compo&"+args, msuccess); 381 jsSendPOSTRequest("action=add&type=compo&"+args, msuccess);
373 return false; 382 return false;
410 } 419 }
411 420
412 421
413 function deleteCompo(id) 422 function deleteCompo(id)
414 { 423 {
415 jsDeleteItem(id, "compo", "compo", "refreshDispatchCC('Compos');", 0, 424 jsDeleteItem(id, "compo", "compo", function () { refreshDispatchCC("Compos"); }, 0,
416 "Are you ABSOLUTELY sure you want to delete compo #"+id+"? "+ 425 "Are you ABSOLUTELY sure you want to delete compo #"+id+"? "+
417 "This will delete all votes AND entries related to it!"); 426 "This will delete all votes AND entries related to it!");
418 } 427 }
419 428
420 429
421 // 430 //
422 // Entry management 431 // Entry management
423 // 432 //
424 function refreshEntryCompos() 433 function refreshEntryCompos()
425 { 434 {
426 setTimeout("refreshDispatchCC('Entries');", 50); 435 setTimeout(function () { refreshDispatchCC("Entries"); }, 50);
427 } 436 }
428 437
429 438
430 function activateEntry(id, force) 439 function activateEntry(id, force)
431 { 440 {
473 482
474 jsCancelUploadCBS(); 483 jsCancelUploadCBS();
475 484
476 var msuccess = function(txt) 485 var msuccess = function(txt)
477 { 486 {
478 setTimeout("refreshDispatchCM("+ id +");", 50); 487 setTimeout(function (q) { refreshDispatchCM(qid); }, 50, id);
479 refreshEntryCompos(); 488 refreshEntryCompos();
480 } 489 }
481 490
482 if (args != "") 491 if (args != "")
483 jsSendPOSTRequest("action=add&type=entry&compo_id="+id+"&"+args, msuccess); 492 jsSendPOSTRequest("action=add&type=entry&compo_id="+id+"&"+args, msuccess);
538 547
539 548
540 function deleteEntry(cid, id) 549 function deleteEntry(cid, id)
541 { 550 {
542 jsCancelUploadCBS(); 551 jsCancelUploadCBS();
543 jsDeleteItem(id, "entry", "entries", "refreshDispatchCM("+ cid +");refreshEntryCompos();", "entry"); 552 jsDeleteItem(id, "entry", "entries", function() { refreshDispatchCM(cid); refreshEntryCompos(); }, "entry");
544 } 553 }
545 554
546 555
547 // 556 //
548 // Votekey management 557 // Votekey management