3 for QUERY in `echo $QUERY_STRING | tr '&' ' '`; do
4 for VALUE in `echo $QUERY | tr '=' ' '`; do
5 if [ "$VALUE" == "id" ]; then
7 elif [ "$ID" == "?" ]; then
9 elif [ "$VALUE" == "power" ]; then
11 elif [ "$POWER" == "?" ]; then
13 elif [ "$VALUE" == "mobile" ]; then
15 elif [ "$POWER" == "?" ]; then
17 elif [ "$VALUE" == "ajax" ]; then
19 elif [ "$AJAX" == "?" ]; then
26 UNIXSOCK=/var/run/powersensordaemon/cmd.sock
27 VALID_ONOFF_IDS="decke ambientlights lichter all werkzeug labor dart logo spots1 deckehinten deckevorne boiler whiteboard pcblueleds bikewcblue"
28 VALID_SEND_IDS_CUSTOM_DISPLAY="ymhpoweroff ymhpower ymhvolup ymhvoldown"
29 VALID_SEND_IDS="ymhpoweron ymhcd ymhwdtv ymhtuner ymhaux ymhsattv ymhvolmute ymhmenu ymhplus ymhminus ymhtest ymhtimelevel ymheffect ymhprgup ymhprgdown ymhtunplus ymhtunminus ymhtunabcde ymhtape ymhvcr ymhextdec ymhsleep ymhp5 panicled blueled moviemode"
30 #VALID_BANSHEE_IDS="playPause next prev"
31 #VALID_CAM_MOTOR_IDS="c C w W"
33 [ "$POWER" == "Off" ] && POWER=off
34 [ "$POWER" != "off" ] && POWER=on
35 if [ "$POWER" == "on" -o "$POWER" == "off" ]; then
36 for CHECKID in $VALID_ONOFF_IDS $VALID_SEND_IDS; do
37 if [ "$CHECKID" == "$ID" ]; then
38 echo "power $POWER $ID" | usocket $UNIXSOCK
39 echo "Content-type: text/html"
43 echo "<title>Realraum rf433ctl</title>"
44 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
50 for CHECKID in $VALID_BANSHEE_IDS; do
51 if [ "$CHECKID" == "$ID" ]; then
52 echo "$ID/" | nc wuerfel.realraum.at 8484
53 echo "Content-type: text/html"
57 echo "<title>Realraum rf433ctl</title>"
58 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
64 for CHECKID in $VALID_CAM_MOTOR_IDS; do
65 if [ "$CHECKID" == "$ID" ]; then
66 echo "$ID" > /dev/ttyACM0
67 echo "Content-type: text/html"
71 echo "<title>Realraum rf433ctl</title>"
72 echo '<script type="text/javascript">window.location="http://slug.realraum.at/cgi-bin/switch.cgi";</script>'
79 DESC_pcblueleds="Blaue Leds PC"
80 DESC_bikewcblue="Blaue Lichterkette WC"
82 DESC_werkzeug="Werkzeug LEDs"
83 DESC_stereo="Receiver On/Off"
84 DESC_ambientlights="Ambient Lichter"
85 DESC_labor="Labor Licht"
86 DESC_boiler="Warmwasser WC"
87 DESC_dart="Dart Scheibe"
90 DESC_deckehinten="Decke Hinten"
91 DESC_deckevorne="Decke Vorne"
92 DESC_whiteboard="Whiteboard Vorne"
93 DESC_decke="Deckenlichter"
94 DESC_lichter="Alle Lichter"
96 DESC_ymhpoweron="Receiver On (off+tgl)"
97 DESC_ymhpoweroff="Receiver Off"
98 DESC_ymhpower="Receiver On/Off"
99 DESC_ymhvolup="VolumeUp"
100 DESC_ymhvoldown="VolumeDown"
101 DESC_ymhcd="Input CD"
102 DESC_ymhwdtv="Input S/PDIF Wuerfel"
103 DESC_ymhtuner="Input Tuner"
104 DESC_ymhvolmute="Mute"
109 DESC_ymhtimelevel="Time/Levels"
110 DESC_ymheffect="DSP Effect Toggle"
111 DESC_ymhprgup="DSP Up"
112 DESC_ymhprgdown="DSP Down"
113 DESC_ymhtunplus="Tuner +"
114 DESC_ymhtunminus="Tuner -"
115 DESC_ymhtunabcde="Tuner ABCDE"
118 DESC_ymhextdec="ExtDec Toggle"
119 DESC_seep="Sleep Modus"
120 DESC_panicled="HAL9000 says hi"
121 DESC_blueled="Blue Led"
122 DESC_moviemode="Movie Mode"
128 echo "Content-type: text/html"
132 echo "<title>Realraum rf433ctl</title>"
133 echo '<script type="text/javascript">'
134 echo 'function sendButton( onoff, btn )'
136 echo ' var req = new XMLHttpRequest();'
137 echo ' url = "http://slug.realraum.at/cgi-bin/switch.cgi?power="+onoff+"&id="+btn;'
138 echo ' req.open("GET", url ,false);'
139 echo ' //google chrome workaround'
140 echo ' req.setRequestHeader("googlechromefix","");'
141 echo ' req.send(null);'
145 echo 'div.switchbox {'
148 #echo ' max-width:236px;'
149 echo ' max-width:300px;'
150 echo ' font-size:10pt;'
151 echo ' border:1px solid black;'
152 #echo ' height: 32px;'
156 echo 'div.switchnameleft {'
157 echo ' width:12em; display:inline-block; vertical-align:middle; margin-left:3px;'
160 echo 'span.alignbuttonsright {'
161 echo ' top:0px; float:right; display:inline-block; text-align:right; padding:0;'
164 echo 'div.switchnameright {'
165 echo ' width:12em; display:inline-block; vertical-align:middle; float:right; display:inline-block; margin-left:1ex; margin-right:3px; margin-top:3px; margin-bottom:3px;'
168 echo 'span.alignbuttonsleft {'
169 echo ' float:left; text-align:left; padding:0;'
173 echo ' font-size:11pt;'
175 echo ' height: 32px;'
176 echo ' background-color: lime;'
181 echo ' font-size:11pt;'
183 echo ' height: 32px;'
184 echo ' background-color: red;'
189 echo ' font-size:11pt;'
191 echo ' height: 32px;'
192 #echo ' background-color: grey;'
198 #echo "<h1>Realraum rf433ctl</h1>"
199 echo "<div style=\"float:left; border:1px solid black;\">"
200 for DISPID in $VALID_ONOFF_IDS; do
201 NAME="$(eval echo \$DESC_$DISPID)"
202 [ -z "$NAME" ] && NAME=$DISPID
203 if [ -z "$AJAX" ]; then
205 echo "<form action=\"/cgi-bin/switch.cgi\">"
206 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
207 echo "<div class=\"switchbox\"><div class=\"switchnameleft\">$NAME</div><span class=\"alignbuttonsright\">"
208 echo " <input class=\"onbutton\" type='submit' name='power' value='on' />"
209 echo " <input class=\"offbutton\" type='submit' name='power' value='off' />"
216 echo "<div class=\"switchbox\">"
217 echo "<span class=\"alignbuttonsleft\">"
218 echo " <button class=\"onbutton\" onClick='sendButton(\"on\",\"$DISPID\");'>On</button>"
219 echo " <button class=\"offbutton\" onClick='sendButton(\"off\",\"$DISPID\");'>Off</button>"
221 echo "<div class=\"switchnameright\">$NAME</div>"
225 if [ "$MOBILE" == "1" ]; then
230 if [ "$MOBILE" != "1" ]; then
231 echo "<div style=\"float:left; border:1px solid black; margin-top:5px;\">"
233 if [ -z "$AJAX" ]; then
235 echo "<div class=\"switchbox\"><div class=\"switchnameleft\">Receiver Power</div><span class=\"alignbuttonsright\">"
236 echo "<form action=\"/cgi-bin/switch.cgi\"><input type=\"hidden\" name=\"id\" value=\"ymhpower\" /><input class=\"sendbutton\" type='submit' name='power' value='tgl' /></form>"
237 echo "<form action=\"/cgi-bin/switch.cgi\"><input type=\"hidden\" name=\"id\" value=\"ymhpower\" /><input class=\"offbutton\" type='submit' name='power' value='off' /></form>"
240 echo "<div class=\"switchbox\"><div class=\"switchnameleft\">Receiver Volume</div><span class=\"alignbuttonsright\">"
241 echo "<form action=\"/cgi-bin/switch.cgi\"><input type=\"hidden\" name=\"id\" value=\"ymhvolup\" /><input class=\"sendbutton\" type='submit' name='power' value='↑' /></form>"
242 echo "<form action=\"/cgi-bin/switch.cgi\"><input type=\"hidden\" name=\"id\" value=\"ymhvoldown\" /><input class=\"sendbutton\" type='submit' name='power' value='↓' /></form>"
247 echo "<div class=\"switchbox\">"
248 echo "<span class=\"alignbuttonsleft\">"
249 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhpower\");'>Tgl</button>"
250 echo " <button class=\"offbutton\" onClick='sendButton(\"on\",\"ymhpoweroff\");'>Off</button>"
252 echo "<div class=\"switchnameright\">Receiver Power</div>"
255 echo "<div class=\"switchbox\">"
256 echo "<span class=\"alignbuttonsleft\">"
257 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhvolup\");'>↑</button>"
258 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"ymhvoldown\");'>↓</button>"
260 echo "<div class=\"switchnameright\">Receiver Volume</div>"
265 for DISPID in $VALID_SEND_IDS; do
266 NAME="$(eval echo \$DESC_$DISPID)"
267 [ -z "$NAME" ] && NAME=$DISPID
268 if [ -z "$AJAX" ]; then
270 echo "<form action=\"/cgi-bin/switch.cgi\">"
271 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
272 echo "<div style=\"float:left; margin:2px; padding:1px; max-width:236px; font-size:10pt; border:1px solid black;\"><div style='width:10em; display:inline-block; vertical-align:middle;'>$NAME</div><span style='float:right; text-align:right;'>"
273 echo " <input class=\"sendbutton\" type='submit' name='power' value=' ' />"
279 echo "<div class=\"switchbox\">"
280 echo "<span class=\"alignbuttonsleft\">"
281 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"$DISPID\");'> </button>"
283 echo "<div class=\"switchnameright\">$NAME</div>"
289 echo "<div style=\"float:left; border:1px solid black; margin-top:5px;\">"
290 for DISPID in $VALID_BANSHEE_IDS $VALID_CAM_MOTOR_IDS; do
291 NAME="$(eval echo \$DESC_$DISPID)"
292 [ -z "$NAME" ] && NAME=$DISPID
293 if [ -z "$AJAX" ]; then
295 echo "<form action=\"/cgi-bin/switch.cgi\">"
296 echo "<input type=\"hidden\" name=\"id\" value=\"$DISPID\" />"
297 echo "<div style=\"float:left; margin:2px; padding:1px; max-width:236px; font-size:10pt; border:1px solid black;\"><div style='width:10em; display:inline-block; vertical-align:middle;'>$NAME</div><span style='float:right; text-align:right;'>"
298 echo " <input class=\"sendbutton\" type='submit' name='power' value=' ' />"
304 echo "<div class=\"switchbox\">"
305 echo "<span class=\"alignbuttonsleft\">"
306 echo " <button class=\"sendbutton\" onClick='sendButton(\"on\",\"$DISPID\");'> </button>"
308 echo "<div class=\"switchnameright\">$NAME</div>"