Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
db-infoscreen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
db-infoscreen
Commits
ce21810e
Commit
ce21810e
authored
8 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
(sort of) support station names containing slashes
parent
37aba10e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
index.pl
+15
-10
15 additions, 10 deletions
index.pl
with
15 additions
and
10 deletions
index.pl
+
15
−
10
View file @
ce21810e
...
@@ -306,7 +306,7 @@ helper 'json_route_diff' => sub {
...
@@ -306,7 +306,7 @@ helper 'json_route_diff' => sub {
sub
handle_request
{
sub
handle_request
{
my
$self
=
shift
;
my
$self
=
shift
;
my
$station
=
$self
->
stash
('
station
');
my
$station
=
$self
->
stash
('
station
');
my
$via
=
$self
->
stash
('
via
');
my
$via
=
$self
->
stash
('
via
')
//
$self
->
param
('
via
')
;
my
@platforms
=
split
(
/,/
,
$self
->
param
('
platforms
')
//
q{}
);
my
@platforms
=
split
(
/,/
,
$self
->
param
('
platforms
')
//
q{}
);
my
@lines
=
split
(
/,/
,
$self
->
param
('
lines
')
//
q{}
);
my
@lines
=
split
(
/,/
,
$self
->
param
('
lines
')
//
q{}
);
...
@@ -365,6 +365,18 @@ sub handle_request {
...
@@ -365,6 +365,18 @@ sub handle_request {
return
;
return
;
}
}
# foo/bar used to mean "departures for foo via bar", and this is still the
# default. However, there are also stations named "foo/bar". So, if
# "foo" is not a valid station, try "foo/bar" instead
if
(
not
@results
and
$self
->
stash
('
via
'))
{
$station
=
"
$station
/
$via
";
$via
=
undef
;
$data
=
get_results_for
(
$backend
,
$station
,
%opt
);
$results_ref
=
$data
->
{
results
};
$errstr
=
$data
->
{
errstr
};
@results
=
@
{
$results_ref
};
}
if
(
not
@results
)
{
if
(
not
@results
)
{
$self
->
handle_no_results
(
$backend
,
$station
,
$errstr
);
$self
->
handle_no_results
(
$backend
,
$station
,
$errstr
);
return
;
return
;
...
@@ -847,13 +859,11 @@ sub handle_request {
...
@@ -847,13 +859,11 @@ sub handle_request {
get
'
/_redirect
'
=>
sub
{
get
'
/_redirect
'
=>
sub
{
my
$self
=
shift
;
my
$self
=
shift
;
my
$station
=
$self
->
param
('
station
');
my
$station
=
$self
->
param
('
station
');
my
$via
=
$self
->
param
('
via
');
my
$params
=
$self
->
req
->
params
;
my
$params
=
$self
->
req
->
params
;
$params
->
remove
('
station
');
$params
->
remove
('
station
');
$params
->
remove
('
via
');
for
my
$param
(
qw(platforms backend mode admode)
)
{
for
my
$param
(
qw(platforms backend mode admode
via
)
)
{
if
(
if
(
not
$params
->
param
(
$param
)
not
$params
->
param
(
$param
)
or
(
exists
$default
{
$param
}
or
(
exists
$default
{
$param
}
...
@@ -866,12 +876,7 @@ get '/_redirect' => sub {
...
@@ -866,12 +876,7 @@ get '/_redirect' => sub {
$params
=
$params
->
to_string
;
$params
=
$params
->
to_string
;
if
(
$via
)
{
$self
->
redirect_to
("
/
${station}
?
${params}
");
$self
->
redirect_to
("
/
${station}
/
${via}
?
${params}
");
}
else
{
$self
->
redirect_to
("
/
${station}
?
${params}
");
}
};
};
get
'
/_auto
'
=>
sub
{
get
'
/_auto
'
=>
sub
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment