annotate admin.js @ 1037:df54d73bc5a0

Refresh entry status in entry compo listing when adding/deleting/updating.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 20 Nov 2015 07:54:48 +0200
parents 8fecb417e6a9
children 2e1a9b564674
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 // FAPWeb - Simple Web-based Demoparty Management System
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // Party administration page frontend module
1001
ffacd904fd1f Update copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 990
diff changeset
4 // (C) Copyright 2012-2015 Tecnic Software productions (TNSP)
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
7 var activeAttendee = -1, prevAttendee = -1, activeAttendeeTmp = "";
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
8 var activeEntry = -1, prevEntry = -1, activeEntryTmp = "";
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
10 var registeredTabs = Object();
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
11 var activeTabs = Object();
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
13
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
14 //
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
15 // Tab related code
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
16 //
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
17 function jsUpdateTabList(tabset, extra)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
18 {
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
19 var tabs = "";
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
20 var content = "";
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
21
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
22 // Update the tab header list for this tabset
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
23 for (var id in registeredTabs[tabset])
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
24 {
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
25 var thead = registeredTabs[tabset][id];
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
26 tabs += "<a id=\"tabHead"+ tabset + id +
920
054b612df423 Fixes ..
Matti Hamalainen <ccr@tnsp.org>
parents: 916
diff changeset
27 "\" href=\"#\" onClick=\"jsSwitchActiveTab('"+tabset+"', '"+id+
054b612df423 Fixes ..
Matti Hamalainen <ccr@tnsp.org>
parents: 916
diff changeset
28 "')\">"+ thead +"</a> ";
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
29
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
30 content += "<div id=\"tabCont"+ tabset + id +"\"></div>";
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
31 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
32
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
33 // Update the DOM elements
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
34 var item = document.getElementById("tabHeaders"+ tabset);
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
35 if (item) item.innerHTML = tabs + extra;
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
36
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
37 item = document.getElementById("tabContents"+ tabset);
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
38 if (item) item.innerHTML = content;
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
39 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
40
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
41
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
42 function jsRegisterTab(tabset, id, name)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
43 {
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
44 // Create tabset object "array" if it does not exist
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
45 if (!registeredTabs[tabset])
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
46 registeredTabs[tabset] = Object();
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
47
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
48 // Register tab
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
49 registeredTabs[tabset][id] = name;
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
50 }
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
51
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
52
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
53 function jsSwitchActiveTab(tabset, tab)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
54 {
756
5eae5148c611 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
55 // Go through all registered tabs to update their state
727
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
56 for (var id in registeredTabs[tabset])
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
57 {
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
58 var tabContent = document.getElementById("tabCont"+ tabset + id);
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
59 var tabHead = document.getElementById("tabHead"+ tabset + id);
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
60 if (tabContent && tabHead)
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
61 {
399603df8c6f Move tab-related code from majax module to admin.js.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
62 tabContent.style.display = (tab == id) ? "block" : "none";
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 //
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
413 function refreshEntryCompos()
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
414 {
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
415 setTimeout("refreshDispatchCC('Entries');", 50);
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
416 }
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
417
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
418
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
419 function activateEntry(id, force)
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
420 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
421 var msuccess1 = function(txt)
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 var nitem = document.getElementById("entry"+prevEntry);
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
424 if (nitem)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
425 {
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
426 nitem.innerHTML = txt;
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
427 nitem.className = activeEntryTmp;
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
428 }
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
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
431 var msuccess2 = function(txt)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
432 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
433 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
434 if (nitem)
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 nitem.innerHTML = txt;
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
437 activeEntryTmp = nitem.className;
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
438 nitem.className += " active";
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
439 activeEntry = id;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
440 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
441 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
442
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
443 if (activeEntry != id || force)
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
444 {
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
445 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
446
682
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
447 prevEntry = activeEntry;
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
448 activeEntry = id;
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 if (prevEntry != -1)
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
451 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
452
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
453 if (activeEntry != -1)
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
454 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
455 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
456 }
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
457
2e54b6858ce9 A tiny bit more work on entry editing.
Matti Hamalainen <ccr@tnsp.org>
parents: 650
diff changeset
458
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
459 function addEntry(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
460 {
750
e46f43a8b8dd Rework entry editing. Still needs cosmetic work, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 727
diff changeset
461 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
462
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
463 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
464
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 var msuccess = function(txt)
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 setTimeout("refreshDispatchCM("+ id +");", 50);
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
468 refreshEntryCompos();
599
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
471 if (args != "")
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
472 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
473
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
474 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
475 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
476
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477
860
bb4a6967ccdd Keep edit state after file upload in updateEntry().
Matti Hamalainen <ccr@tnsp.org>
parents: 857
diff changeset
478 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
479 {
1034
8fecb417e6a9 Reintroduce per-entry preview_type.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
480 var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "compo_id":4, "evalue":2, "preview_type":4}, "en", id, true);
777
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
481 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
482 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
483
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
484 jsCancelUploadCBS();
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
485
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
486 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
487 {
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
488 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
489 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
490 }
9fa68b35b90a Only COMPO_NORMAL compo type sets new compo_id. Handle cases that do not.
Matti Hamalainen <ccr@tnsp.org>
parents: 763
diff changeset
491
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
494 if (cid != compo_id)
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 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
497 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
498 nitem.style.display = "none";
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
499 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
500 else
865
80f6f31d3711 File upload fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 860
diff changeset
501 activateEntry(edit ? id : -1, true);
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
502 refreshEntryCompos();
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
503 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
504
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
505 var mcb_ok = function(data)
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
506 {
860
bb4a6967ccdd Keep edit state after file upload in updateEntry().
Matti Hamalainen <ccr@tnsp.org>
parents: 857
diff changeset
507 jsSendPOSTRequest("action=update&type=entry&id="+id+"&edit="+edit+"&"+args, msuccess);
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
508 refreshEntryCompos();
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
509 }
691
c9d16e2c9725 Comments, cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 685
diff changeset
510
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
511 var mcb_cancel = function(data)
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
512 {
692
5e3c71f6fc02 Improve active entry handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 691
diff changeset
513 activeEntry = -1;
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
514 }
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
515
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
516 if (args != "")
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
517 {
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
518 if (cid != compo_id)
763
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
519 {
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
520 jsConfirmBox("Are you sure you want to change entry #"+id+
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
521 "'s compo from "+cid+" to "+compo_id+"?", mcb_ok, mcb_cancel);
20fd7d2040d1 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 759
diff changeset
522 }
685
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
523 else
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
524 mcb_ok();
b05376c7ece8 Add confirmation for changing entry's compo_id.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
525 }
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
526 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
528
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529 function deleteEntry(cid, id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 {
916
42c3fbca0d86 Possibly address concurrency / switching tabs while uploading.
Matti Hamalainen <ccr@tnsp.org>
parents: 875
diff changeset
531 jsCancelUploadCBS();
1037
df54d73bc5a0 Refresh entry status in entry compo listing when adding/deleting/updating.
Matti Hamalainen <ccr@tnsp.org>
parents: 1034
diff changeset
532 jsDeleteItem(id, "entry", "entries", "refreshDispatchCM("+ cid +");refreshEntryCompos();", "entry");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
535
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
536 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
537 // Votekey management
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
538 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
539 function voteKeyRefresh(id)
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 msuccess2 = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
542 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543 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
544 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545 nitem.className = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
548 var msuccess1 = function(txt)
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 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
551 if (nitem)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
552 nitem.innerHTML = txt;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
553 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
554
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
555 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
556 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
557 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
558
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
559
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560 function voteKeyUpdate(id, type, args)
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 var msuccess = function(txt)
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 voteKeyRefresh(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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567 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
568 }
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 function voteKeySetActive(id)
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 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
574
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
575 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
576 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
577 voteKeyUpdate(id, "active", args);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
578 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
579
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
580 var mcb_cancel = function (data)
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 voteKeyRefresh(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
583 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
584
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
585 if (lastPostArgs["active"] == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
586 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
587 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
588 mcb_ok(0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
592 function voteKeyAssign(id, mode)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594 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
595
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
596 var mcb_ok = function (data)
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 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
599 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
601 if (mode == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
602 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
603 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
604 mcb_ok(0);
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
683
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
608 //
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
609 // Misc functions
ee9461239b47 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 682
diff changeset
610 //
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
611 function performSystemCheck()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
612 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
613 jsSendPOSTRequest("action=check", jsMessageBox);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614 }
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 function generateEntryPositions(id, patch)
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 var msuccess = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621 refreshDispatchCM(id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
623 refreshCurrEntryListData();
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626 var mcb_ok = function (data)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
627 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
628 if (id == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
629 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
630 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
631 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
632 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
633
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
634 if (patch == 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
635 {
990
0a8cb8f9f555 Add a bigger warning.
Matti Hamalainen <ccr@tnsp.org>
parents: 977
diff changeset
636 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
637 (id == 0 ? "for ALL compos" : "for this compo") +"? "+
990
0a8cb8f9f555 Add a bigger warning.
Matti Hamalainen <ccr@tnsp.org>
parents: 977
diff changeset
638 "<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
639 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
640 else
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
641 mcb_ok(0);
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 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 // Competition control
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648 function setShowMode(mode)
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 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
651 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
654 function refreshCurrEntryData()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 {
867
74ee30f5b34d Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 865
diff changeset
656 jsRefreshItems("ctrlCurrCompoData", "infoCurrCompoData", "");
599
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
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 function 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 jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663 refreshCurrEntryData();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
664 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
665
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
666
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
667 function activateCompo()
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 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
670 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
671
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
672
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
673 function setSelectedEntry()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
674 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675 jsSendPOSTRequest("action=ctrl&type=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
676 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
678
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
679 function switchEntry(dir)
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 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
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 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
686 // Rotation list editing and handling
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
687 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
688 function 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 jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
691 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
692
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
693
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
694 function refreshRotationListEdit(id)
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 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
697 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
698 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
699
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
700
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
701 function refreshActiveRotationList()
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 jsRefreshItems("ctrlActiveRotationList", "infoActiveRotationList", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
704 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
705
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
706
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
707 function setRotateDuration()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
708 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
709 var duration = jsGetValue("ctrlRotSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
710 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
711 }
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 function setActiveRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
715 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
716 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
717 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
718 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
719 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
720 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
721 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
722
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 function updateRotationList(id)
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 var name = jsGetValue("ctrlEDRotationListName", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
727 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
728 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
729
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
730
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
731 function moveRotationListSlide(list_id, dir)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
732 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
733 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
734 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
735 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
736 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
737
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
738 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
739 if (slide)
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 var str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
742 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
743 "&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
744 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
745 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
746 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
747 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
748
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
749
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
750 function addRotationListSlide(list_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
751 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
752 var msuccess = function(txt)
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 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
755 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
756
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
757 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
758 if (slide_id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
759 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
760 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
761 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
762 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
763
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
764
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
765 function removeRotationListSlide(list_id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
766 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
767 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
768 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
769 refreshRotationListEdit(list_id);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
770 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
771
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
772 var slide = jsGetValue("ctrlEDRotationListSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
773 if (slide)
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 var str = slide.split("_");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
776 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
777 "&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
778 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
779 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
780 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
781 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
782
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
783
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
784 function editRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
785 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
786 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
787 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
788 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
789 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
790 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
794 function newRotationList()
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 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
797 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
798 refreshRotationListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
799 jsOpenAdminPopup(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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
802 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
803 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
804
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
805
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
806 function deleteRotationList()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
807 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
808 var mcb_ok = function(txt)
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 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
811 }
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 var id = jsGetValue("ctrlRotationListsSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
814 if (id > 0)
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 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
817 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
818 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
819 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
820 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
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 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
825 // Display slide editing and handling
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
826 //
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
827 function refreshDisplaySlideListSel()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
828 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
829 jsRefreshItems("ctrlDisplaySlidesSel", "infoDisplaySlides", "");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
830 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
831
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
832
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
833 function updateDisplaySlide(id)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
834 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
835 var vtitle = jsGetValue("ctrlDisplaySlideTitle", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
836 var vtext = jsGetValue("ctrlDisplaySlideText", 1);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
837 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
838 jsCloseAdminPopup();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
839 return false;
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
840 }
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 function editDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
844 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
845 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
846 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
847 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
848 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
849 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
853 function copyDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
854 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
855 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
856 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
857 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
858 jsOpenAdminPopup(txt);
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
861 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
862 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
863 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
864 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
865 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
866 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
867
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
868
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
869 function newDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
870 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
871 var msuccess = function(txt)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
872 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
873 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
874 jsOpenAdminPopup(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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
877 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
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
881 function deleteDisplaySlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
882 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
883 var msuccess = function(txt)
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 refreshDisplaySlideListSel();
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
886 refreshRotationListSel();
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
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
889 var mcb_ok = function(txt)
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 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
892 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
893
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
894 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
895 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
896 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
897 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
898 mcb_ok, 0, 0);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
899 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
900 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
901 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
902 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
903
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 function activateTempSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
906 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
907 var id = jsGetValue("ctrlDisplaySlidesSel", 4);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
908 var duration = jsGetValue("ctrlTempSlideDuration", 2);
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
909 if (id > 0)
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
910 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
911 else
857
70a8d52a8d00 Add new helper function jsErrorMessageBox() and use it where appropriate.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
912 jsErrorMessageBox("No slide selected?");
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
913 }
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
914
618
0508fb0c1304 Improve deletion warnings in admin interface.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
915
599
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
916 function skipToNextSlide()
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
917 {
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
918 jsSendPOSTRequest("action=ctrl&type=skipToNextSlide");
eebbc96d7fe5 Move javascript code from admin.php to a separate file.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
919 }