/[SQLSession]/trunk/lib/SQLSession/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

Diff of /trunk/lib/SQLSession/Dispatcher.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 33 by dpavlin, Sat Dec 9 01:15:02 2006 UTC revision 58 by dpavlin, Thu Jan 25 13:08:06 2007 UTC
# Line 9  use Data::Dump qw/dump/; Line 9  use Data::Dump qw/dump/;
9    
10  before '*' => run {  before '*' => run {
11          my $top = Jifty->web->navigation;          my $top = Jifty->web->navigation;
12          my $edit = Jifty->config->app('edit');          my $edit = Jifty->web->current_user->role('edit');
13          $top->child( 'New' => url => '/new' ) if ($edit);          $top->child( 'New' => url => '/new' ) if ($edit);
14          $top->child( 'List' => url => '/list' );          my $l = $top->child( 'List' => url => '/list' );
15    
16            my $databases = SQLSession::Model::DatabaseCollection->new();
17            $databases->unlimit;
18            while ( my $db = $databases->next ) {
19                    my $label = $db->name;
20    #               $label .= ' [' . $db->dsn . ']' if ($edit);
21                    my $url = '/list/database/' . $db->id;
22                    my $path = Jifty->web->request->path;
23    #               warn "url: $url path: $path\n";
24                    $l->child( $label => url => $url => active => ( $url eq $path ) );
25            }
26    
27            if ( Jifty->web->current_user->id ) {
28                    $top->child( 'Logout' => url => '/logout' );
29            } else {
30                    $top->child( 'Login' => url => '/login' );
31                    $top->child( 'Signup' => url => '/signup' );
32            }
33    
34            if ( Jifty->web->current_user->role( 'admin' ) ) {
35                    $top->child( 'Docs' => url => '/__jifty/online_docs/' );
36                    $top->child( 'Administration' => url => '/__jifty/admin/' );
37            }
38    
39  };  };
40    
41    
# Line 31  under qr{sql/(\d+)} => run { Line 55  under qr{sql/(\d+)} => run {
55    
56  };  };
57    
58    under 'list' => [
59    
60            on qr{database/(\d+)} => run {
61                    set database_id => $1;
62            },
63    
64            show '/list',
65    ];
66    
67  on 'new' => run {  on 'new' => run {
68          show '/sql';          show '/sql';
69  };  };

Legend:
Removed from v.33  
changed lines
  Added in v.58

  ViewVC Help
Powered by ViewVC 1.1.26