From db696189e8b0b40878b5d734b0cdf2ff3ac240d5 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 29 Sep 2016 16:20:54 +0200 Subject: make clock reusable, basic scaffolding for main app diff --git a/rh-bin/activesystem.json b/rh-bin/activesystem.json deleted file mode 100755 index c37c5c4..0000000 --- a/rh-bin/activesystem.json +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/perl -# -# rhrdweb -# -# Copyright (C) 2016 Christian Pointner -# -# This file is part of rhrdweb. -# -# rhrdweb is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# any later version. -# -# rhrdweb is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with rhrdweb. If not, see . -# - -use strict; -use RHRD::rddb; -use JSON::MaybeXS; -use IO::Socket; -use Socket qw(SOCK_STREAM getaddrinfo); - -my $status = 'ERROR'; -my $errorstring = 'unknown'; -my $responsecode = 500; -my $system = 'unknown'; - - -my %hints = (socktype => SOCK_STREAM); -my ($err, @res) = getaddrinfo("rhctl.helsinki.at", "2345", \%hints); -if($err) { - $errorstring = "Cannot getaddrinfo - $err"; -} else { - my $sock; - foreach my $ai (@res) { - my $candidate = IO::Socket->new(); - $candidate->socket($ai->{family}, $ai->{socktype}, $ai->{protocol}) - or next; - $candidate->connect($ai->{addr}) - or next; - $sock = $candidate; - last; - } - if($sock) { - $system = <$sock>; - $system =~ s/\s+$//; - $status = 'OK'; - $errorstring = 'success'; - $responsecode = 200; - close($sock); - } else { - $errorstring = "Cannot connect to rhctl.helsinki.at:2345"; - } -} - -my %answer; -$answer{'status'} = $status; -$answer{'errorstring'} = $errorstring; -$answer{'system'} = $system; - -my $j = JSON::MaybeXS->new(utf8 => 0); - -print "Content-type: application/json; charset=UTF-8\n"; -print "Status: $responsecode\n\n"; -print $j->encode(\%answer); - - - diff --git a/www/index.html b/www/index.html index 3b7c067..f576a6b 100644 --- a/www/index.html +++ b/www/index.html @@ -9,33 +9,41 @@ + - - - - - - - - + + + + -
- Radio Helsinki Logo -

Radio Helsinki - Automation Status

+
+
+ +
+

Radio Helsinki - Automation Status

+
+
+
+ + + +
+
+
-
+
+
+
+
- - - - diff --git a/www/js/rhctl.js b/www/js/rhctl.js new file mode 100644 index 0000000..c70f8ee --- /dev/null +++ b/www/js/rhctl.js @@ -0,0 +1,26 @@ +/* + * rhrdweb + * + * Copyright (C) 2016 Christian Pointner + * + * This file is part of rhrdweb. + * + * rhrdweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * rhrdweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with rhrdweb. If not, see . + */ + +'use strict'; + +function rhctl_init() { + $('#rhctl').append($('

').text("coming soon")); +} diff --git a/www/js/system.js b/www/js/system.js deleted file mode 100644 index 0c7bba6..0000000 --- a/www/js/system.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * rhrdweb - * - * Copyright (C) 2016 Christian Pointner - * - * This file is part of rhrdweb. - * - * rhrdweb is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * rhrdweb is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with rhrdweb. If not, see . - */ - -'use strict'; - -function system_init() { - $.getJSON( "/rh-bin/activesystem.json", function(data) { - if(data.status == "OK") { - var systemspan = $('#system span.system-name').removeClass().addClass('system-name').addClass('label'); - - if(data.system == "master") { - systemspan.addClass('label-success').text(data.system); - } else if(data.system == "standby") { - systemspan.addClass('label-danger').text(data.system); - } else { - systemspan.addClass('label-default').text("unkown"); - } - } - }); -} diff --git a/www/nextshows.html b/www/nextshows.html index f668219..a801396 100644 --- a/www/nextshows.html +++ b/www/nextshows.html @@ -6,6 +6,7 @@ + diff --git a/www/styles/clock.css b/www/styles/clock.css new file mode 100644 index 0000000..9b028e2 --- /dev/null +++ b/www/styles/clock.css @@ -0,0 +1,52 @@ +/* + * rhrdweb + * + * Copyright (C) 2016 Christian Pointner + * + * This file is part of rhrdweb. + * + * rhrdweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * rhrdweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with rhrdweb. If not, see . + */ + +#clock { + display: block; + width: 100%; + height: 100%; + vertical-align: middle; + text-align: center; + margin: 0; +} + +#clock span { + display:table; + margin:0 auto; +} + +#clock span.current-week { + margin-top: 1em; + padding: 0.3em 2em; + font-size: 1.2em; +} + +#clock span.clock-date { + padding: 0.2em; + font-weight: bold; + font-size: 1.4em; +} + +#clock span.clock-time { + padding: 0.2em; + font-weight: bold; + font-size: 1.6em; +} diff --git a/www/styles/main.css b/www/styles/main.css index 5aae273..016b6ff 100644 --- a/www/styles/main.css +++ b/www/styles/main.css @@ -19,52 +19,24 @@ * along with rhrdweb. If not, see . */ -#clock { +#main { display: block; width: 100%; height: 100%; - vertical-align: middle; - text-align: center; - margin: 0; + margin-top: 100px; } -#clock span { - display:table; - margin:0 auto; +#logo { + margin-top: -60px; } -#clock span.current-week { - margin-top: 1em; - padding: 0.3em 2em; - font-size: 1.2em; +#title h1 { + padding-left: 1em; } -#clock span.clock-date { - padding: 0.2em; +#title h1 { font-weight: bold; - font-size: 1.4em; } -#clock span.clock-time { - padding: 0.2em; - font-weight: bold; - font-size: 1.6em; -} - -#system { - display: block; - width: 100%; - height: 100%; - vertical-align: middle; - text-align: center; - margin-top: 2em; -} - -#system span { - margin-top: 1em; - padding: 0.3em 2em; - font-size: 1.2em; - font-weight: bold; - display:table; - margin:0 auto; +#rhctl { } diff --git a/www/styles/nextshows.css b/www/styles/nextshows.css index 67ae14c..d354c8d 100644 --- a/www/styles/nextshows.css +++ b/www/styles/nextshows.css @@ -35,6 +35,11 @@ body { #clock { padding: 0.1em; + width: 100%; + height: 100%; + vertical-align: middle; + text-align: center; + margin: 0; } #clock span { diff --git a/www/styles/weeks.css b/www/styles/weeks.css index c3b0649..aac76de 100644 --- a/www/styles/weeks.css +++ b/www/styles/weeks.css @@ -28,38 +28,6 @@ margin-top: 10em; } -#clock { - display: block; - width: 100%; - height: 100%; - vertical-align: middle; - text-align: center; - margin: 0; -} - -#clock span { - display:table; - margin:0 auto; -} - -#clock span.current-week { - margin-top: 1em; - padding: 0.3em 2em; - font-size: 1.2em; -} - -#clock span.clock-date { - padding: 0.2em; - font-weight: bold; - font-size: 1.4em; -} - -#clock span.clock-time { - padding: 0.2em; - font-weight: bold; - font-size: 1.6em; -} - #buttons { display: block; width: 100%; diff --git a/www/weeks.html b/www/weeks.html index 8ca1e7c..4a9241c 100644 --- a/www/weeks.html +++ b/www/weeks.html @@ -8,6 +8,7 @@ + -- cgit v0.10.2