summaryrefslogtreecommitdiff
path: root/templates/main.html.ep
blob: 3e8f2abef0f415e6881aadbfcfb20efd4ac929e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html>
<head>
	<title><%= $title %></title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	%= stylesheet '/static/main.css'
	%= javascript '/static/jquery-2.1.1.min.js'
	%= javascript '/static/image.js'
</head>
<body>

% if ($stop) {
% if ($errstr) {
<div class="container">
<div class="error">
<strong>Received an error from the backend service:</strong>
%= $errstr
</div><!-- error -->
</div><!-- container -->
% }
% elsif ($frontend eq 'png') {
<img src="/<%= $city ? "$city/" : q{} %><%= $stop %>.png?<%= $params %>" alt=""
id="display" height="<%= $height * 4 %>" width="<%= $width * 4 %>"/>
% }
% elsif ($frontend eq 'html') {
<iframe src="/<%= $city ? "$city/" : q{} %><%= $stop %>.html?<%= $params %>" id="display"
height="<%= $height * 5 %>" width="<%= $width * 5 %>"></iframe>
% }
% elsif ($frontend eq 'infoscreen') {
<p>
<a href="/<%= $city ? "$city/" : q{} %><%= $stop %>.html?<%= $params %>&amp;template=infoscreen">Infoscreen for
<%= $city %> <%= $stop %></a>
</p>
Preview:<br/>
<iframe src="/<%= $city ? "$city/" : q{} %><%= $stop %>.html?<%= $params %>&amp;template=infoscreen" id="display"
height="<%= $height * 5 %>" width="<%= $width * 5 %>"></iframe>
% }
% elsif ($frontend eq 'json') {
<div class="container">
<p>
<a href="/<%= $city ? "$city/" : q{} %><%= $stop %>.json?<%= $params %>">JSON data for
<%= $city %> <%= $stop %></a>
</p>
<p>
Data is cached for 1 minute. JSON format:
</p>
<ul>
<li>error: err string if an error occured, otherwise null</li>
<li>preformatted: strings used by the PNG / HTML frontend</li>
<li>raw:
% if (param('backend') and param('backend') =~ m{ ^db | ^hafas }x) {
serialized
<a href="http://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn/">
Travel::Status::DE::HAFAS</a>-objects, see the
<a href="http://man.finalrewind.org/3/Travel-Status-DE-HAFAS-Result/">::Result</a>
documentation
% }
% elsif (param('backend') and param('backend') eq 'aseag') {
serialized
<a href="http://finalrewind.org/projects/Travel-Status-DE-URA/">
Travel::Status::DE::URA</a>-objects, see the
<a href="http://man.finalrewind.org/3/Travel-Status-DE-URA-Result/">::Result</a>
documentation
% }
% else {
serialized
<a href="http://finalrewind.org/projects/Travel-Status-DE-VRR/">
Travel::Status::DE::EFA</a>-objects, see the
<a href="http://man.finalrewind.org/3/Travel-Status-DE-EFA-Result/">::Result</a>
and
<a href="http://man.finalrewind.org/3/Travel-Status-DE-EFA-Line/">::Line</a>
documentation
% }
</li>
<li>version: Program version (string, not numeric)</li>
</ul>
<p>NOTE: The JSON interface is not guaranteed to be stable. The data layout may
change any time.</p>
</div> <!-- container -->
% }
% } # ($stop)
% else {
<div class="container">
<p>
VRR-Infoscreen shows the next departures at a public transit stop, just like
the Lumino LED displays used in some places. It also supports an
app / infoscreen-like frontend (click/tap on a departure for details) and
JSON export.
</p>

<p>
It works best for the VRR (Verkehrsverbund Rhein-Ruhr), but also supports many
other german transit networks. All information is provided without any
guarantee of correctness, completeness or anything else.
</p>
</div> <!-- container -->
% }
<div class="container">
<div class="input-field">

% if (my $error = stash 'error') {
<p>
  Error: <%= $error %><br/>
</p>
% }

%= form_for _redirect => begin
<div>
  <div class="field">
    <div class="desc">City (required for EFA backend, optional otherwise)</div>
    <div>
      % if (stash('place_candidates') and @{ stash('place_candidates') } ) {
        % my @candidates = map { [ $_, $_ ] } @{ stash('place_candidates') };
        %= select_field city => \@candidates
      % }
      % else {
        %= text_field 'city'
      % }
    </div>
  </div>
  <div class="field">
    <div class="desc">Stop</div>
    <div>
      % if (stash('name_candidates') and @{ stash('name_candidates') } ) {
        % my @candidates = map { [ $_, $_ ] } @{ stash('name_candidates') };
        %= select_field stop => \@candidates
      % }
      % else {
        %= text_field 'stop'
      % }
    </div>
  </div>
  <div class="field">
    %= submit_button 'Display'
  </div>
  <div class="break"></div>
  <span class="optional">optional:</span>
  <div class="field">
    <div class="desc">Frontend</div>
    <div>
      %= select_field frontend => [['LED board (PNG)' => 'png'], ['LED board (HTML)' => 'html'], ['App / Infoscreen' => 'infoscreen'], ['JSON' => 'json']]
    </div>
  </div>
  <div class="field">
    <div class="desc">Backend</div>
    <div>
      % my @efa_backends = map { ["$_ (EFA)" => "efa.$_"] } efa_service_list();
      % @efa_backends = map { $_->[1] } sort { $a->[0] cmp $b->[0] }
      %                 map { [$_->[0], $_] } @efa_backends;
      % my @hafas_backends = map { ["$_ (HAFAS)" => "hafas.$_"] } hafas_service_list();
      % @hafas_backends = map { $_->[1] } sort { $a->[0] cmp $b->[0] }
      %                 map { [$_->[0], $_] } @hafas_backends;
      %= select_field backend => [['EFA / VRR' => 'vrr'], ['DB (HAFAS)' => 'db'], ['ASEAG (URA)' => 'aseag'], @efa_backends, @hafas_backends]
    </div>
  </div>
  <div class="field">
    <div class="desc" title="number of lines">
      display height [lines]</div>
    <div>
      %= number_field 'no_lines', min => 1, max => 10
    </div>
  </div>
  <div class="field">
    <div class="desc">min. offset [minutes]</div>
    <div>
    %= number_field 'offset', min => 0
    </div>
  </div>
  <div class="field">
    <div class="desc" title="comma-separated list, example: NE,U,10">
      match line prefixes¹</div>
    <div>
      %= text_field 'line'
    </div>
  </div>
  <div class="field">
    <div class="desc" title="comma-separated list. Buggy.">match platform¹</div>
    <div>
      %= text_field 'platform'
    </div>
  </div>
</div>
% end

<p>
<b>¹</b> separate values with commas, e.g. NE,U,10
</p>
</div> <!-- input-field -->

<div class="notes">
<span class="notes">notes:</span>
<ul>
<li>The EFA backend does not support Umlauts</li>
<li><a href="/Essen/Martinstr?no_lines=8">Example</a>
<li>See also <a href="http://dbf.finalrewind.org/">db-infoscreen</a> for an
interface optimized for Deutsche Bahn departure data</li>
</li>
</ul>
</div> <!-- notes -->

<div class="about">
<a href="http://finalrewind.org/projects/vrr-fakedisplay/">vrr-fakedisplay</a>
v<%= $version %><br/>
Backends:<br/>
<a href="http://finalrewind.org/projects/Travel-Status-DE-URA/">Travel::Status::DE::URA</a>
v<%= $Travel::Status::DE::ASEAG::VERSION %><br/>
<a href="http://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn/">Travel::Status::DE::HAFAS</a>
v<%= $Travel::Status::DE::HAFAS::VERSION %><br/>
<a href="http://finalrewind.org/projects/Travel-Status-DE-VRR/">Travel::Status::DE::EFA</a>
v<%= $Travel::Status::DE::EFA::VERSION %><br/>
</div>
</div> <!-- container -->

</body>
</html>