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