annotate admin.js @ 990:0a8cb8f9f555

Add a bigger warning.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 29 Nov 2014 20:03:33 +0200
parents a1da651a2e45
children ffacd904fd1f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 // FAPWeb - Simple Web-based Demoparty Management System
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // Party administration page frontend module
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 // (C) Copyright 2012-2014 Tecnic Software productions (TNSP)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
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";
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
63 tabHead.style.borderTop = (tab == id) ? "4px solid white" : "none";
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 {
977
a1da651a2e45 Add compo notes field.
Matti Hamalainen <ccr@tnsp.org>
parents: 920
diff changeset
364 var args = jsMakePostArgs({"name":1, "description":1, "notes":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
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 function updateCompo(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389 {
977
a1da651a2e45 Add compo notes field.
Matti Hamalainen <ccr@tnsp.org>
parents: 920
diff changeset
390 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
391
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394 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
395 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398 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
399 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
401
608
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
402 function deleteCompo(id)
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
403 {
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
404 jsDeleteItem(id, "compo", "compo", "refreshDispatchCC('Compos');", 0,
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
405 "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
406 "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
407 }
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
408
7d676c77e3f8 Add functionality for deleting a compo.
Matti Hamalainen <ccr@tnsp.org>
parents: 602
diff changeset
409
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
410 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
411 // Entry management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
412 //
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
413 function activateEntry(id, force)
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
414 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
415 var msuccess1 = function(txt)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
416 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
417 var nitem = document.getElementById("entry"+prevEntry);
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
418 if (nitem)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
419 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
420 nitem.innerHTML = txt;
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
421 nitem.className = activeEntryTmp;
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
422 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
423 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
424
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
425 var msuccess2 = function(txt)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
426 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
427 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
428 if (nitem)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
429 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
430 nitem.innerHTML = txt;
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
431 activeEntryTmp = nitem.className;
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
432 nitem.className += " active";
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
433 activeEntry = id;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
434 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
435 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
436
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
437 if (activeEntry != id || force)
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
438 {
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
439 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
440
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
441 prevEntry = activeEntry;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
442 activeEntry = id;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
443
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
444 if (prevEntry != -1)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
445 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
446
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
447 if (activeEntry != -1)
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
448 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
449 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
450 }
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
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
453 function addEntry(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454 {
750
e46f43a8b8dd Rework entry editing. Still needs cosmetic work, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 727
diff changeset
455 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
456
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
457 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
458
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
459 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
460 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
461 setTimeout("refreshDispatchCM("+ id +");", 50);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
462 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
463
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
464 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 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
466
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
467 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
468 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470
860
bb4a6967ccdd Keep edit state after file upload in updateEntry().
Matti Hamalainen <ccr@tnsp.org>
parents: 857
diff changeset
471 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
472 {
849
d0b6daedd21c Remove per entry preview_type, I don't think it is needed after all.
Matti Hamalainen <ccr@tnsp.org>
parents: 777
diff changeset
473 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "compo_id":4, "evalue":2}, "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
474 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
475 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
476
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
477 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
478
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
479 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
480 {
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
481 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
482 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
483 }
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
484
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
485 var msuccess = function(txt)
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 if (cid != compo_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
488 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
489 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
490 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
491 nitem.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 else
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
494 activateEntry(edit ? id : -1, true);
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
497 var mcb_ok = function(data)
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
498 {
860
bb4a6967ccdd Keep edit state after file upload in updateEntry().
Matti Hamalainen <ccr@tnsp.org>
parents: 857
diff changeset
499 jsSendPOSTRequest("action=update&type=entry&id="+id+"&edit="+edit+"&"+args, msuccess);
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
500 }
691
c9d16e2c9725 Comments, cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 685
diff changeset
501
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
502 var mcb_cancel = function(data)
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
503 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
504 activeEntry = -1;
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
505 }
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
506
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
507 if (args != "")
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
508 {
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
509 if (cid != compo_id)
763
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
510 {
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
511 jsConfirmBox("Are you sure you want to change entry #"+id+
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
512 "'s compo from "+cid+" to "+compo_id+"?", mcb_ok, mcb_cancel);
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
513 }
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
514 else
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
515 mcb_ok();
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
516 }
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
518
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
519
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
520 function deleteEntry(cid, id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521 {
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
522 jsCancelUploadCBS();
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523 jsDeleteItem(id, "entry", "entries", "refreshDispatchCM("+ cid +");", "entry");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
524 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
525
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
526
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
527 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
528 // Votekey management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
529 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 function voteKeyRefresh(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
531 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532 var msuccess2 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534 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
535 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
536 nitem.className = txt;
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 var msuccess1 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
540 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541 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
542 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543 nitem.innerHTML = txt;
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 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
547 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
548 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
549
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
550
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
551 function voteKeyUpdate(id, type, args)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
552 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
553 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
554 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
555 voteKeyRefresh(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
556 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
557
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
558 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
559 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
561
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562 function voteKeySetActive(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
563 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
564 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
565
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
566 var mcb_ok = function (data)
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 voteKeyUpdate(id, "active", args);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
569 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
570
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
571 var mcb_cancel = function (data)
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 voteKeyRefresh(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
574 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
575
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
576 if (lastPostArgs["active"] == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
577 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
578 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
579 mcb_ok(0);
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
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 function voteKeyAssign(id, mode)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
584 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
585 var 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
586
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
587 var mcb_ok = function (data)
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 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
590 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
592 if (mode == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 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
594 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595 mcb_ok(0);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
598
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
599 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
600 // Misc functions
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
601 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
602 function performSystemCheck()
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 jsSendPOSTRequest("action=check", jsMessageBox);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
607
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608 function generateEntryPositions(id, patch)
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 var msuccess = function (data)
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 refreshDispatchCM(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
613 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614 refreshCurrEntryListData();
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 if (id == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620 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
621 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 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
623 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625 if (patch == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626 {
990
0a8cb8f9f555 Add a bigger warning.
Matti Hamalainen <ccr@tnsp.org>
parents: 977
diff changeset
627 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
628 (id == 0 ? "for ALL compos" : "for this compo") +"? "+
990
0a8cb8f9f555 Add a bigger warning.
Matti Hamalainen <ccr@tnsp.org>
parents: 977
diff changeset
629 "<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
630 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
631 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
632 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
633 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
634
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
635
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
636 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
637 // Competition control
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 function setShowMode(mode)
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 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
642 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
643
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
644
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
645 function refreshCurrEntryData()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 {
867
74ee30f5b34d Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 865
diff changeset
647 jsRefreshItems("ctrlCurrCompoData", "infoCurrCompoData", "");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
649
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
650
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
651 function refreshCurrEntryListData()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653 jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
654 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
656
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
657
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
658 function activateCompo()
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 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
661 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
662
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
664 function setSelectedEntry()
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 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
667 }
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 function switchEntry(dir)
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 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
673 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
674
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
676 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677 // Rotation list editing and handling
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
678 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
679 function refreshRotationListSel()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
680 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
681 jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
682 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
683
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 function refreshRotationListEdit(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
686 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
687 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
688 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
689 }
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 function refreshActiveRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
693 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
694 jsRefreshItems("ctrlActiveRotationList", "infoActiveRotationList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
695 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
696
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
697
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
698 function setRotateDuration()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
699 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
700 var duration = jsGetValue("ctrlRotSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
701 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
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 setActiveRotationList()
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 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
708 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
709 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
710 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
711 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
712 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
713
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
714
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
715 function updateRotationList(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
716 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
717 var name = jsGetValue("ctrlEDRotationListName", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
718 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
719 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
720
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
721
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
722 function moveRotationListSlide(list_id, dir)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
723 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
724 var msuccess = function(txt)
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 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
727 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
728
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
729 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
730 if (slide)
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 var str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
733 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
734 "&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
735 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
736 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
737 jsErrorMessageBox("No slide selected?");
599
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
741 function addRotationListSlide(list_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
742 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
743 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
744 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
745 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
746 }
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 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
749 if (slide_id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
750 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
751 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
752 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
753 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
754
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 function removeRotationListSlide(list_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
757 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
758 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
759 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
760 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
761 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
762
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
763 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
764 if (slide)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
765 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
766 var str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
767 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
768 "&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
769 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
770 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
771 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
772 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
773
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 function editRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
776 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
777 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
778 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
779 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
780 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
781 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
782 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
783
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
784
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
785 function newRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
786 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
787 var msuccess = function(txt)
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 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
790 jsOpenAdminPopup(txt);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
791 }
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 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
794 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
795
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 function deleteRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
798 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
799 var mcb_ok = function(txt)
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 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
802 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
803
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
804 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
805 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
806 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
807 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
808 mcb_ok, 0, 0);
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 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
811 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
812 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
813
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
814
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
815 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
816 // Display slide editing and handling
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 function refreshDisplaySlideListSel()
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 jsRefreshItems("ctrlDisplaySlidesSel", "infoDisplaySlides", "");
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
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 function updateDisplaySlide(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
825 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
826 var vtitle = jsGetValue("ctrlDisplaySlideTitle", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
827 var vtext = jsGetValue("ctrlDisplaySlideText", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
828 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
829 jsCloseAdminPopup();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
830 return false;
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
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 function editDisplaySlide()
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 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
837 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
838 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
839 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
840 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
841 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
842
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
843
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
844 function copyDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
845 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
846 var msuccess = function(txt)
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 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
849 jsOpenAdminPopup(txt);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
852 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
853 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
854 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
855 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
856 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
860 function newDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
861 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
862 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
863 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
864 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
865 jsOpenAdminPopup(txt);
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 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
869 }
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
872 function deleteDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
873 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
874 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
875 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
876 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
877 refreshRotationListSel();
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
880 var mcb_ok = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
881 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
882 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
883 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
884
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
885 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
886 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
887 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
888 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
889 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
890 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
891 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
892 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
896 function activateTempSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
897 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
898 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
899 var duration = jsGetValue("ctrlTempSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
900 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
901 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
902 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
903 jsErrorMessageBox("No slide selected?");
599
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
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
906
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
907 function skipToNextSlide()
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 jsSendPOSTRequest("action=ctrl&type=skipToNextSlide");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
910 }