From 367dceac3f77afd13165227e24cce6f32f9693d7 Mon Sep 17 00:00:00 2001 From: xkonni Date: Mon, 5 Nov 2012 21:05:12 +0100 Subject: [PATCH] webinterface: improvements --- index.php | 69 ------------------------------ webinterface/index.php | 94 ++++++++++++++++++++++++++++++++++++++++ webinterface/style.css | 97 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 191 insertions(+), 69 deletions(-) delete mode 100644 index.php create mode 100644 webinterface/index.php create mode 100644 webinterface/style.css diff --git a/index.php b/index.php deleted file mode 100644 index 9306d85..0000000 --- a/index.php +++ /dev/null @@ -1,69 +0,0 @@ - - - raspberry - - -= 8) { - $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n"); - socket_bind($socket, $source) or die("Could not bind to socket\n"); - socket_connect($socket, $target, $port) or die("Could not connect to socket\n"); - socket_write($socket, $output, strlen ($output)) or die("Could not write output\n"); - echo "ACTION: "; - echo "group: ".$nGroup; - echo " switch: ".$nSwitch; - echo " action: ".$nAction; - echo "=> ".socket_read($socket, 2048)."

"; - socket_close($socket); -} -else if (strlen($OUTPUT) > 0) { - echo "ACTION: "; - echo $output." too short"; -} - -$groups=array("00001", "00010"); -echo ""; -foreach($groups as $ig) { - echo ""; - for ($is=1; $is<=5; $is++) { - $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n"); - socket_bind($socket, $source) or die("Could not bind to socket\n"); - socket_connect($socket, $target, $port) or die("Could not connect to socket\n"); - - $output = $ig."0".$is."2"; - socket_write($socket, $output, strlen ($output)) or die("Could not write output\n"); - $state = socket_read($socket, 2048); - if ($state == 0) { - $color=" BGCOLOR=\"#FF0000\""; - $action = 1; - } - if ($state == 1) { - $color=" BGCOLOR=\"#00FF00\""; - $action = 0; - } - echo ""; -} -echo "
"; - echo "".$ig.":".$is."
=> ".$action."
"; - socket_close($socket); - } - echo "
"; -?> - - diff --git a/webinterface/index.php b/webinterface/index.php new file mode 100644 index 0000000..c664fd4 --- /dev/null +++ b/webinterface/index.php @@ -0,0 +1,94 @@ + + + + raspberry + + + + +"; +foreach($groups as $ig) { + for ($is=1; $is<=5; $is++) { + $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n"); + socket_bind($socket, $source) or die("Could not bind to socket\n"); + socket_connect($socket, $target, $port) or die("Could not connect to socket\n"); + + $output = $ig."0".$is."2"; + socket_write($socket, $output, strlen ($output)) or die("Could not write output\n"); + $state = socket_read($socket, 2048); + if ($state == 0) { + $color=" BGCOLOR=\"#C00000\""; + $action = 1; + $done="switch on"; + } + if ($state == 1) { + $color=" BGCOLOR=\"#00C000\""; + $action = 0; + $done="switch off"; + } + if (($ig == $nGroup) && ($is == $nSwitch)) { + if ($state == 1) { + $done="switched on"; + $color=" BGCOLOR=\"#00FF00\""; + } + else if ($state == 0) { + $done="switched off"; + $color=" BGCOLOR=\"#FF0000\""; + } + } + echo ""; + echo "
"; + echo ""; + echo "

".$names[$index]."


"; + echo $ig.":".$is."
"; + echo $done; + echo "
"; + echo "
"; + echo ""; + // socket_close($socket); + if ($index%2 == 1) { + echo ""; + } + $index++; + socket_close($socket); + } +} +echo ""; +?> + + diff --git a/webinterface/style.css b/webinterface/style.css new file mode 100644 index 0000000..893b598 --- /dev/null +++ b/webinterface/style.css @@ -0,0 +1,97 @@ +body { + background-color:#000000; + color: white; + font-size: 26px; +} + +h1 { +} + +h2 { +} + +h3 { + font-size: 30px; +} + +p { +} + +div { + width: 495px; + padding: 10px; +} + +div.changelog { + color: #ffffff; + background-color: #14171b; +} + +table { + vertical-align: middle; + text-align: center; + border-spacing: 10px; +} + +td.outer { + + padding: 20px; + width: 240px; + height: 240px; +} + +td.inner { + width: 220; + height: 220px; +} + +a:link { + color: #ffffff; + text-decoration: none; + font-size: 26px; +} +a:visited { + color: #ffffff; + text-decoration: none; +} +a:hover { + color: #298aad; + text-decoration: none; +} +a:active { + color: #ffffff; i + text-decoration: none; +} + +span { + color: #ffffff; +} + + +.ics { + color: #298aad; +} + +ul { + list-style-type: circle; + color: #298aad; +} + +li { + color: #ffffff; +} + +/* Display */ +.hidden { display: none; } +.visible { display: block; } + +/* Visibility */ +/* +.hidden { visibility: hidden; } +.visible { visibility: visible; } +*/ + +/* Android HDPI */ +@media only screen and (-webkit-device-pixel-ratio:1.5) { +} +