Mercurial > hg > fapweb
annotate showajax.php @ 1096:bbc0a3d0b51e
Major renaming / refactor of site messages. Some that were previously
modifiable from admin interface are now "hardcoded" in the configuration
file. Having these settings made modifiable from there made no sense
and just took space in the UI.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 27 Jan 2017 22:15:06 +0200 |
parents | 7da8bde9b7be |
children | 0a2117349f46 |
rev | line source |
---|---|
1071 | 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 | 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 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
11 function stPrintCompoEntry($entry, $class, $compo, $title = false) |
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 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
14 " <div class=\"".$class."\">\n"; |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
15 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
16 if ($title !== false) |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
17 echo |
387 | 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 | 25 { |
26 if ($title === false) | |
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 | 29 } |
30 | |
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 | 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 |
496
924eb55a98b6
Show "competition is starting" type text if no entries are set currently.
Matti Hamalainen <ccr@tnsp.org>
parents:
495
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>"; |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
49 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
50 if ($entry !== false) |
386 | 51 stPrintCompoEntry($entry, "compoNext", $compo, false); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
52 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
53 if ($prev !== false) |
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 | 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 | 61 " <div class=\"slideHeader\">\n". |
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 | 64 " <div class=\"slideText\">\n". |
923 | 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 | 69 |
391 | 70 function stGuruMeditation() |
71 { | |
923 | 72 stPrintRotationSlide( |
391 | 73 "<div class=\"guru\">". |
74 "Software Failure. Press left mouse button to continue.<br />". | |
75 "Guru Meditation #00000004.0000AAC0". | |
923 | 76 "</div>\n"); |
391 | 77 } |
78 | |
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 | 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 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
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 | 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 | 118 // |
119 // Rotation / normal slide show mode | |
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); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
122 |
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 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
139 if (($slideList = stExecSQL($sql)) !== false) |
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; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
145 |
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; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
161 |
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; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
166 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
167 case SMODE_COMPO: |
152 | 168 // |
169 // Competition mode, is controlled from admin UI, so we donẗ | |
170 // actually do anything here. | |
171 // | |
387 | 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 | 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 | 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 | 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 | 193 // |
194 // Serve the request | |
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 | 228 |
737
f97498ef28f4
Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
736
diff
changeset
|
229 if (($slide = stFetchSQL($sql)) !== false) |
923 | 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; |
f97498ef28f4
Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
736
diff
changeset
|
235 |
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 |
802 | 243 if ($compo !== false) |
244 { | |
245 $prev = stFetchSQL(stPrepareSQL( | |
246 "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0", | |
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 | 249 $entry = stFetchSQL(stPrepareSQL( |
250 "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0", | |
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 | 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 | 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; |
f97498ef28f4
Various minor fixes to the slide handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
736
diff
changeset
|
262 |
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 | 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 | 278 //stDumpAJAXStatusErrors(); |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
279 ?> |