summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/DBInfoscreen/Controller/Map.pm30
-rw-r--r--lib/DBInfoscreen/Helper/HAFAS.pm6
-rw-r--r--public/static/js/map-refresh.js3
-rw-r--r--templates/_map_infobox.html.ep2
-rw-r--r--templates/_train_details.html.ep4
5 files changed, 38 insertions, 7 deletions
diff --git a/lib/DBInfoscreen/Controller/Map.pm b/lib/DBInfoscreen/Controller/Map.pm
index e552a18..bced612 100644
--- a/lib/DBInfoscreen/Controller/Map.pm
+++ b/lib/DBInfoscreen/Controller/Map.pm
@@ -314,13 +314,26 @@ sub route {
my ($self) = @_;
my $trip_id = $self->stash('tripid');
my $line_no = $self->stash('lineno');
+ my $hafas = $self->param('hafas');
my $from_name = $self->param('from');
my $to_name = $self->param('to');
$self->render_later;
- $self->hafas->get_polyline_p( $trip_id, $line_no )->then(
+ my $service = 'DB';
+ if ( $hafas
+ and $hafas ne '1'
+ and Travel::Status::DE::HAFAS::get_service($hafas) )
+ {
+ $service = $hafas;
+ }
+
+ $self->hafas->get_polyline_p(
+ id => $trip_id,
+ line => $line_no,
+ service => $service
+ )->then(
sub {
my ($journey) = @_;
@@ -458,12 +471,25 @@ sub ajax_route {
my ($self) = @_;
my $trip_id = $self->stash('tripid');
my $line_no = $self->stash('lineno');
+ my $hafas = $self->param('hafas');
delete $self->stash->{layout};
$self->render_later;
- $self->hafas->get_polyline_p( $trip_id, $line_no )->then(
+ my $service = 'DB';
+ if ( $hafas
+ and $hafas ne '1'
+ and Travel::Status::DE::HAFAS::get_service($hafas) )
+ {
+ $service = $hafas;
+ }
+
+ $self->hafas->get_polyline_p(
+ id => $trip_id,
+ line => $line_no,
+ service => $service
+ )->then(
sub {
my ($journey) = @_;
diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm
index 302cb9c..148a917 100644
--- a/lib/DBInfoscreen/Helper/HAFAS.pm
+++ b/lib/DBInfoscreen/Helper/HAFAS.pm
@@ -161,11 +161,15 @@ sub get_route_p {
# Input: (HAFAS TripID, line number)
# Output: Promise returning a Travel::Status::DE::HAFAS::Journey instance on success
sub get_polyline_p {
- my ( $self, $trip_id, $line ) = @_;
+ my ( $self, %opt ) = @_;
+ my $trip_id = $opt{id};
+ my $line = $opt{line};
+ my $service = $opt{service};
my $promise = Mojo::Promise->new;
Travel::Status::DE::HAFAS->new_p(
+ service => $service,
journey => {
id => $trip_id,
name => $line,
diff --git a/public/static/js/map-refresh.js b/public/static/js/map-refresh.js
index aa5629b..0389323 100644
--- a/public/static/js/map-refresh.js
+++ b/public/static/js/map-refresh.js
@@ -68,7 +68,8 @@ function dbf_anim_fine() {
}
function dbf_map_reload() {
- $.get('/_ajax_mapinfo/' + j_reqid, function(data) {
+ const param = new URLSearchParams(window.location.search);
+ $.get('/_ajax_mapinfo/' + j_reqid + '?hafas=' + param.get('hafas'), function(data) {
$('#infobox').html(data);
dbf_map_parse();
setTimeout(dbf_map_reload, 61000);
diff --git a/templates/_map_infobox.html.ep b/templates/_map_infobox.html.ep
index c8936ae..4f9a644 100644
--- a/templates/_map_infobox.html.ep
+++ b/templates/_map_infobox.html.ep
@@ -1,6 +1,6 @@
<div class="container" id="infobox" style="margin-top: 1ex; margin-bottom: 1ex;">
<div class="journey" id="jdata"
-data-req="<%= stash('ajax_req') %>"
+data-req="<%= stash('ajax_req') =~ s{#}{%23}gr %>"
data-route="<%= stash('ajax_route') %>"
data-poly="<%= stash('ajax_polyline') %>"
>
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep
index f1ddfe0..dca9405 100644
--- a/templates/_train_details.html.ep
+++ b/templates/_train_details.html.ep
@@ -139,10 +139,10 @@
<div class="verbose">
% if ($departure->{trip_id}) {
% if (stash('station_name')) {
- <a class="smallbutton" href="/map/<%= $departure->{trip_id} %>/<%= $departure->{train_line} // 0 %>?from=<%= stash('station_name') %>"><i class="material-icons" aria-hidden="true">map</i> <%= l 'Karte' %></a>
+ <a class="smallbutton" href="/map/<%= $departure->{trip_id} =~ s{#}{%23}gr %>/<%= $departure->{train_line} // 0 %>?from=<%= stash('station_name') %>"><i class="material-icons" aria-hidden="true">map</i> <%= l 'Karte' %></a>
% }
% else {
- <a class="smallbutton" href="/map/<%= $departure->{trip_id} %>/<%= $departure->{train_line} // 0 %>"><i class="material-icons" aria-hidden="true">map</i> <%= l 'Karte' %></a>
+ <a class="smallbutton" href="/map/<%= $departure->{trip_id} =~ s{#}{%23}gr %>/<%= $departure->{train_line} // 0 %>"><i class="material-icons" aria-hidden="true">map</i> <%= l 'Karte' %></a>
% }
% }
% if ($departure->{wr_link}) {