annotate admin.php @ 174:63c840590476

Move common code from mcommon.inc.php to msitegen module.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 06 Nov 2013 10:21:11 +0200
parents 705dabdc37d4
children 8df523e6326a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
36392d1d6b5f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 30
diff changeset
7 $sessionType = "admin";
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
8 require "mconfig.inc.php";
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
9 require "msite.inc.php";
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
10 require "msession.inc.php";
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
11 require "majax.php";
32
36392d1d6b5f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 30
diff changeset
12
174
63c840590476 Move common code from mcommon.inc.php to msitegen module.
Matti Hamalainen <ccr@tnsp.org>
parents: 171
diff changeset
13 cmLocaleInit();
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
14
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
15 // Switch to https first, if needed
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
16 if (!stCheckHTTPS())
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
17 {
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
18 header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
19 exit;
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
20 }
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
21
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
22 // Start output
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
23 cmPrintPageHeader("FAPWeb Administration",
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
24 " <meta http-equiv=\"Pragma\" content=\"no-cache\" />",
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
25 FALSE);
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
26
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
27 echo "<div id=\"admCont\">\n";
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
28
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
29 // Initiate SQL database connection
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
30 if (!stConnectSQLDB())
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
31 {
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
32 // Error occured, bail out early
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
33 cmPrintPageFooter();
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
34 exit;
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
35 }
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
36
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
37 // Fetch non-"hardcoded" settings from SQL database
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
38 stReloadSettings();
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
39
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
40 function stCreateSettingsData()
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
41 {
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
42 $args = array();
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
43
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
44 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
45 {
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
46 foreach ($res as $item)
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
47 {
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
48 switch ($item["vtype"])
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
49 {
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
50 case VT_STR:
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
51 case VT_TEXT: $type = 0; break;
105
a85f258f6beb Move some things around and modularize the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
52 case VT_INT: $type = 4; break;
14
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
53 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
54 }
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
55 $args[] = "\"".$item["key"]."\":".$type;
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
56 }
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
57 }
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
58
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
59 echo
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
60 "\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
61 "function updateSettings()\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
62 "{\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
63 " var args = makePostArgs({".implode(",", $args)."}, \"st\", \"\");\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
64 " sendPOSTRequest(\"action=update&type=settings&\"+args);\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
65 " return false;\n".
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
66 "}\n";
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
67 }
e36c4d2b09c4 Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
68
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 // Check if sessions are enabled
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
70 if (!stChkSetting("admPassword"))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 {
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
72 echo
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
73 "<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
74 "<p>Better go and prod that, so you get to use the fine admin interface.</p>\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 else
107
6e076b3630a0 Cleanup the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
77 if (!stAdmSessionAuth(FALSE))
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 // Perform authentication if we are not in session already
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
80 echo
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
81 "<h1>Party admin login</h1>\n".
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 "<p>Please use illegal telepathy over HTTP to provide a password to enter the party administration systembolaget.</p>\n".
32
36392d1d6b5f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 30
diff changeset
83 stGetFormStart("admlogin", "admlogin.php").
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 stGetFormHiddenInput("mode", "check")."\n".
32
36392d1d6b5f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 30
diff changeset
85 stGetFormPasswordInput("admpass", "", "")."\n".
36392d1d6b5f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 30
diff changeset
86 stGetFormSubmitInput("submit", "Login").
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 "</form>\n";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 }
107
6e076b3630a0 Cleanup the code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 105
diff changeset
89 else
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 ?>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 <script type="text/javascript">
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 124
diff changeset
93 // <? 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
94
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
95
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
96 function refreshItems(id,name,msgname)
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
97 {
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
98 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
99 {
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
100 var nitem = document.getElementById(id);
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
101 nitem.innerHTML = txt;
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
102 }
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
103
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
104 sendPOSTRequest("action=get&type="+name, msuccess);
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
105 }
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
106
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 function deleteItem(id,prefix,type,func,dsc)
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
109 {
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
110 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
111 {
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
112 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
113 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
114 setTimeout(func, 50);
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
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
117 // 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
118 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
119 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
120 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
121
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
122 // Ask confirmation for deletion
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
123 if (confirm("Are you sure you want to delete "+dsc+" #"+id+"?"))
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
124 {
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
125 // Okay, delete
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
126 sendPOSTRequest("action=delete&type="+type+"&id="+id, msuccess);
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
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
129 // Restore background
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
130 item.style.background = tmp;
986c25c2e2bc Move some relevant javascript code from ajax.js to admin module.
Matti Hamalainen <ccr@tnsp.org>
parents: 107
diff changeset
131 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
134 function refreshSettings()
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
135 {
10
11816aad6967 Start work on settings interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
136 refreshItems("nsettings", "settings", "General settings");
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
137 }
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
138
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
139
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 function refreshNews()
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 refreshItems("nnews", "news", "News list");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 function refreshAttendees()
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 refreshItems("nattendees", "attendees", "Attendees list");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151
86
4684336cec09 Some work.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
152 function refreshVoters()
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 {
86
4684336cec09 Some work.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
154 refreshItems("nvoters", "voters", "Voters list");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 function refreshCompos()
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 refreshItems("ncompos", "compos", "Compo list");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 function refreshEntries()
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 refreshItems("nentries", "entries", "Entry list");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 function addNews()
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 var args = makePostArgs({"title":1,"text":1,"author":1}, "nn", "");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 var msuccess = function(txt)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 {
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
176 setTimeout("refreshNews();", 50);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
179 if (args != "")
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
180 sendPOSTRequest("action=add&type=news&"+args, msuccess);
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
181
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 return false;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 function deleteNews(id)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 deleteItem(id, "news", "news", "refreshNews();", "news item");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
192 function addAttendee()
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
193 {
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
194 var args = makePostArgs({"name":1,"groups":0,"oneliner":0,"email":0}, "ne", "x");
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
195
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
196 var msuccess = function(txt)
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
197 {
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
198 setTimeout("refreshAttendees();", 50);
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
199 }
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
200
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
201 if (args != "")
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
202 sendPOSTRequest("action=add&type=attendees&"+args, msuccess);
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
203
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
204 return false;
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
205 }
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
206
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
207
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 function deleteAttendee(id)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 deleteItem(id, "attendee", "attendees", "refreshAttendees();", "attendee");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 function updateAttendee(id)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 {
52
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
216 var args = makePostArgs({"oneliner":0,"email":0,"active":3}, "at", id);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217
53
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
218 var msuccess = function(txt)
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
219 {
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
220 setTimeout("refreshAttendees();", 50);
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
221 }
71256605546b More work on admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 52
diff changeset
222
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
223 if (args != "")
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
224 sendPOSTRequest("action=update&type=attendees&id="+id+"&"+args, msuccess);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227
52
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
228 function updateAttendee2(id)
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
229 {
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
230 var elem = document.getElementById("atactive"+id);
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
231 if (elem && !elem.checked)
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
232 {
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
233 if (confirm("Are you sure you want deactivate vote ID #"+id+"?"))
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
234 updateAttendee(id);
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
235 else
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
236 setTimeout("refreshAttendees();", 50);
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
237 }
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
238 else
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
239 updateAttendee(id);
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
240 }
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
241
cba0b944da79 Start combining "users" with "attendees".
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
242
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 function addCompo()
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 var args = makePostArgs({"name":1, "description":1}, "nc", "");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 var msuccess = function(txt)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 {
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
249 setTimeout("refreshCompos();", 50);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
252 if (args != "")
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
253 sendPOSTRequest("action=add&type=compo&"+args, msuccess);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 return false;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 function updateCompo(id)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 {
55
4fac95384753 Make visibility of entry authors per compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 53
diff changeset
260 var args = makePostArgs({"name":1, "description":1, "visible":3, "voting":3, "showAuthors":3}, "co", id);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
262 if (args != "")
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
263 sendPOSTRequest("action=update&type=compo&id="+id+"&"+args);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
266
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
267 function addEntry(id)
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
268 {
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
269 var args = makePostArgs({"name":1, "author":1, "filename":0}, "ne", id);
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
270
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
271 var msuccess = function(txt)
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
272 {
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
273 setTimeout("refreshEntries();", 50);
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
274 }
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
275
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
276 if (args != "")
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
277 sendPOSTRequest("action=add&type=entry&compo_id="+id+"&"+args, msuccess);
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
278 return false;
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
279 }
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
280
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
281
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 function updateEntry(id)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 {
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
284 var args = makePostArgs({"name":1, "author":1, "filename":0, "compo_id":2}, "en", id);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285
59
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
286 var msuccess = function(txt)
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
287 {
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
288 setTimeout("refreshEntries();", 50);
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
289 }
e5e38ed4e837 Work on compo entry addition and editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 55
diff changeset
290
61
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
291 if (args != "")
e85ed35585fc Work on attendee editing, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
292 sendPOSTRequest("action=update&type=entry&id="+id+"&"+args, msuccess);
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 function deleteEntry(id)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 deleteItem(id, "entry", "entries", "refreshEntries();", "entry");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 var registeredTabs = Object();
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 function updateTabList()
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 var item = document.getElementById("pageTabs");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 var str = "";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 for (var id in registeredTabs)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 {
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
311 str += "<a id=\"cc"+id+
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
312 "\"href=\"#\" onClick=\"switchActiveTab('"+id+
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
313 "')\">"+registeredTabs[id]+"</a>";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315
32
36392d1d6b5f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 30
diff changeset
316 str += "<a class=\"admin\" href=\"admlogout.php\">Logout</a>";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 item.innerHTML = str;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 function registerTab(id, name)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
324 registeredTabs[id] = name;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
326
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328 function refreshTabs()
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
329 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 for (var id in registeredTabs)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332 setTimeout("refresh"+ registeredTabs[id] +"();", 10);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337 function switchActiveTab(tab)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 for (var id in registeredTabs)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341 var ob = document.getElementById(id);
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
342 var ccob = document.getElementById("cc"+id);
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
343 if (ob && ccob)
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 ob.style.display = (tab == id) ? "block" : "none";
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
346 ccob.style.borderTop = (tab == id) ? "4px solid white" : "none";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347 if (tab == id)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 setTimeout("refresh"+ registeredTabs[id] +"();", 10);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
352 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
353 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
354 </script>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
356 <!-- ========================== -->
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
358 <div id="nstatus">-</div>
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
359
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
360 <div id="pageTabs"></div>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
362 <div id="admin">
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
363 <div>
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
364
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 <!-- ========================== -->
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
367 <div id="tabSettings">
10
11816aad6967 Start work on settings interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
368 <form method="post" action="" onsubmit="return updateSettings()">
11816aad6967 Start work on settings interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
369 <div id="nsettings"></div>
11816aad6967 Start work on settings interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
370 </form>
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
371 </div>
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
372
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
373 <!-- ========================== -->
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
374
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
375 <div id="tabNews">
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
376 <form method="post" action="" onsubmit="return addNews()">
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
377 <input id="nntitle" type="text" size="40" /><br />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
378 <textarea id="nntext" rows="5" cols="60"></textarea><br />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
379 <input id="nnauthor" type="text" value="orgaz" />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
380 <input id="nnadd" type="submit" value=" Add post " />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
381 <input type="button" value=" Clear " onClick="this.form.reset()" />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
382 </form>
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
383 <hr />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
384 <div id="nnews"></div>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
385 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 <!-- ========================== -->
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
389 <div id="tabAttendees">
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
390 <div id="nattendees"></div>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 <!-- ========================== -->
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394
86
4684336cec09 Some work.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
395 <div id="tabVoters">
4684336cec09 Some work.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
396 <div id="nvoters"></div>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 <!-- ========================== -->
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
401 <div id="tabCompos">
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
402 <form method="post" action="" onsubmit="return addCompo()">
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
403 <input id="ncname" type="text" size="64" /><br />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
404 <textarea id="ncdescription" rows="5" cols="60"></textarea><br />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
405 <input id="nccompo" type="submit" value=" Add compo " />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
406 <input type="button" value=" Clear " onClick="this.form.reset()" />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
407 </form>
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
408 <hr />
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
409 <div id="ncompos"></div>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412 <!-- ========================== -->
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
414 <div id="tabEntries">
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
415 <div id="nentries"></div>
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416 </div>
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
418 <!-- ========================== -->
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
420 <div id="tabInfo">
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
421 <div id="ninfo"></div>
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
422 </div>
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
423
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
424 <!-- ========================== -->
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
425
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
426 </div>
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
427 </div>
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
428
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429 <script type="text/javascript">
8
4c5f651aa107 Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
430 registerTab("tabSettings", "Settings");
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
431 registerTab("tabNews", "News");
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
432 registerTab("tabAttendees", "Attendees");
86
4684336cec09 Some work.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
433 registerTab("tabVoters", "Voters");
7
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
434 registerTab("tabCompos", "Compos");
d76020022881 Various fixes, cleanups and improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
435 registerTab("tabEntries", "Entries");
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
436 registerTab("tabInfo", "Party Info");
5
76c3b89d7b11 Improve voting, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
437 updateTabList();
17
b015c0dea42c Minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
438 switchActiveTab("tabSettings");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439 </script>
171
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
440 <?
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
441 }
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
442
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
443 cmPrintPageFooter();
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
444
705dabdc37d4 Move administration interface page to separate layout, to make things less cramped.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
445 ?>