annotate show.php @ 383:2c61dc1e659d

Add missing include.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 04 Dec 2013 19:48:55 +0200
parents 3175ec252c73
children 357b81e39ab3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 //
136
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 132
diff changeset
3 // FAPWeb Simple Demoparty System
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 132
diff changeset
4 // Party information display system
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 132
diff changeset
5 // (C) Copyright 2012-2013 Tecnic Software productions (TNSP)
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 //
175
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 174
diff changeset
7 require_once "mconfig.inc.php";
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 174
diff changeset
8 require_once "msite.inc.php";
383
2c61dc1e659d Add missing include.
Matti Hamalainen <ccr@tnsp.org>
parents: 342
diff changeset
9 require_once "msession.inc.php";
175
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 174
diff changeset
10 require_once "majax.php";
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
180
a3f0f2a3551a Split stylesheets into separate files for different platforms and also split
Matti Hamalainen <ccr@tnsp.org>
parents: 175
diff changeset
12 $pageCSS["show.css"] = "";
a3f0f2a3551a Split stylesheets into separate files for different platforms and also split
Matti Hamalainen <ccr@tnsp.org>
parents: 175
diff changeset
13
174
63c840590476 Move common code from mcommon.inc.php to msitegen module.
Matti Hamalainen <ccr@tnsp.org>
parents: 164
diff changeset
14 cmLocaleInit();
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 stSetupCacheControl();
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
17 cmPrintPageHeader("PARTY INFORMATION DISPLAY SYSTEM", "", FALSE);
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
18 stCommonAJAX("showajax.php", "show.php", TRUE);
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 ?>
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
20
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
21 <!-- ========================== -->
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 <noscript>
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
24 <div class="notice">
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
25 <h1>Javascript required</h1>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
26 <p>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
27 The compo system page requires Javascript to be enabled for the AJAX functionality.
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
28 <br />
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
29 <a href="#">Please enable Javascript and reload this page</a>.
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
30 </p>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
31 </div>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
32 </noscript>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
33
146
672c7f28fb97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
34 <div class="showView" id="mainView"></div>
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
35
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
36 <!-- ========================== -->
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
37
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 <script type="text/javascript">
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
39
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
40 var failCount = 0;
146
672c7f28fb97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
41 var lastUpdate = 0;
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
42 var errorView = false;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
43
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
44
142
d2e9285b69ad More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
45 function updateView(txt)
d2e9285b69ad More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
46 {
146
672c7f28fb97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
47 var view = document.getElementById("mainView");
200
4db14e5338d7 Better checks in show module.
Matti Hamalainen <ccr@tnsp.org>
parents: 180
diff changeset
48 if (view && txt != false && txt != "")
142
d2e9285b69ad More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
49 view.innerHTML = txt;
d2e9285b69ad More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
50 }
d2e9285b69ad More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
51
d2e9285b69ad More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
52
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
53 function displayError()
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
54 {
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
55 // Increase failure count
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
56 if (++failCount > 5 && !errorView)
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
57 {
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
58 errorView = true;
233
261e5244ac27 Improve "Guru Meditation".
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
59 updateView("<div class=\"guru\">Software Failure.&nbsp;&nbsp;&nbsp;Press left mouse button to continue.<br />Guru Meditation #00000004.0000AAC0</div>");
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
60 }
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
61 }
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
62
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
63
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
64 //
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
65 // Update view when triggered by main tick
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
66 //
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
67 function viewChanged()
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
68 {
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
69 var msuccess2 = function(txt)
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
70 {
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
71 // Successfully fetched new data, initiate view update
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
72 updateView(txt);
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
73 }
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
74
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
75 var msuccess1 = function(txt)
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
76 {
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
77 lastUpdate = txt;
342
3175ec252c73 Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents: 233
diff changeset
78 jsSendPOSTRequest("action=get&type=slide", msuccess2, displayError);
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
79 }
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
80
342
3175ec252c73 Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents: 233
diff changeset
81 jsSendPOSTRequest("action=get&type=update", msuccess1, displayError);
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
82 }
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
83
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
84
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
85 //
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
86 // Main tick function, check for updates from server
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
87 //
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
88 var timeOutSet = false;
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
89
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
90 function tickMain()
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
91 {
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
92 timeOutSet = false;
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
93
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
94 var msuccess = function(txt)
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
95 {
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
96 failCount = 0;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
97 if (txt == "changed")
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
98 {
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
99 viewChanged();
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
100 if (!timeOutSet)
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
101 {
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
102 setTimeout("tickMain();", 500);
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
103 timeOutSet = true;
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
104 }
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
105 }
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
106 else
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
107 {
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
108 if (!timeOutSet)
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
109 {
146
672c7f28fb97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
110 setTimeout("tickMain();", 5000);
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
111 timeOutSet = true;
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
112 }
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
113 }
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
114 }
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
115
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
116 var mfail = function(txt)
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
117 {
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
118 displayError();
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
119 if (!timeOutSet)
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
120 {
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
121 setTimeout("tickMain();", 5000);
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
122 timeOutSet = true;
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
123 }
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
124 }
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
125
342
3175ec252c73 Rename sendPOSTRequest() to jsSendPOSTRequest().
Matti Hamalainen <ccr@tnsp.org>
parents: 233
diff changeset
126 jsSendPOSTRequest("action=check&lastUpdate="+lastUpdate, msuccess, mfail);
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
127 }
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
128
146
672c7f28fb97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
129 setTimeout("tickMain();", 100);
142
d2e9285b69ad More work on the party info system.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
130 viewChanged();
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
131
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 </script>
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 <?
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 cmPrintPageFooter(FALSE);
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 ?>