annotate admin.js @ 1062:7135c7b18bb9

Add linefeed.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 17 Nov 2016 14:20:00 +0200
parents fb5a468e647d
children 82ecea33c477
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
1001
ffacd904fd1f Update copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 990
diff changeset
4 // (C) Copyright 2012-2015 Tecnic Software productions (TNSP)
599
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
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
7 var activeAttendee = -1, prevAttendee = -1, activeAttendeeTmp = "";
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
8 var activeEntry = -1, prevEntry = -1, activeEntryTmp = "";
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
10 var registeredTabs = Object();
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
11 var activeTabs = Object();
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
13
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
14 //
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
15 // Tab related code
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
16 //
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
17 function jsUpdateTabList(tabset, extra)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
18 {
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
19 var tabs = "";
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
20 var content = "";
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
21
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
22 // Update the tab header list for this tabset
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
23 for (var id in registeredTabs[tabset])
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
24 {
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
25 var thead = registeredTabs[tabset][id];
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
26 tabs += "<a id=\"tabHead"+ tabset + id +
920
054b612df423 Fixes ..
Matti Hamalainen <ccr@tnsp.org>
parents: 916
diff changeset
27 "\" href=\"#\" onClick=\"jsSwitchActiveTab('"+tabset+"', '"+id+
054b612df423 Fixes ..
Matti Hamalainen <ccr@tnsp.org>
parents: 916
diff changeset
28 "')\">"+ thead +"</a> ";
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
29
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
30 content += "<div id=\"tabCont"+ tabset + id +"\"></div>";
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
31 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
32
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
33 // Update the DOM elements
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
34 var item = document.getElementById("tabHeaders"+ tabset);
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
35 if (item) item.innerHTML = tabs + extra;
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
36
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
37 item = document.getElementById("tabContents"+ tabset);
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
38 if (item) item.innerHTML = content;
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
39 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
40
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
41
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
42 function jsRegisterTab(tabset, id, name)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
43 {
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
44 // Create tabset object "array" if it does not exist
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
45 if (!registeredTabs[tabset])
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
46 registeredTabs[tabset] = Object();
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
47
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
48 // Register tab
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
49 registeredTabs[tabset][id] = name;
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
50 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
51
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
52
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
53 function jsSwitchActiveTab(tabset, tab)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
54 {
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
55 // Go through all registered tabs to update their state
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
56 for (var id in registeredTabs[tabset])
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
57 {
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
58 var tabContent = document.getElementById("tabCont"+ tabset + id);
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
59 var tabHead = document.getElementById("tabHead"+ tabset + id);
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
60 if (tabContent && tabHead)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
61 {
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
62 tabContent.style.display = (tab == id) ? "block" : "none";
1047
8a50535a4ff1 Use stylesheet for admin interface active/inactive tab differentiation
Matti Hamalainen <ccr@tnsp.org>
parents: 1041
diff changeset
63 tabHead.className = (tab == id) ? "active" : "inactive";
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
64 if (tab == id)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
65 {
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
66 // Set active tab and refresh contents
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
67 activeTabs[tabset] = id;
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
68 setTimeout("refreshDispatch"+ tabset +"('"+ id +"');", 10);
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
69 jsCancelUploadCBS();
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
70 }
757
3622720909c4 Clear inactive tab DOM node when changing active tab.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
71 else
3622720909c4 Clear inactive tab DOM node when changing active tab.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
72 {
3622720909c4 Clear inactive tab DOM node when changing active tab.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
73 // Clear inactive tabs
3622720909c4 Clear inactive tab DOM node when changing active tab.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
74 tabContent.innerHTML = "";
3622720909c4 Clear inactive tab DOM node when changing active tab.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
75 }
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
76 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
77 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
78 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
79
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
80
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
81 //
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
82 // Admin interface specific popups
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
83 //
875
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
84 function jsHandleAdminPopupKeys(ev)
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
85 {
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
86 ev = ev || window.event;
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
87 var key = ev.keyCode ? ev.keyCode : ev.which;
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
88 if (key == 27)
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
89 {
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
90 jsCloseAdminPopup();
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
91 return false;
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
92 }
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
93 else
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
94 return true;
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
95 }
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
96
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
97
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 function jsCloseAdminPopup()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 var nitem = document.getElementById("adminPopup");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 {
875
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
103 document.onkeydown = null;
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
104
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 nitem.innerHTML = "";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 nitem.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 function jsOpenAdminPopup(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 var nitem = document.getElementById("adminPopup");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 {
875
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
116 document.onkeydown = jsHandleAdminPopupKeys;
920e33605102 Add esc cancel/close to admin popups as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 867
diff changeset
117
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 nitem.style.display = "block";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
124 //
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
125 // Generic element refresh
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
126 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 function jsRefreshItems(id,name,extra)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 var nitem = document.getElementById(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 if (nitem) nitem.innerHTML = txt;
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 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
136 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
139 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
140 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 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
144 item.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 setTimeout(func, 50);
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 // 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
149 var item = document.getElementById(prefix+id);
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
150 var tmp = item.className;
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
151 item.className += " deleteWarning";
599
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 // Ask confirmation for deletion
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 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
157 item.className = tmp;
599
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 var mcb_cancel = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 {
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
162 item.className = tmp;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
165 if (dsc)
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
166 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
167 else
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
168 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
169 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171
632
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
172 function jsRefreshPanels(id, tab, args, set_default)
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
173 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
174 var msuccess = function(txt)
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
175 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
176 var nitem = document.getElementById(tab);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
177 if (nitem)
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
178 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
179 if (nitem.innerHTML == "")
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
180 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
181 nitem.innerHTML =
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
182 "<div id=\"tabHeaders"+id+"\" class=\"tabHeadersSub\"></div>" +
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
183 "<div id=\"tabContents"+id+"\" class=\"tabContentsSub\"></div>";
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
184 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
185
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
186 try {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
187 var tmp = JSON.parse("{"+ txt +"}");
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
188 registeredTabs[id] = tmp;
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
189 jsUpdateTabList(id, "");
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
190 if (activeTabs[id])
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
191 jsSwitchActiveTab(id, activeTabs[id]);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
192 else
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
193 if (set_default == "*")
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
194 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
195 for (var nid in registeredTabs[id])
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
196 {
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
197 jsSwitchActiveTab(id, nid);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
198 break;
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
199 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
200 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
201 else
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
202 if (set_default != "")
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
203 jsSwitchActiveTab(id, set_default);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
204 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
205 catch (err) {
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
206 jsErrorMessageBox("JSON.parse("+ txt +") failure: "+ err);
632
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
207 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
208 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
209 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
210
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
211 jsSendPOSTRequest("action=get&type="+args, msuccess);
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
212 }
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
213
e06be145e487 Modularize a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
214
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 function refreshDispatchCC(id)
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 switch (id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 {
602
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
219 case "News" : jsRefreshItems("tabContCCNews", "news", ""); break;
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
220 case "Attendees" : jsRefreshItems("tabContCCAttendees", "attendees", ""); activeAttendee = -1; break;
602
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
221 case "Voting" : jsRefreshItems("tabContCCVoting", "voters", ""); break;
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
222 case "Compos" : jsRefreshItems("tabContCCCompos", "compos", ""); break;
00fbc876f535 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 599
diff changeset
223 case "InfoSys" : jsRefreshItems("tabContCCInfoSys", "infoMain", ""); break;
684
3be02474f849 Remove some obsolete superfluous functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 683
diff changeset
224 case "Settings" : jsRefreshPanels("CS", "tabContCCSettings", "settingslist", "*"); break;
3be02474f849 Remove some obsolete superfluous functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 683
diff changeset
225 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
226 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229
624
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
230 function refreshDispatchCS(id)
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
231 {
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
232 jsRefreshItems("tabContCS"+ id, "settings", "&id="+ id);
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
233 }
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
234
aad32d21091f Some work on settings groups.
Matti Hamalainen <ccr@tnsp.org>
parents: 618
diff changeset
235
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 function refreshDispatchCM(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
238 prevEntry = activeEntry = -1;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 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
240 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242
691
c9d16e2c9725 Comments, cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 685
diff changeset
243 //
c9d16e2c9725 Comments, cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 685
diff changeset
244 // Site news management
c9d16e2c9725 Comments, cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 685
diff changeset
245 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246 function addNews()
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 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
249
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 setTimeout("refreshDispatchCC('News');", 50);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 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
257
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 return false;
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 function deleteNews(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 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
265 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 function updateNews(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 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
271
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 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
275 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 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
279 }
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
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
282 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
283 // Visitor/attendee management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
284 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 function addAttendee()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 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
288
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 var msuccess = function(txt)
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 setTimeout("refreshDispatchCC('Attendees');", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 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
296
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 function deleteAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 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
304 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 function updateAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 {
716
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
309 var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1,"reghost":1}, "at", id);
599
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 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
313 activateAttendee(-1);
599
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 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 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
318 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321 function activateAttendee(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 var msuccess1 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
324 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325 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
326 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328 nitem.innerHTML = txt;
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
329 nitem.className = activeAttendeeTmp;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 var msuccess2 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
335 var nitem = document.getElementById("attendee"+activeAttendee);
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338 nitem.innerHTML = txt;
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
339 activeAttendeeTmp = nitem.className;
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
340 nitem.className += " active";
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341 activeAttendee = id;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
342 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 if (activeAttendee != id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347 prevAttendee = activeAttendee;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 activeAttendee = id;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 if (prevAttendee != -1)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 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
352
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
353 if (activeAttendee != -1)
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
354 jsSendPOSTRequest("action=get&type=attendee&id="+activeAttendee+"&edit=1", msuccess2);
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
356 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
359 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
360 // Compo management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
361 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362 function addCompo()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 {
1048
178ed843b6c2 No need for notes field in compo addition.
Matti Hamalainen <ccr@tnsp.org>
parents: 1047
diff changeset
364 var args = jsMakePostArgs({"name":1, "description":1}, "nc", "");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368 setTimeout("refreshDispatchCC('Compos');", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 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
373 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
374 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376
644
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
377 function updateCompoType(id)
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
378 {
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
379 var msuccess = function(txt)
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
380 {
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
381 jsRefreshItems("compo"+id, "compo", "&id="+id);
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
382 }
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
383
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
384 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
385 }
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
386
de35a9743557 Implement changing of compo type.
Matti Hamalainen <ccr@tnsp.org>
parents: 640
diff changeset
387
1052
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
388 function updateCompoVoting(id)
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
389 {
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
390 var msuccess = function(txt)
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
391 {
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
392 jsRefreshItems("covoting"+id, "compovoting", "&id="+id);
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
393 }
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
394
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
395 jsSendPOSTRequest("action=update&type=compovoting&id="+id+"&voting="+jsGetValue("covotingbutton"+id, 3), msuccess);
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
396 }
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
397
fb5a468e647d Implement compo voting enable/disable in entry pages.
Matti Hamalainen <ccr@tnsp.org>
parents: 1048
diff changeset
398
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 function updateCompo(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400 {
977
a1da651a2e45 Add compo notes field.
Matti Hamalainen <ccr@tnsp.org>
parents: 920
diff changeset
401 var args = jsMakePostArgs({"name":1, "description":1, "notes":1, "visible":3, "voting":3, "show_authors":3, "cpath":1, "preview_type":4}, "co", id, true);
599
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 var msuccess = function(txt)
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 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
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 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 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
410 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
413 function deleteCompo(id)
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
414 {
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
415 jsDeleteItem(id, "compo", "compo", "refreshDispatchCC('Compos');", 0,
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
416 "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
417 "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
418 }
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
419
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
420
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
421 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
422 // Entry management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
423 //
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
424 function refreshEntryCompos()
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
425 {
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
426 setTimeout("refreshDispatchCC('Entries');", 50);
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
427 }
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
428
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
429
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
430 function activateEntry(id, force)
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
431 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
432 var msuccess1 = function(txt)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
433 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
434 var nitem = document.getElementById("entry"+prevEntry);
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
435 if (nitem)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
436 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
437 nitem.innerHTML = txt;
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
438 nitem.className = activeEntryTmp;
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
439 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
440 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
441
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
442 var msuccess2 = function(txt)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
443 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
444 var nitem = document.getElementById("entry"+activeEntry);
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
445 if (nitem)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
446 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
447 nitem.innerHTML = txt;
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
448 activeEntryTmp = nitem.className;
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
449 nitem.className += " active";
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
450 activeEntry = id;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
451 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
452 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
453
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
454 if (activeEntry != id || force)
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
455 {
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
456 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
457
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
458 prevEntry = activeEntry;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
459 activeEntry = id;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
460
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
461 if (prevEntry != -1)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
462 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
463
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
464 if (activeEntry != -1)
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
465 jsSendPOSTRequest("action=get&type=entry&id="+activeEntry+"&edit=1", msuccess2);
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
466 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
467 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
468
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
469
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470 function addEntry(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
471 {
750
e46f43a8b8dd Rework entry editing. Still needs cosmetic work, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 727
diff changeset
472 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "evalue":2}, "ne", id, true);
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
473
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
474 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
475
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
476 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
478 setTimeout("refreshDispatchCM("+ id +");", 50);
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
479 refreshEntryCompos();
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
480 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
481
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
482 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
483 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
484
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
485 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
486 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
487
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
488
860
bb4a6967ccdd Keep edit state after file upload in updateEntry().
Matti Hamalainen <ccr@tnsp.org>
parents: 857
diff changeset
489 function updateEntry(cid, id, edit)
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
490 {
1034
8fecb417e6a9 Reintroduce per-entry preview_type.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
491 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "compo_id":4, "evalue":2, "preview_type":4}, "en", id, true);
777
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
492 var has_id = "compo_id" in lastPostArgs;
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 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
494
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
495 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
496
777
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
497 if (!("compo_id" in lastPostArgs))
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
498 {
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
499 args += "&compo_id=" + cid;
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
500 compo_id = cid;
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
501 }
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
502
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
503 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
504 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
505 if (cid != compo_id)
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 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
508 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
509 nitem.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
510 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
511 else
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
512 activateEntry(edit ? id : -1, true);
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
513 refreshEntryCompos();
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
515
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
516 var mcb_ok = function(data)
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
517 {
860
bb4a6967ccdd Keep edit state after file upload in updateEntry().
Matti Hamalainen <ccr@tnsp.org>
parents: 857
diff changeset
518 jsSendPOSTRequest("action=update&type=entry&id="+id+"&edit="+edit+"&"+args, msuccess);
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
519 refreshEntryCompos();
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
520 }
691
c9d16e2c9725 Comments, cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 685
diff changeset
521
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
522 var mcb_cancel = function(data)
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
523 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
524 activeEntry = -1;
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
525 }
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
526
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527 if (args != "")
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
528 {
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
529 if (cid != compo_id)
763
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
530 {
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
531 jsConfirmBox("Are you sure you want to change entry #"+id+
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
532 "'s compo from "+cid+" to "+compo_id+"?", mcb_ok, mcb_cancel);
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
533 }
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
534 else
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
535 mcb_ok();
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
536 }
599
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 deleteEntry(cid, id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541 {
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
542 jsCancelUploadCBS();
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
543 jsDeleteItem(id, "entry", "entries", "refreshDispatchCM("+ cid +");refreshEntryCompos();", "entry");
599
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
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
547 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
548 // Votekey management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
549 //
1038
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
550 function voteKeyInfoRefresh()
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
551 {
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
552 jsRefreshItems("vkeyInfo", "votekey", "info");
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
553 }
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
554
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
555
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
556 function voteKeyRefresh(id)
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 var msuccess2 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
559 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560 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
561 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562 nitem.className = txt;
1038
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
563 voteKeyInfoRefresh();
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
564 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
565
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
566 var msuccess1 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
568 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
569 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
570 nitem.innerHTML = txt;
1038
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
571 voteKeyInfoRefresh();
599
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 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
575 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
576 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
577
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
578
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
579 function voteKeyUpdate(id, type, args)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
580 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
581 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
582 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
583 voteKeyRefresh(id);
1038
2e1a9b564674 Add votekey information blurb.
Matti Hamalainen <ccr@tnsp.org>
parents: 1037
diff changeset
584 voteKeyInfoRefresh();
599
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 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
588 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591 function voteKeySetActive(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
592 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 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
594
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595 var mcb_ok = function (data)
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 voteKeyUpdate(id, "active", args);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
598 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600 var mcb_cancel = function (data)
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 voteKeyRefresh(id);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 if (lastPostArgs["active"] == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606 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
607 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
609 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
610
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
611
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
612 function voteKeyAssign(id, mode)
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 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
615
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
616 var mcb_ok = function (data)
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 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
619 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621 if (mode == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 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
623 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
627
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
628 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
629 // Misc functions
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
630 //
1041
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1038
diff changeset
631 function showScreenCmd(str)
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1038
diff changeset
632 {
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1038
diff changeset
633 jsSendPOSTRequest("action=screencmd&cmd="+str);
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1038
diff changeset
634 }
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1038
diff changeset
635
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1038
diff changeset
636
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
637 function performSystemCheck()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
638 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
639 jsSendPOSTRequest("action=check", jsMessageBox);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
640 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
641
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
642
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
643 function generateEntryPositions(id, patch)
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 msuccess = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647 refreshDispatchCM(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
649 refreshCurrEntryListData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
650 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
651
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
654 if (id == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 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
656 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
657 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
658 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
659
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
660 if (patch == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
661 {
990
0a8cb8f9f555 Add a bigger warning.
Matti Hamalainen <ccr@tnsp.org>
parents: 977
diff changeset
662 jsConfirmBox("Are you <b>ABSOLUTELY CERTAIN</b> you want to delete and regenerate entry show positions "+
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663 (id == 0 ? "for ALL compos" : "for this compo") +"? "+
990
0a8cb8f9f555 Add a bigger warning.
Matti Hamalainen <ccr@tnsp.org>
parents: 977
diff changeset
664 "<b>This will completely annihilate current show position numbers! AND FUCK UP YOUR EXPORTED FILE ORDER (ask ccr to know what that means.)</b>", mcb_ok, 0, 0);
599
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 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
667 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
668 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
669
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
670
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
671 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
672 // Competition control
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 function setShowMode(mode)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
676 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
680 function refreshCurrEntryData()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
681 {
867
74ee30f5b34d Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 865
diff changeset
682 jsRefreshItems("ctrlCurrCompoData", "infoCurrCompoData", "");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
683 }
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 function refreshCurrEntryListData()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
687 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
688 jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
689 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
690 }
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
693 function activateCompo()
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 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
699 function setSelectedEntry()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
700 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
701 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
702 }
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 function switchEntry(dir)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
706 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
707 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
708 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
709
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
710
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
711 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
712 // Rotation list editing and handling
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 function refreshRotationListSel()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
715 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
716 jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", "");
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
719
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
720 function refreshRotationListEdit(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
721 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
722 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
723 refreshRotationListSel();
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
727 function refreshActiveRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
728 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
729 jsRefreshItems("ctrlActiveRotationList", "infoActiveRotationList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
730 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
731
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
732
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
733 function setRotateDuration()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
734 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
735 var duration = jsGetValue("ctrlRotSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
736 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
737 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
738
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 function setActiveRotationList()
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 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
743 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
744 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
745 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
746 jsErrorMessageBox("No rotation list selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
747 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
748
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 function updateRotationList(id)
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 var name = jsGetValue("ctrlEDRotationListName", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
753 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
754 }
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
757 function moveRotationListSlide(list_id, dir)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
758 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
759 var msuccess = function(txt)
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 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
762 }
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 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
765 if (slide)
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 str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
768 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
769 "&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
770 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
771 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
772 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
773 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
774
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 function addRotationListSlide(list_id)
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 var msuccess = function(txt)
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 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
781 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
782
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
783 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
784 if (slide_id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
785 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
786 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
787 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
788 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
789
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 function removeRotationListSlide(list_id)
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 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
794 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
795 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
796 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
797
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
798 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
799 if (slide)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
800 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
801 var str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
802 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
803 "&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
804 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
805 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
806 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
807 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
808
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
809
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
810 function editRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
811 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
812 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
813 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
814 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
815 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
816 jsErrorMessageBox("No rotation list selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
817 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
818
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
819
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
820 function newRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
821 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
822 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
823 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
824 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
825 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
826 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
827
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
828 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
829 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
830
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
831
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
832 function deleteRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
833 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
834 var mcb_ok = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
835 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
836 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
837 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
838
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
839 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
840 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
841 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
842 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
843 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
844 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
845 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
846 jsErrorMessageBox("No rotation list selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
847 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
848
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
849
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
850 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
851 // Display slide editing and handling
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
852 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
853 function refreshDisplaySlideListSel()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
854 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
855 jsRefreshItems("ctrlDisplaySlidesSel", "infoDisplaySlides", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
856 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
857
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
858
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
859 function updateDisplaySlide(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
860 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
861 var vtitle = jsGetValue("ctrlDisplaySlideTitle", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
862 var vtext = jsGetValue("ctrlDisplaySlideText", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
863 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
864 jsCloseAdminPopup();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
865 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
866 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
867
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
868
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
869 function editDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
870 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
871 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
872 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
873 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
874 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
875 jsErrorMessageBox("No display slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
876 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
877
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
878
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
879 function copyDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
880 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
881 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
882 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
883 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
884 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
885 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
886
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
887 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
888 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
889 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
890 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
891 jsErrorMessageBox("No display slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
892 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
893
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
894
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
895 function newDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
896 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
897 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
898 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
899 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
900 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
901 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
902
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
903 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
904 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
905
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
906
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
907 function deleteDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
908 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
909 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
910 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
911 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
912 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
913 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
914
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
915 var mcb_ok = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
916 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
917 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
918 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
919
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
920 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
921 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
922 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
923 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
924 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
925 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
926 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
927 jsErrorMessageBox("No display slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
928 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
929
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
930
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
931 function activateTempSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
932 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
933 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
934 var duration = jsGetValue("ctrlTempSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
935 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
936 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
937 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
938 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
939 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
940
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
941
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
942 function skipToNextSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
943 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
944 jsSendPOSTRequest("action=ctrl&type=skipToNextSlide");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
945 }