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