Loading lib/DBInfoscreen.pm +1 −1 Original line number Diff line number Diff line Loading @@ -288,7 +288,7 @@ sub startup { my $r = $self->routes; $r->get('/_redirect')->to('static#redirect'); $r->get('/_redirect')->to('stationboard#redirect_to_station'); # legacy entry point $r->get('/_auto')->to('static#geostop'); Loading lib/DBInfoscreen/Controller/Static.pm +0 −28 Original line number Diff line number Diff line Loading @@ -11,34 +11,6 @@ my %default = ( admode => 'deparr', ); sub redirect { my ($self) = @_; my $input = $self->param('input'); my $params = $self->req->params; $params->remove('input'); for my $param (qw(platforms mode admode via)) { if ( not $params->param($param) or ( exists $default{$param} and $params->param($param) eq $default{$param} ) ) { $params->remove($param); } } $params = $params->to_string; if ( $input =~ m{ ^ [a-zA-Z]{1,5} \s+ \d+ $ }x ) { $self->redirect_to("/z/${input}?${params}"); } else { $self->redirect_to("/${input}?${params}"); } } sub geostop { my ($self) = @_; Loading lib/DBInfoscreen/Controller/Stationboard.pm +44 −2 Original line number Diff line number Diff line Loading @@ -511,7 +511,7 @@ sub handle_request { $station, { errstr => $err, status => ( $err =~ m{station name$} ? 300 : 500 ), status => ( $err =~ m{Ambiguous|LOCATION} ? 300 : 500 ), }, $api_version ); Loading @@ -521,7 +521,7 @@ sub handle_request { $station, { errstr => $err, status => ( $err =~ m{station name$} ? 300 : 500 ), status => ( $err =~ m{Ambiguous|LOCATION} ? 300 : 500 ), }, $hafas ); Loading Loading @@ -1873,4 +1873,46 @@ sub autocomplete { ); } sub redirect_to_station { my ($self) = @_; my $input = $self->param('input'); my $params = $self->req->params; $params->remove('input'); for my $param (qw(platforms mode admode via)) { if ( not $params->param($param) or ( exists $default{$param} and $params->param($param) eq $default{$param} ) ) { $params->remove($param); } } if ( $input =~ m{ ^ [a-zA-Z]{1,5} \s+ \d+ $ }x ) { $params = $params->to_string; $self->redirect_to("/z/${input}?${params}"); } else { my @candidates = Travel::Status::DE::IRIS::Stations::get_station($input); if ( @candidates == 1 and ( $input eq $candidates[0][0] or lc($input) eq lc( $candidates[0][1] ) or $input eq $candidates[0][2] ) ) { $params->remove('hafas'); } else { $params->param( hafas => 1 ); } $params = $params->to_string; $self->redirect_to("/${input}?${params}"); } } 1; templates/layouts/app.html.ep +0 −8 Original line number Diff line number Diff line Loading @@ -200,14 +200,6 @@ Bitte eine Station aus der Liste auswählen</div> </label> </div> </div> <div class="field"> <div class="desc"> %= check_box 'hafas' => 1, id => 'id_hafas' <label for="id_hafas"> Bus, Stadtbahn und weiteren Nahverkehr anzeigen (via DB HAFAS mgate) </label> </div> </div> <div class="field"> <div class="desc"> Nur Züge über Loading Loading
lib/DBInfoscreen.pm +1 −1 Original line number Diff line number Diff line Loading @@ -288,7 +288,7 @@ sub startup { my $r = $self->routes; $r->get('/_redirect')->to('static#redirect'); $r->get('/_redirect')->to('stationboard#redirect_to_station'); # legacy entry point $r->get('/_auto')->to('static#geostop'); Loading
lib/DBInfoscreen/Controller/Static.pm +0 −28 Original line number Diff line number Diff line Loading @@ -11,34 +11,6 @@ my %default = ( admode => 'deparr', ); sub redirect { my ($self) = @_; my $input = $self->param('input'); my $params = $self->req->params; $params->remove('input'); for my $param (qw(platforms mode admode via)) { if ( not $params->param($param) or ( exists $default{$param} and $params->param($param) eq $default{$param} ) ) { $params->remove($param); } } $params = $params->to_string; if ( $input =~ m{ ^ [a-zA-Z]{1,5} \s+ \d+ $ }x ) { $self->redirect_to("/z/${input}?${params}"); } else { $self->redirect_to("/${input}?${params}"); } } sub geostop { my ($self) = @_; Loading
lib/DBInfoscreen/Controller/Stationboard.pm +44 −2 Original line number Diff line number Diff line Loading @@ -511,7 +511,7 @@ sub handle_request { $station, { errstr => $err, status => ( $err =~ m{station name$} ? 300 : 500 ), status => ( $err =~ m{Ambiguous|LOCATION} ? 300 : 500 ), }, $api_version ); Loading @@ -521,7 +521,7 @@ sub handle_request { $station, { errstr => $err, status => ( $err =~ m{station name$} ? 300 : 500 ), status => ( $err =~ m{Ambiguous|LOCATION} ? 300 : 500 ), }, $hafas ); Loading Loading @@ -1873,4 +1873,46 @@ sub autocomplete { ); } sub redirect_to_station { my ($self) = @_; my $input = $self->param('input'); my $params = $self->req->params; $params->remove('input'); for my $param (qw(platforms mode admode via)) { if ( not $params->param($param) or ( exists $default{$param} and $params->param($param) eq $default{$param} ) ) { $params->remove($param); } } if ( $input =~ m{ ^ [a-zA-Z]{1,5} \s+ \d+ $ }x ) { $params = $params->to_string; $self->redirect_to("/z/${input}?${params}"); } else { my @candidates = Travel::Status::DE::IRIS::Stations::get_station($input); if ( @candidates == 1 and ( $input eq $candidates[0][0] or lc($input) eq lc( $candidates[0][1] ) or $input eq $candidates[0][2] ) ) { $params->remove('hafas'); } else { $params->param( hafas => 1 ); } $params = $params->to_string; $self->redirect_to("/${input}?${params}"); } } 1;
templates/layouts/app.html.ep +0 −8 Original line number Diff line number Diff line Loading @@ -200,14 +200,6 @@ Bitte eine Station aus der Liste auswählen</div> </label> </div> </div> <div class="field"> <div class="desc"> %= check_box 'hafas' => 1, id => 'id_hafas' <label for="id_hafas"> Bus, Stadtbahn und weiteren Nahverkehr anzeigen (via DB HAFAS mgate) </label> </div> </div> <div class="field"> <div class="desc"> Nur Züge über Loading