diff options
-rw-r--r-- | cgi/index.pl | 4 | ||||
-rw-r--r-- | cgi/templates/main.html.ep | 22 |
2 files changed, 24 insertions, 2 deletions
diff --git a/cgi/index.pl b/cgi/index.pl index 25a4da1..118df7d 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -77,6 +77,9 @@ sub handle_request { my $no_lines = $self->param('no_lines'); my $frontend = $self->param('frontend') // 'png'; + my (undef, $errstr) = get_results( $self->param('backend') // $default{backend}, + $city, $stop); + if ( not $no_lines or $no_lines < 1 or $no_lines > 40 ) { $no_lines = $default{no_lines}; } @@ -94,6 +97,7 @@ sub handle_request { stop => $stop, version => $VERSION, frontend => $frontend, + errstr => $errstr, title => $city ? "departures for ${city} ${stop}" : "vrr-fakedisplay ${VERSION}", diff --git a/cgi/templates/main.html.ep b/cgi/templates/main.html.ep index 54b3196..c9ab3cf 100644 --- a/cgi/templates/main.html.ep +++ b/cgi/templates/main.html.ep @@ -23,6 +23,16 @@ text-decoration: none; } + div.error { + font-size: 150%; + font-weight: bold; + color: #dd0000; + } + + pre { + margin-bottom: 2em; + } + span.optional { color: #666666; } @@ -56,12 +66,20 @@ } </style> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script> </head> <body> % if ($city and $stop) { -% if ($frontend eq 'png') { +% if ($errstr) { +<div class="error">Error from backend:</div> +<div> +<pre> +%= $errstr +</pre> +</div> +% } +% elsif ($frontend eq 'png') { <img src="/<%= $city %>/<%= $stop %>.png?<%= $params %>" alt="" id="display" height="<%= $height * 4 %>" width="<%= $width * 4 %>"/> % } |