/[transports]/trunk/lib/Transports/Dispatcher.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/Transports/Dispatcher.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 72 - (hide annotations)
Mon Jun 12 03:44:50 2006 UTC (17 years, 11 months ago) by dpavlin
File size: 1469 byte(s)
move redirect to /login if uses isn't logged in to dispatcher (where it should be)
1 dpavlin 5 package Transports::Dispatcher;
2     use Jifty::Dispatcher -base;
3    
4     # Default page
5 dpavlin 25 #on '/', run {
6     # redirect( '/new');
7     #};
8 dpavlin 5
9 dpavlin 31 =head1 Login and logout operations
10    
11     =head2 login
12    
13     =cut
14    
15 dpavlin 40 on qr'^/login(/.*)?$', run {
16    
17     my $return_url = $1 || '/';
18    
19 dpavlin 5 set 'action' =>
20     Jifty->web->new_action( class => 'Login', moniker => 'loginbox' );
21     set 'next' => Jifty->web->request->continuation
22     || Jifty::Continuation->new(
23 dpavlin 40 request => Jifty::Request->new( path => $return_url ) );
24     show '/login';
25 dpavlin 5 };
26    
27 dpavlin 31 =head2 logout
28    
29     =cut
30    
31 dpavlin 5 before 'logout', run {
32     Jifty->web->request->add_action(
33     moniker => 'logout',
34     class => 'Transports::Action::Logout'
35     );
36     };
37    
38 dpavlin 14
39     # These are dispatcher rules that halos and error handling need to be
40     # able to edit files in place. These should become a plugin of some
41     # sort, when we have that infrastructure.
42    
43 dpavlin 72 before qr'^(.*)$', run {
44     my $url = $1 || '/';
45    
46     Jifty->api->allow(qr/^Jifty::Action::Devel/)
47 dpavlin 14 if Jifty->config->framework('DevelMode');
48 dpavlin 72
49     return if ($url eq '/' || $url =~ m#^/login#);
50    
51     if (not Jifty->web->current_user->id) {
52     redirect( '/login' . $url );
53     }
54 dpavlin 14 };
55    
56     on qr'^/__jifty/edit/(.*?)/(.*)$', run {
57     my $editor = Jifty->web->new_action(
58     class => 'Jifty::Action::Devel::FileEditor',
59     moniker => 'editpage',
60     arguments => {
61     source_path => $2,
62     file_type => $1,
63     }
64     );
65    
66     set editor => $editor;
67     show '/__jifty/edit_file';
68     };
69    
70 dpavlin 5 1;

  ViewVC Help
Powered by ViewVC 1.1.26