8 |
|
|
9 |
=head1 Transports operations |
=head1 Transports operations |
10 |
|
|
11 |
=head2 /transports/create |
=head2 /transports/create/new |
12 |
|
|
13 |
=cut |
=cut |
14 |
|
|
15 |
on 'transports/create/new', run { |
on '/transports/create/new' => run { |
16 |
|
|
17 |
my $landscape_id = get('landscape_id'); |
my $landscape_id = get('landscape_id'); |
18 |
if (! $landscape_id) { |
if (! $landscape_id) { |
23 |
value => Jifty->web->current_user->id, |
value => Jifty->web->current_user->id, |
24 |
quote_value => 0, |
quote_value => 0, |
25 |
); |
); |
26 |
$landscapes->order_by({ column => 'landscape' }); |
$landscapes->order_by( column => 'landscape' ); |
27 |
|
|
28 |
if ($landscapes->count == 0) { |
if ($landscapes->count == 0) { |
29 |
show '/transports/create/no_landscape'; |
show '/transports/create/no_landscape'; |
63 |
set 'transport' => $transport; |
set 'transport' => $transport; |
64 |
|
|
65 |
show '/transports/create/new'; |
show '/transports/create/new'; |
66 |
} |
}; |
67 |
|
|
68 |
=head1 Login and logout operations |
=head1 Login and logout operations |
69 |
|
|
|
=head2 login |
|
|
|
|
|
=cut |
|
|
|
|
|
on '--login', run { |
|
|
|
|
|
set 'action' => |
|
|
Jifty->web->new_action( class => 'Login', moniker => 'loginbox' ); |
|
|
set 'next' => Jifty->web->request->continuation |
|
|
|| Jifty::Continuation->new( |
|
|
request => Jifty::Request->new( path => '/transports' ) ); |
|
|
show '/login'; |
|
|
}; |
|
|
|
|
70 |
=head2 logout |
=head2 logout |
71 |
|
|
72 |
=cut |
=cut |
73 |
|
|
74 |
before 'logout', run { |
before '/logout', run { |
75 |
Jifty->web->request->add_action( |
Jifty->web->request->add_action( |
76 |
moniker => 'logout', |
moniker => 'logout', |
77 |
class => 'Transports::Action::Logout' |
class => 'Transports::Action::Logout' |
78 |
); |
); |
79 |
|
warn "added Transports::Action::Logout"; |
80 |
}; |
}; |
81 |
|
|
82 |
|
|
84 |
# able to edit files in place. These should become a plugin of some |
# able to edit files in place. These should become a plugin of some |
85 |
# sort, when we have that infrastructure. |
# sort, when we have that infrastructure. |
86 |
|
|
87 |
before '*' => run { |
before '*', run { |
88 |
|
|
89 |
my $url = Jifty->web->request->path; |
my $url = Jifty->web->request->path; |
90 |
|
|
91 |
warn "hmmm.... url = $url\n"; |
warn "before url: $url"; |
92 |
|
|
93 |
return if ($url eq '/' || $url eq '/login' || $url =~ m#^/__jifty/#); |
next_rule if ($url eq '/' || $url =~ m#^/(?:login|logout|__jifty)/*#); |
94 |
|
|
95 |
Jifty->api->allow(qr/^Jifty::Action::Devel/) |
Jifty->api->allow(qr/^Jifty::Action::Devel/) |
96 |
if Jifty->config->framework('DevelMode'); |
if Jifty->config->framework('DevelMode'); |
99 |
warn "send user accessing $url to login form\n"; |
warn "send user accessing $url to login form\n"; |
100 |
Jifty->web->tangent( url => '/login' ); |
Jifty->web->tangent( url => '/login' ); |
101 |
} |
} |
102 |
|
|
103 |
}; |
}; |
104 |
|
|
105 |
on qr'^/__jifty/edit/(.*?)/(.*)$', run { |
on qr'^/__jifty/edit/(.*?)/(.*)$', run { |
116 |
show '/__jifty/edit_file'; |
show '/__jifty/edit_file'; |
117 |
}; |
}; |
118 |
|
|
119 |
|
use Data::Dumper; |
120 |
|
foreach my $s ( qw/SETUP RUN CLEANUP/ ) { |
121 |
|
Jifty->log->debug("$s rules:\n", join("\n", |
122 |
|
map { my ($on,$what) = @$_ ; "\t$on $what" } @{ 'RULES_' . $s } ) |
123 |
|
); |
124 |
|
} |
125 |
|
|
126 |
1; |
1; |