annotate admin.js @ 1067:82ecea33c477

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