annotate admin.js @ 624:aad32d21091f

Some work on settings groups.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 01 Nov 2014 06:18:17 +0200
parents 0508fb0c1304
children e06be145e487
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 // FAPWeb - Simple Web-based Demoparty Management System
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // Party administration page frontend module
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 // (C) Copyright 2012-2014 Tecnic Software productions (TNSP)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 var activeAttendee = -1, prevAttendee = -1;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 var activeTmp = "";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 function jsCloseAdminPopup()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 var nitem = document.getElementById("adminPopup");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 nitem.innerHTML = "";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 nitem.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 function jsOpenAdminPopup(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 var nitem = document.getElementById("adminPopup");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 nitem.style.display = "block";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 function jsRefreshItems(id,name,extra)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 var nitem = document.getElementById(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 if (nitem) nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 jsSendPOSTRequest("action=get&type="+name+extra, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
45 function jsDeleteItem(id,prefix,type,func,dsc,dsc2)
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 var item = document.getElementById(prefix+id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 item.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 setTimeout(func, 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 // Clearly mark the element when asking confirmation
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 var item = document.getElementById(prefix+id);
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
56 var tmp = item.className;
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
57 item.className += " deleteWarning";
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 // Ask confirmation for deletion
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 jsSendPOSTRequest("action=delete&type="+type+"&id="+id, msuccess);
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
63 item.className = tmp;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 var mcb_cancel = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 {
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
68 item.className = tmp;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
71 if (dsc)
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
72 jsConfirmBox("Are you sure you want to delete "+dsc+" #"+id+"?", mcb_ok, mcb_cancel, 0);
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
73 else
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
74 jsConfirmBox(dsc2, mcb_ok, mcb_cancel, 0);
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 function refreshDispatchCC(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 switch (id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 {
624
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
82 case "Settings" : refreshCCSettings(); break;
602
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
83 case "News" : jsRefreshItems("tabContCCNews", "news", ""); break;
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
84 case "Attendees" : jsRefreshItems("tabContCCAttendees", "attendees", ""); activeAttendee = -1; break;
602
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
85 case "Voting" : jsRefreshItems("tabContCCVoting", "voters", ""); break;
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
86 case "Compos" : jsRefreshItems("tabContCCCompos", "compos", ""); break;
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
87 case "InfoSys" : jsRefreshItems("tabContCCInfoSys", "infoMain", ""); break;
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
88 case "Entries" : refreshCCEntries(); break;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92
624
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
93 function refreshCCSettings()
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
94 {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
95 var msuccess = function(txt)
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
96 {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
97 var nitem = document.getElementById("tabContCCSettings");
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
98 if (nitem)
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
99 {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
100 if (nitem.innerHTML == "")
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
101 {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
102 nitem.innerHTML =
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
103 "<div id=\"tabHeadersCS\" class=\"tabHeadersSub\"></div>" +
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
104 "<div id=\"tabContentsCS\" class=\"tabContentsSub\"></div>";
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
105 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
106
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
107 try {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
108 var tmp = JSON.parse("{"+ txt +"}");
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
109 registeredTabs["CS"] = tmp;
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
110 jsUpdateTabList("CS", "");
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
111 if (activeTabs["CS"])
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
112 jsSwitchActiveTab("CS", activeTabs["CS"]);
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
113 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
114 catch (err) {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
115 jsMessageBox("JSON.parse("+ txt +") failure: "+ err);
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
116 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
117 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
118 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
119
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
120 jsSendPOSTRequest("action=get&type=settingslist", msuccess);
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
121 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
122
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
123
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
124 function refreshDispatchCS(id)
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
125 {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
126 jsRefreshItems("tabContCS"+ id, "settings", "&id="+ id);
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
127 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
128
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
129
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 function refreshCCAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 jsRefreshItems("attendee"+ id, "attendee", "&id="+ id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 function refreshCCEntries()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 var nitem = document.getElementById("tabContCCEntries");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 if (nitem.innerHTML == "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 nitem.innerHTML =
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 "<div id=\"tabHeadersCM\" class=\"tabHeadersSub\"></div>" +
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 "<div id=\"tabContentsCM\" class=\"tabContentsSub\"></div>";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 try {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 var tmp = JSON.parse("{"+ txt +"}");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 registeredTabs["CM"] = tmp;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 jsUpdateTabList("CM", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 if (activeTabs["CM"])
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 jsSwitchActiveTab("CM", activeTabs["CM"]);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 catch (err) {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 jsMessageBox("JSON.parse("+ txt +") failure: "+ err);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 jsSendPOSTRequest("action=get&type=compolist", msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 function refreshCMEntry(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 jsRefreshItems("entry"+ id, "entry", "&id="+ id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 function refreshDispatchCM(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 jsRefreshItems("tabContCM"+ id, "entries", "&id="+ id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 function addNews()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 var args = jsMakePostArgs({"title":1,"text":1,"author":1}, "nn", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 setTimeout("refreshDispatchCC('News');", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 jsSendPOSTRequest("action=add&type=news&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 function deleteNews(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 jsDeleteItem(id, "news", "news", "refreshDispatchCC('News');", "news item");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 function updateNews(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 var args = jsMakePostArgs({"title":1,"text":1,"author":1}, "ne", id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 jsRefreshItems("news"+id, "newsitem", "&id="+id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 jsSendPOSTRequest("action=update&type=news&id="+id+"&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216 function addAttendee()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "ne", "x");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222 setTimeout("refreshDispatchCC('Attendees');", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 jsSendPOSTRequest("action=add&type=attendees&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 function deleteAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 jsDeleteItem(id, "attendee", "attendees", "refreshDispatchCC('Attendees');", "attendee");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 function updateAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "at", id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 jsRefreshItems("attendee"+id, "attendee", "&id="+id+"&edit=1");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 jsSendPOSTRequest("action=update&type=attendees&id="+id+"&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 function activateAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 var msuccess1 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 var nitem = document.getElementById("attendee"+prevAttendee);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260 nitem.style.background = activeTmp;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 var msuccess2 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 var nitem = document.getElementById("attendee"+id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 activeTmp = nitem.style.background;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 nitem.style.background = "green";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 activeAttendee = id;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 if (activeAttendee != id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 prevAttendee = activeAttendee;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 activeAttendee = id;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 if (prevAttendee != -1)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 jsSendPOSTRequest("action=get&type=attendee&id="+prevAttendee+"&edit=0", msuccess1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 jsSendPOSTRequest("action=get&type=attendee&id="+id+"&edit=1", msuccess2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 function addCompo()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 var args = jsMakePostArgs({"name":1, "description":1}, "nc", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 setTimeout("refreshDispatchCC('Compos');", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299 jsSendPOSTRequest("action=add&type=compo&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 function updateCompo(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 var args = jsMakePostArgs({"name":1, "description":1, "visible":3, "voting":3, "show_authors":3}, "co", id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 jsRefreshItems("compo"+id, "compo", "&id="+id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 jsSendPOSTRequest("action=update&type=compo&id="+id+"&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
318 function deleteCompo(id)
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
319 {
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
320 jsDeleteItem(id, "compo", "compo", "refreshDispatchCC('Compos');", 0,
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
321 "Are you ABSOLUTELY sure you want to delete compo #"+id+"? "+
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
322 "This will delete all votes AND entries related to it!");
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
323 }
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
324
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
325
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
326 function addEntry(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1}, "ne", id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
329
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332 setTimeout("refreshDispatchCM("+ id +");", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 jsSendPOSTRequest("action=add&type=entry&compo_id="+id+"&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
342 function updateEntry(cid, id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "compo_id":2}, "en", id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 var compo_id = lastPostArgs["compo_id"];
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 if (cid != compo_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 var nitem = document.getElementById("entry"+ id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
352 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
353 nitem.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
354 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
356 setTimeout("refreshCMEntry("+ id +");", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
359 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 jsSendPOSTRequest("action=update&type=entry&id="+id+"&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
364 function deleteEntry(cid, id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366 jsDeleteItem(id, "entry", "entries", "refreshDispatchCM("+ cid +");", "entry");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 function voteKeyRefresh(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 var msuccess2 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
374 var nitem = document.getElementById("vkey"+id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 nitem.className = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
378
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379 var msuccess1 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381 var nitem = document.getElementById("vkey"+id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
384 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
385
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386 jsSendPOSTRequest("action=get&type=votekey&id="+id, msuccess1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 jsSendPOSTRequest("action=get&type=votekeyclass&id="+id, msuccess2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
390
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391 function voteKeyUpdate(id, type, args)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
395 voteKeyRefresh(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398 jsSendPOSTRequest("action=votekey&type="+type+"&id="+id+"&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
401
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
402 function voteKeySetActive(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
403 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
404 var args = jsMakePostArgs({"active":3}, "vk", id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
406 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
407 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
408 voteKeyUpdate(id, "active", args);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 var mcb_cancel = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413 voteKeyRefresh(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
415
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416 if (lastPostArgs["active"] == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417 jsConfirmBox("Are you sure you want to deactivate vote key #"+id+"?", mcb_ok, mcb_cancel, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
418 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
420 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
423 function voteKeyAssign(id, mode)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
424 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
425 var args = jsMakePostArgs({"key_id":2}, "vk", id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
427 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429 voteKeyUpdate(id, (mode ? "assign" : "clear"), args);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
431
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
432 if (mode == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433 jsConfirmBox("Are you sure you want to clear vote key assign #"+id+"?", mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
435 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
436 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
438
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439 function performSystemCheck()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441 jsSendPOSTRequest("action=check", jsMessageBox);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
444
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 function generateEntryPositions(id, patch)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447 var msuccess = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449 refreshDispatchCM(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
451 refreshCurrEntryListData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
452 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
453
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
455 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
456 if (id == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
457 jsSendPOSTRequest("action=randomize&type=all&patch="+patch, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
458 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
459 jsSendPOSTRequest("action=randomize&type=compo&id="+id+"&patch="+patch, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
460 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
461
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
462 if (patch == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
463 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
464 jsConfirmBox("Are you <b>sure</b> you want to delete and regenerate entry show positions "+
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 (id == 0 ? "for ALL compos" : "for this compo") +"? "+
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
466 "<b>This will completely annihilate current show position numbers!</b>", mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
467 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
468 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
471
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
472
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
473 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
474 // Competition control
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
475 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
476 function setShowMode(mode)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
478 jsSendPOSTRequest("action=ctrl&type=setShowMode&mode="+mode);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
479 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
480
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
481
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
482 function refreshCurrEntryData()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
483 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
484 jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
485 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
486
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
487
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
488 function refreshCurrEntryListData()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
489 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
490 jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
491 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
494
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495 function activateCompo()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
497 jsSendPOSTRequest("action=ctrl&type=setCompoID&id="+jsGetValue("ctrlCompoListSel", 4), refreshCurrEntryListData);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
498 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
499
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
500
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
501 function setSelectedEntry()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
502 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
503 jsSendPOSTRequest("action=ctrl&type=setEntry&index="+jsGetValue("ctrlEntryListSel", 4), refreshCurrEntryData);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
504 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
505
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
506
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
507 function switchEntry(dir)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
508 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
509 jsSendPOSTRequest("action=ctrl&type="+ (dir < 0 ? "prevEntry" : "nextEntry"), refreshCurrEntryListData);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
510 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
511
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
512
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
513 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514 // Rotation list editing and handling
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
515 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
516 function refreshRotationListSel()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
518 jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
519 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
520
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
522 function refreshRotationListEdit(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
524 jsRefreshItems("ctrlRotationListEdit", "infoRotationListEdit", "&id="+id+"&full=0");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
525 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
526 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
528
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529 function refreshActiveRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
531 jsRefreshItems("ctrlActiveRotationList", "infoActiveRotationList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
535 function setRotateDuration()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
536 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
537 var duration = jsGetValue("ctrlRotSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
538 jsSendPOSTRequest("action=ctrl&type=setRotateDuration&duration="+duration);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
539 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
540
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
542 function setActiveRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546 jsSendPOSTRequest("action=ctrl&type=setActiveRotationList&id="+id, refreshActiveRotationList);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
548 jsMessageBox("No rotation list selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
549 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
550
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
551
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
552 function updateRotationList(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
553 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
554 var name = jsGetValue("ctrlEDRotationListName", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
555 jsSendPOSTRequest("action=ctrl&type=updateRotationList&id="+id+"&name="+name, refreshRotationListSel);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
556 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
557
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
558
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
559 function moveRotationListSlide(list_id, dir)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
561 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
563 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
564 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
565
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
566 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567 if (slide)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
568 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
569 var str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
570 jsSendPOSTRequest("action=ctrl&type=moveRotationListSlide&list_id="+list_id+
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
571 "&slide_id="+parseInt(str[0])+"&order_num="+parseInt(str[1])+"&dir="+dir, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
572 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
573 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
574 jsMessageBox("No slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
575 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
576
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
577
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
578 function addRotationListSlide(list_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
579 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
580 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
581 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
582 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
583 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
584
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
585 var slide_id = jsGetValue("ctrlEDDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
586 if (slide_id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
587 jsSendPOSTRequest("action=ctrl&type=addRotationListSlide&list_id="+list_id+"&slide_id="+slide_id, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
588 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589 jsMessageBox("No slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
592
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 function removeRotationListSlide(list_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
596 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
597 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
598 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
601 if (slide)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
602 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
603 var str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
604 jsSendPOSTRequest("action=ctrl&type=removeRotationListSlide&list_id="+list_id+
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 "&slide_id="+parseInt(str[0])+"&order_num="+parseInt(str[1]), msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
607 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608 jsMessageBox("No slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
609 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
610
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
611
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
612 function editRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
613 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
615 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
616 jsSendPOSTRequest("action=get&type=infoRotationListEdit&id="+id, jsOpenAdminPopup);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 jsMessageBox("No rotation list selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 function newRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
623 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
627 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
628 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
629
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
630 jsSendPOSTRequest("action=ctrl&type=newRotationList", msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
631 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
632
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
633
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
634 function deleteRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
635 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
636 var mcb_ok = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
637 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
638 jsSendPOSTRequest("action=ctrl&type=deleteRotationList&id="+id, refreshRotationListSel);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
639 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
640
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
641 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
642 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
643 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
644 jsConfirmBox("Are you <b>sure</b> you want to delete rotation list #"+id+"?",
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
645 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648 jsMessageBox("No rotation list selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
649 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
650
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
651
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653 // Display slide editing and handling
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
654 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 function refreshDisplaySlideListSel()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
656 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
657 jsRefreshItems("ctrlDisplaySlidesSel", "infoDisplaySlides", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
658 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
659
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
660
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
661 function updateDisplaySlide(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
662 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663 var vtitle = jsGetValue("ctrlDisplaySlideTitle", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
664 var vtext = jsGetValue("ctrlDisplaySlideText", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
665 jsSendPOSTRequest("action=ctrl&type=updateDisplaySlide&id="+id+"&title="+vtitle+"&text="+vtext, refreshDisplaySlideListSel);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
666 jsCloseAdminPopup();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
667 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
668 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
669
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
670
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
671 function editDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
672 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
673 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
674 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675 jsSendPOSTRequest("action=get&type=infoDisplaySlideEdit&id="+id, jsOpenAdminPopup);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
676 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677 jsMessageBox("No display slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
678 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
679
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
680
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
681 function copyDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
682 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
683 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
684 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
685 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
686 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
687 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
688
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
689 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
690 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
691 jsSendPOSTRequest("action=ctrl&type=copyDisplaySlide&id="+id, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
692 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
693 jsMessageBox("No display slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
694 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
695
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
696
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
697 function newDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
698 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
699 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
700 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
701 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
702 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
703 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
704
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
705 jsSendPOSTRequest("action=ctrl&type=newDisplaySlide", msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
706 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
707
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
708
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
709 function deleteDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
710 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
711 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
712 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
713 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
714 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
715 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
716
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
717 var mcb_ok = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
718 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
719 jsSendPOSTRequest("action=ctrl&type=deleteDisplaySlide&id="+id, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
720 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
721
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
722 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
723 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
724 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
725 jsConfirmBox("Are you <b>sure</b> you want to delete slide list #"+id+"?",
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
726 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
727 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
728 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
729 jsMessageBox("No display slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
730 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
731
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
732
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
733 function activateTempSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
734 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
735 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
736 var duration = jsGetValue("ctrlTempSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
737 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
738 jsSendPOSTRequest("action=ctrl&type=setTempSlide&id="+id+"&duration="+duration, jsMessageBox);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
739 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
740 jsMessageBox("No slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
741 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
742
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
743
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
744 function skipToNextSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
745 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
746 jsSendPOSTRequest("action=ctrl&type=skipToNextSlide");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
747 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
748