annotate show.php @ 132:0436079bcf46

Some preliminary work on the compo system.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 22 Oct 2013 19:02:30 +0300
parents 71c35d5302c2
children aeebfedb5709
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 //
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // Entry display / show helper module
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 //
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 require "mconfig.inc.php";
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 require "msite.inc.php";
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 require "mcommon.inc.php";
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
8 require "majax.php";
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 stSetupCacheControl();
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 // Initiate SQL database connection
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 if (!stConnectSQLDB())
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 die("Could not connect to SQL database.");
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 // Fetch non-"hardcoded" settings from SQL database
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 stReloadSettings();
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
19 cmPrintPageHeader("PARTY DISPLAY", "", FALSE);
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
20 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
21 ?>
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
22
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
23 <!-- ========================== -->
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 <noscript>
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
26 <div class="notice">
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
27 <h1>Javascript required</h1>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
28 <p>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
29 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
30 <br />
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
31 <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
32 </p>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
33 </div>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
34 </noscript>
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
35
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
36 <div class="showView" id="mainView0">
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
37 <div class="showHeader">
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
38 <img src="img/fapsm.png" />
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
39 </div>
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
40 <div class="showText">
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
41 <h1>Next up</h1>
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
42 <h2>4k intro competition</h2>
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
43 </div>
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
44 </div>
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
45
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
46 <div class="showView" id="mainView1">
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 </div>
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
48
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
49 <!-- ========================== -->
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
50
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 <script type="text/javascript">
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
52
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
53 var failCount = 0;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
54 var prevView = -1, activeView = 0;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
55 var errorView = false;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
56
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 function tickAnim()
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
59 {
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
60 if (activeView != prevView)
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
61 {
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
62 document.getElementById("mainView0").style.display = (activeView == 0) ? "block" : "none";
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
63 document.getElementById("mainView1").style.display = (activeView == 1) ? "block" : "none";
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
64 prevView = activeView;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
65 }
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
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
68
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
69 function displayError()
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 // Increase failure count
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
72 if (++failCount > 5 && !errorView)
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 errorView = true;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
75 updateView("... error ...");
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
76 }
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
77 }
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
78
132
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
79
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
80 //
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
81 // Update view when triggered by main tick
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 function viewChanged()
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 var msuccess = function(txt)
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
86 {
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
87 // Successfully fetched new data, initiate view update
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
88 failCount = 0;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
89 errorView = false;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
90 updateView(txt);
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
91 }
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
92
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
93 sendPOSTRequest("mode=get", msuccess, displayError);
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
94 }
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
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
97 //
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
98 // 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
99 //
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
100 function tickMain()
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
101 {
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
102 var msuccess = function(txt)
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
103 {
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
104 failCount = 0;
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
105 if (txt == "changed")
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
106 viewChanged();
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
107 }
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
108
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
109 sendPOSTRequest("mode=check", msuccess, displayError);
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
110 }
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
111
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
112
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
113 setTimeout("tickMain();", 500);
0436079bcf46 Some preliminary work on the compo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
114 setTimeout("tickAnim();", 20);
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 125
diff changeset
115
125
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 </script>
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 <?
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 cmPrintPageFooter(FALSE);
f364b50e07f7 Some preliminary work on a potential "compo system announcement whatnot
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 ?>