annotate showajax.php @ 1120:b2bca5f6d0ff default tip

Cosmetic cleanup: remove trailing whitespace.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 13 Dec 2020 13:47:13 +0200
parents 0a2117349f46
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1071
76e11ae923a7 Use long tags.
Matti Hamalainen <ccr@tnsp.org>
parents: 1041
diff changeset
1 <?php
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 //
571
ce11ea112a65 Change the header blurb a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 565
diff changeset
3 // FAPWeb - Simple Web-based Demoparty Management System
136
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 126
diff changeset
4 // Party information display system AJAX backend module
1072
7da8bde9b7be Bump copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 1071
diff changeset
5 // (C) Copyright 2012-2017 Tecnic Software productions (TNSP)
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 //
175
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
7 require_once "mconfig.inc.php";
8df523e6326a User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents: 163
diff changeset
8 require_once "msite.inc.php";
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
10
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
11 function stPrintCompoEntry($entry, $class, $compo, $title = FALSE)
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
12 {
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
13 echo
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
14 " <div class=\"".$class."\">\n";
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
15
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
16 if ($title !== FALSE)
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
17 echo
387
3cc078b17260 Show backend work.
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
18 " <div class=\"entryTitle\">".$title."</div>\n";
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
19
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
20 echo
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
21 " <div class=\"entryIndex\">#".$entry["show_id"]."</div>\n".
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
22 " <div class=\"entryName\">".chentities($entry["name"])."</div>\n";
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
23
542
8c1a53532be0 Rename various database tables and column names for better SQL compatibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
24 if ($compo["show_authors"])
387
3cc078b17260 Show backend work.
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
25 {
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
26 if ($title === FALSE)
387
3cc078b17260 Show backend work.
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
27 echo " <div class=\"entryBy\">by</div>\n";
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
28 echo " <div class=\"entryAuthor\">".chentities($entry["author"])."</div>\n";
387
3cc078b17260 Show backend work.
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
29 }
3cc078b17260 Show backend work.
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
30
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
31 if ($title === FALSE)
498
e7566fafe9b1 Use common formatting conversion for entry info texts.
Matti Hamalainen <ccr@tnsp.org>
parents: 497
diff changeset
32 echo " <div class=\"entryInfo\">".stConvertCommonDesc($entry["info"], TRUE)."</div>\n";
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
33
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
34 echo
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
35 " </div>\n";
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
36 }
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
37
163
1386a7a8816c Whitespace cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
38
140
20ca8edfb01a Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 139
diff changeset
39 function stPrintCompoSlide($compo, $entry, $prev)
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
40 {
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
41 echo
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
42 " <div class=\"compoHeader\">\n".
736
e1d5c3e19930 Work a bit on the party info display code.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
43 " <div class=\"compoHeaderDiv\"></div>\n".
e1d5c3e19930 Work a bit on the party info display code.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
44 " <div class=\"compoTitle\">".chentities($compo["name"])." competition</div>\n".
e1d5c3e19930 Work a bit on the party info display code.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
45 " </div>\n";
e1d5c3e19930 Work a bit on the party info display code.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
46
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
47 if ($entry === FALSE && $prev === FALSE)
736
e1d5c3e19930 Work a bit on the party info display code.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
48 echo "<div class=\"compoStarting\">... Is about to start ...</div>";
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
49
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
50 if ($entry !== FALSE)
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
51 stPrintCompoEntry($entry, "compoNext", $compo, FALSE);
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
52
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
53 if ($prev !== FALSE)
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
54 stPrintCompoEntry($prev, "compoPrev", $compo, "Previous entry");
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
55 }
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
56
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
57
923
36741dbb4528 Improve show mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
58 function stPrintRotationSlide($data)
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
59 {
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
60 echo
931
2181d07bcbc0 Rename some CSS classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 923
diff changeset
61 " <div class=\"slideHeader\">\n".
2181d07bcbc0 Rename some CSS classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 923
diff changeset
62 " <div class=\"slideHeaderDiv\"></div>\n".
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
63 " </div>\n".
931
2181d07bcbc0 Rename some CSS classes.
Matti Hamalainen <ccr@tnsp.org>
parents: 923
diff changeset
64 " <div class=\"slideText\">\n".
923
36741dbb4528 Improve show mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
65 $data.
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
66 " </div>\n";
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
67 }
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
68
163
1386a7a8816c Whitespace cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
69
391
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
70 function stGuruMeditation()
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
71 {
923
36741dbb4528 Improve show mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
72 stPrintRotationSlide(
391
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
73 "<div class=\"guru\">".
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
74 "Software Failure.&nbsp;&nbsp;&nbsp;Press left mouse button to continue.<br />".
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
75 "Guru Meditation #00000004.0000AAC0".
923
36741dbb4528 Improve show mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
76 "</div>\n");
391
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
77 }
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
78
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
79
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
80 //
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
81 // Initialize
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
82 //
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 stSetupCacheControl();
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 if (!stConnectSQLDB())
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 die("Could not connect to SQL database.");
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
88 stReloadDisplayVars();
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
89
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
90
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
91 //
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
92 // Check if the slide needs updating?
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
93 //
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
94 $updated = FALSE;
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
95
152
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
96 // Temporary slides are handled globally
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
97 if (stGetDisplayVar("tempDuration") > 0 &&
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
98 stGetDisplayVar("tempSlide") > 0 &&
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
99 stGetDisplayVar("tempSlideSet"))
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
100 {
542
8c1a53532be0 Rename various database tables and column names for better SQL compatibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
101 $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d",
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
102 stGetDisplayVar("tempSlide"));
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
103
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
104 if (($res = stFetchSQL($sql)) !== FALSE)
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
105 {
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
106 stSetDisplayVar("tempSlideSet", FALSE);
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
107 stSetDisplayVar("activeSlideMode", SMODE_ROTATE);
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
108 stSetDisplayVar("activeSlide", stGetDisplayVar("tempSlide"));
438
48903fd966cd Things are starting to work.
Matti Hamalainen <ccr@tnsp.org>
parents: 429
diff changeset
109 stSetDisplayVar("activeSlideExpire", time() + (stGetDisplayVar("tempDuration") * 60));
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
110 $updated = TRUE;
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
111 }
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
112 }
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
113 else
152
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
114 // Otherwise we act according to global show mode
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
115 switch (stGetDisplayVar("showMode"))
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
116 {
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
117 case SMODE_ROTATE:
152
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
118 //
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
119 // Rotation / normal slide show mode
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
120 //
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
121 stSetDisplayVar("activeSlideMode", SMODE_ROTATE);
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
122
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
123 if (stGetDisplayVar("rotateList") == 0)
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
124 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
125 stSetDisplayVar("rotateList", 1);
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
126 stSetDisplayVar("activeSlideExpire", 0);
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
127 $updated = TRUE;
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
128 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
129
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
130 if (time() >= stGetDisplayVar("activeSlideExpire") &&
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
131 stGetDisplayVar("rotateList") > 0)
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
132 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
133 // Get list of slides from active rotation list
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
134 $list = stGetDisplayVar("rotateList");
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
135 $sql = stPrepareSQL(
542
8c1a53532be0 Rename various database tables and column names for better SQL compatibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
136 "SELECT * FROM rot_list_slides WHERE list_id=%d ORDER BY order_num,id",
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
137 $list);
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
138
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
139 if (($slideList = stExecSQL($sql)) !== FALSE)
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
140 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
141 // Get slide at current index
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
142 $slides = array();
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
143 foreach ($slideList as $slide)
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
144 $slides[] = $slide;
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
145
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
146 $index = stGetDisplayVar("rotateListIndex");
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
147 if (count($slides) > $index)
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
148 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
149 $slide_id = $slides[$index]["slide_id"];
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
150 if ($slide_id != stGetDisplayVar("activeSlide"))
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
151 {
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
152 stSetDisplayVar("activeSlide", $slide_id);
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
153 stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("rotateDuration"));
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
154 $updated = TRUE;
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
155 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
156 }
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
157
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
158 // Rotate to next slide
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
159 if (++$index >= count($slides))
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
160 $index = 0;
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
161
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
162 stSetDisplayVar("rotateListIndex", $index);
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
163 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
164 }
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
165 break;
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
166
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
167 case SMODE_COMPO:
152
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
168 //
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
169 // Competition mode, is controlled from admin UI, so we donẗ
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
170 // actually do anything here.
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
171 //
387
3cc078b17260 Show backend work.
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
172 if (time() >= stGetDisplayVar("activeSlideExpire"))
497
570120074b3c Set updated flag in case the mode has changed and slide expires.
Matti Hamalainen <ccr@tnsp.org>
parents: 496
diff changeset
173 {
387
3cc078b17260 Show backend work.
Matti Hamalainen <ccr@tnsp.org>
parents: 386
diff changeset
174 stSetDisplayVar("activeSlideMode", SMODE_COMPO);
497
570120074b3c Set updated flag in case the mode has changed and slide expires.
Matti Hamalainen <ccr@tnsp.org>
parents: 496
diff changeset
175 $updated = TRUE;
570120074b3c Set updated flag in case the mode has changed and slide expires.
Matti Hamalainen <ccr@tnsp.org>
parents: 496
diff changeset
176 }
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
177 break;
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
178
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
179 case SMODE_DISABLED:
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
180 if (stGetDisplayVar("activeSlideMode") != SMODE_DISABLED)
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
181 {
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
182 stSetDisplayVar("activeSlideMode", SMODE_DISABLED);
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
183 $updated = TRUE;
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
184 }
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
185 break;
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
186 }
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187
152
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
188 // Check if we need to update the "last updated" timestamp
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
189 if ($updated)
407
eaea1ae2bc3d Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
190 stDisplayUpdated();
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
191
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
192
152
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
193 //
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
194 // Serve the request
6e6fba2da3d1 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 148
diff changeset
195 //
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 143
diff changeset
196 $type = stGetRequestItem("type");
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 143
diff changeset
197 switch (stGetRequestItem("action"))
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 {
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
199 case "check":
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
200 // Check if there has been any change
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
201 $changed = stGetRequestItem("lastUpdate") != stGetDisplayVar("lastUpdate");
1041
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
202 if (stGetDisplayVar("screenCmdSet"))
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
203 {
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
204 echo stGetDisplayVar("screenCmd");
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
205 stSetDisplayVar("screenCmdSet", FALSE);
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
206 }
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
207 else
f188caaedf0f Implement force reloading of show screen web-page.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
208 echo $changed ? "changed" : "nochange";
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 break;
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
211 case "get":
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 143
diff changeset
212 switch ($type)
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 {
145
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
214 case "update":
66b485431cac Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
215 echo stGetDisplayVar("lastUpdate");
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
216 break;
144
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 143
diff changeset
217
c030c3cf0d80 More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents: 143
diff changeset
218 case "slide":
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
219 // Based on the currently active mode ...
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
220 switch (stGetDisplayVar("activeSlideMode"))
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
221 {
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
222 case SMODE_ROTATE:
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
223 // Slide rotation mode, display currently active slide
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
224 if (stGetDisplayVar("activeSlide") > 0)
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
225 {
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
226 $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d",
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
227 stGetDisplayVar("activeSlide"));
409
Matti Hamalainen <ccr@tnsp.org>
parents: 407
diff changeset
228
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
229 if (($slide = stFetchSQL($sql)) !== FALSE)
923
36741dbb4528 Improve show mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 802
diff changeset
230 stPrintRotationSlide($slide["text"]);
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
231 }
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
232 else
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
233 stGuruMeditation();
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
234 break;
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
235
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
236 case SMODE_COMPO:
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
237 // Competition mode, show entry data
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
238 $compo_id = stGetDisplayVar("compoID");
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
239 $compo = stFetchSQL(stPrepareSQL(
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
240 "SELECT * FROM compos WHERE id=%d",
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
241 $compo_id));
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
242
1104
0a2117349f46 s/true/TRUE/g; s/false/FALSE/g;
Matti Hamalainen <ccr@tnsp.org>
parents: 1072
diff changeset
243 if ($compo !== FALSE)
802
e5bbb01f2dd4 Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 737
diff changeset
244 {
e5bbb01f2dd4 Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 737
diff changeset
245 $prev = stFetchSQL(stPrepareSQL(
e5bbb01f2dd4 Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 737
diff changeset
246 "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0",
e5bbb01f2dd4 Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 737
diff changeset
247 $compo_id, stGetDisplayVar("compoPrevEntry")));
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
248
802
e5bbb01f2dd4 Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 737
diff changeset
249 $entry = stFetchSQL(stPrepareSQL(
e5bbb01f2dd4 Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 737
diff changeset
250 "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0",
e5bbb01f2dd4 Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 737
diff changeset
251 $compo_id, stGetDisplayVar("compoCurrEntry")));
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
252
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
253 stPrintCompoSlide($compo, $entry, $prev);
802
e5bbb01f2dd4 Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 737
diff changeset
254 }
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
255 break;
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
256
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
257 default:
391
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
258 stGuruMeditation();
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
259 break;
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
260 }
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
261 break;
1120
b2bca5f6d0ff Cosmetic cleanup: remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1104
diff changeset
262
737
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
263 default:
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
264 stGuruMeditation();
f97498ef28f4 Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
265 break;
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 }
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 break;
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 default:
391
0c1798c9d486 Add disabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 387
diff changeset
270 stGuruMeditation();
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 break;
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 }
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273
139
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
274
75cf14ee99a7 More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
275 // Save changed variables
143
20893a5442b7 Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
276 stSaveDisplayVars();
211
5bae42020034 Factorize some code into msitegen.
Matti Hamalainen <ccr@tnsp.org>
parents: 175
diff changeset
277
417
d2ece5d0aaa4 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 416
diff changeset
278 //stDumpAJAXStatusErrors();
126
71c35d5302c2 More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 ?>