annotate admin.js @ 684:3be02474f849

Remove some obsolete superfluous functions.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 09 Nov 2014 19:01:43 +0200
parents ee9461239b47
children b05376c7ece8
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;
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
8 var activeEntry = -1, prevEntry = -1;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 var activeTmp = "";
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 function jsCloseAdminPopup()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 var nitem = document.getElementById("adminPopup");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 nitem.innerHTML = "";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 nitem.style.display = "none";
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 function jsOpenAdminPopup(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 var nitem = document.getElementById("adminPopup");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 nitem.style.display = "block";
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 function jsRefreshItems(id,name,extra)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 var nitem = document.getElementById(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 if (nitem) nitem.innerHTML = txt;
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 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
43 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
46 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
47 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 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
51 item.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 setTimeout(func, 50);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 // 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
56 var item = document.getElementById(prefix+id);
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
57 var tmp = item.className;
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
58 item.className += " deleteWarning";
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 // Ask confirmation for deletion
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 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
64 item.className = tmp;
599
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 var mcb_cancel = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 {
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
69 item.className = tmp;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
72 if (dsc)
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
73 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
74 else
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
75 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
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
632
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
79 function jsRefreshPanels(id, tab, args, set_default)
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
80 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
81 var msuccess = function(txt)
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
82 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
83 var nitem = document.getElementById(tab);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
84 if (nitem)
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
85 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
86 if (nitem.innerHTML == "")
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
87 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
88 nitem.innerHTML =
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
89 "<div id=\"tabHeaders"+id+"\" class=\"tabHeadersSub\"></div>" +
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
90 "<div id=\"tabContents"+id+"\" class=\"tabContentsSub\"></div>";
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
91 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
92
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
93 try {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
94 var tmp = JSON.parse("{"+ txt +"}");
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
95 registeredTabs[id] = tmp;
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
96 jsUpdateTabList(id, "");
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
97 if (activeTabs[id])
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
98 jsSwitchActiveTab(id, activeTabs[id]);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
99 else
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
100 if (set_default == "*")
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
101 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
102 for (var nid in registeredTabs[id])
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
103 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
104 jsSwitchActiveTab(id, nid);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
105 break;
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
106 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
107 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
108 else
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
109 if (set_default != "")
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
110 jsSwitchActiveTab(id, set_default);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
111 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
112 catch (err) {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
113 jsMessageBox("JSON.parse("+ txt +") failure: "+ err);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
114 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
115 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
116 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
117
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
118 jsSendPOSTRequest("action=get&type="+args, msuccess);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
119 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
120
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
121
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 function refreshDispatchCC(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 switch (id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 {
602
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
126 case "News" : jsRefreshItems("tabContCCNews", "news", ""); break;
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
127 case "Attendees" : jsRefreshItems("tabContCCAttendees", "attendees", ""); activeAttendee = -1; break;
602
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
128 case "Voting" : jsRefreshItems("tabContCCVoting", "voters", ""); break;
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
129 case "Compos" : jsRefreshItems("tabContCCCompos", "compos", ""); break;
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
130 case "InfoSys" : jsRefreshItems("tabContCCInfoSys", "infoMain", ""); break;
684
3be02474f849 Remove some obsolete superfluous functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 683
diff changeset
131 case "Settings" : jsRefreshPanels("CS", "tabContCCSettings", "settingslist", "*"); break;
3be02474f849 Remove some obsolete superfluous functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 683
diff changeset
132 case "Entries" : jsRefreshPanels("CM", "tabContCCEntries", "compolist", ""); break;
599
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
624
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
137 function refreshDispatchCS(id)
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
138 {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
139 jsRefreshItems("tabContCS"+ id, "settings", "&id="+ id);
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
140 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
141
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
142
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 function refreshCCAttendee(id)
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 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
146 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147
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 function refreshCMEntry(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 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
152 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 function refreshDispatchCM(id)
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 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
158 }
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 function addNews()
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 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
164
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 var msuccess = function(txt)
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 setTimeout("refreshDispatchCC('News');", 50);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 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
172
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 return false;
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
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 function deleteNews(id)
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 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
180 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 function updateNews(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 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
187
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 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
191 }
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 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 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
195 }
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
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
198 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
199 // Visitor/attendee management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
200 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 function addAttendee()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 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
204
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 setTimeout("refreshDispatchCC('Attendees');", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 }
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 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 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
212
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 return false;
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 function deleteAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 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
220 }
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 function updateAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 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
226
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 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
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 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 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
234 }
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 function activateAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 var msuccess1 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241 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
242 if (nitem)
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 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 nitem.style.background = activeTmp;
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 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 var msuccess2 = function(txt)
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 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
252 if (nitem)
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 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 activeTmp = nitem.style.background;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 nitem.style.background = "green";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 activeAttendee = id;
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 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 if (activeAttendee != id)
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 prevAttendee = activeAttendee;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 activeAttendee = id;
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 if (prevAttendee != -1)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 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
268
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 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
270 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
274 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
275 // Compo management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
276 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 function addCompo()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 var args = jsMakePostArgs({"name":1, "description":1}, "nc", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 setTimeout("refreshDispatchCC('Compos');", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 jsSendPOSTRequest("action=add&type=compo&"+args, msuccess);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291
644
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
292 function updateCompoType(id)
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
293 {
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
294 var msuccess = function(txt)
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
295 {
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
296 jsRefreshItems("compo"+id, "compo", "&id="+id);
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
297 }
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
298
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
299 jsSendPOSTRequest("action=update&type=compotype&id="+id+"&ctype="+jsGetValue("cotype"+id+"Sel", 4), msuccess);
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
300 }
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
301
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
302
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 function updateCompo(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 {
650
1005de5ee3f0 Add nofail argument to jsMakePostArgs() to ignore unfound DOM elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 644
diff changeset
305 var args = jsMakePostArgs({"name":1, "description":1, "visible":3, "voting":3, "show_authors":3, "cpath":1}, "co", id, true);
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 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
310 }
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 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 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
314 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
317 function deleteCompo(id)
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
318 {
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
319 jsDeleteItem(id, "compo", "compo", "refreshDispatchCC('Compos');", 0,
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
320 "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
321 "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
322 }
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
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
325 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
326 // Entry management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
327 //
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
328 function activateEntry(id)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
329 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
330 var msuccess1 = function(txt)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
331 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
332 var nitem = document.getElementById("entry"+prevEntry);
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
333 if (nitem)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
334 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
335 nitem.innerHTML = txt;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
336 nitem.style.background = activeTmp;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
337 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
338 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
339
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
340 var msuccess2 = function(txt)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
341 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
342 var nitem = document.getElementById("entry"+id);
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
343 if (nitem)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
344 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
345 nitem.innerHTML = txt;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
346 activeTmp = nitem.style.background;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
347 nitem.style.background = "green";
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
348 activeEntry = id;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
349 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
350 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
351
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
352 if (activeEntry != id)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
353 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
354 prevEntry = activeEntry;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
355 activeEntry = id;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
356
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
357 if (prevEntry != -1)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
358 jsSendPOSTRequest("action=get&type=entry&id="+prevEntry+"&edit=0", msuccess1);
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
359
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
360 jsSendPOSTRequest("action=get&type=entry&id="+id+"&edit=1", msuccess2);
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
361 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
362 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
363
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
364
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 function addEntry(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 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
368
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371 setTimeout("refreshDispatchCM("+ id +");", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 }
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 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375 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
376
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
378 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381 function updateEntry(cid, id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 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
384 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
385
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 if (cid != compo_id)
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 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
391 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392 nitem.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
395 setTimeout("refreshCMEntry("+ id +");", 50);
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 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
403 function deleteEntry(cid, id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
404 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405 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
406 }
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
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
409 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
410 // Votekey management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
411 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412 function voteKeyRefresh(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414 var msuccess2 = function(txt)
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 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
417 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
418 nitem.className = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
420
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421 var msuccess1 = function(txt)
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 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
424 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
425 nitem.innerHTML = txt;
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428 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
429 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433 function voteKeyUpdate(id, type, args)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
435 var msuccess = function(txt)
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 voteKeyRefresh(id);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 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
441 }
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 function voteKeySetActive(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446 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
447
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 voteKeyUpdate(id, "active", args);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
451 }
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 var mcb_cancel = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
455 voteKeyRefresh(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
456 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
457
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
458 if (lastPostArgs["active"] == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
459 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
460 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
461 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
462 }
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 function voteKeyAssign(id, mode)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
466 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
467 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
468
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469 var mcb_ok = function (data)
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 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
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 if (mode == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
475 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
476 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
478 }
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
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
481 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
482 // Misc functions
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
483 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
484 function performSystemCheck()
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 jsSendPOSTRequest("action=check", jsMessageBox);
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
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 function generateEntryPositions(id, patch)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
491 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492 var msuccess = function (data)
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 refreshDispatchCM(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496 refreshCurrEntryListData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
497 }
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 var mcb_ok = function (data)
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 if (id == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
502 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
503 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
504 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
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 if (patch == 0)
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 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
510 (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
511 "<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
512 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
513 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514 mcb_ok(0);
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
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 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
519 // Competition control
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 function setShowMode(mode)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
522 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523 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
524 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
525
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 function refreshCurrEntryData()
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 jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", "");
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
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 function refreshCurrEntryListData()
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 jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
536 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
537 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
538
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 function activateCompo()
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 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
543 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546 function setSelectedEntry()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
548 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
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 switchEntry(dir)
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 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
555 }
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 // Rotation list editing and handling
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 function refreshRotationListSel()
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 jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", "");
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567 function refreshRotationListEdit(id)
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 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
570 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
571 }
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
574 function refreshActiveRotationList()
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 jsRefreshItems("ctrlActiveRotationList", "infoActiveRotationList", "");
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
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 function setRotateDuration()
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 var duration = jsGetValue("ctrlRotSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
583 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
584 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
585
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
586
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
587 function setActiveRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
588 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591 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
592 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 jsMessageBox("No rotation list selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
596
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
597 function updateRotationList(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 var name = jsGetValue("ctrlEDRotationListName", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600 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
601 }
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
604 function moveRotationListSlide(list_id, dir)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
607 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608 refreshRotationListEdit(list_id);
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 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
612 if (slide)
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 str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
615 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
616 "&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
617 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 jsMessageBox("No slide selected?");
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
623 function addRotationListSlide(list_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
627 refreshRotationListEdit(list_id);
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 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
631 if (slide_id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
632 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
633 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
634 jsMessageBox("No slide selected?");
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
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 function removeRotationListSlide(list_id)
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 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
641 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
642 refreshRotationListEdit(list_id);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
645 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 if (slide)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648 var str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
649 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
650 "&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
651 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653 jsMessageBox("No slide selected?");
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
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 function editRotationList()
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 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
660 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
661 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
662 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663 jsMessageBox("No rotation list selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
664 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
665
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
666
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
667 function newRotationList()
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 var msuccess = function(txt)
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 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
672 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
673 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
674
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675 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
676 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
678
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
679 function deleteRotationList()
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 var mcb_ok = function(txt)
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 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
684 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
685
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
686 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
687 if (id > 0)
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 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
690 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
691 }
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 rotation list 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 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
698 // Display slide editing and handling
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
699 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
700 function refreshDisplaySlideListSel()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
701 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
702 jsRefreshItems("ctrlDisplaySlidesSel", "infoDisplaySlides", "");
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
706 function updateDisplaySlide(id)
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 var vtitle = jsGetValue("ctrlDisplaySlideTitle", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
709 var vtext = jsGetValue("ctrlDisplaySlideText", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
710 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
711 jsCloseAdminPopup();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
712 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
713 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
714
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 function editDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
717 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
718 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
719 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
720 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
721 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
722 jsMessageBox("No display slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
723 }
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
726 function copyDisplaySlide()
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 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
729 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
730 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
731 jsOpenAdminPopup(txt);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
734 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
735 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
736 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
737 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
738 jsMessageBox("No display slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
739 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
740
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
741
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
742 function newDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
743 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
744 var msuccess = function(txt)
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 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
747 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
748 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
749
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
750 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
751 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
752
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
753
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
754 function deleteDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
755 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
756 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
757 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
758 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
759 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
760 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
761
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
762 var mcb_ok = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
763 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
764 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
765 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
766
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
767 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
768 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
769 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
770 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
771 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
772 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
773 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
774 jsMessageBox("No display slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
775 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
776
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
777
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
778 function activateTempSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
779 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
780 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
781 var duration = jsGetValue("ctrlTempSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
782 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
783 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
784 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
785 jsMessageBox("No slide selected?");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
786 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
787
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
788
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
789 function skipToNextSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
790 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
791 jsSendPOSTRequest("action=ctrl&type=skipToNextSlide");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
792 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
793