/[A3C]/lib/A3C/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 /lib/A3C/Dispatcher.pm

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

revision 55 by dpavlin, Tue Apr 1 19:39:00 2008 UTC revision 197 by dpavlin, Tue Jun 17 21:32:12 2008 UTC
# Line 3  package A3C::Dispatcher; Line 3  package A3C::Dispatcher;
3  use strict;  use strict;
4  use warnings;  use warnings;
5    
6    =head1 NAME
7    
8    A3C::Displatcher
9    
10    =head1 DESCRIPTION
11    
12    Create top-level menu navigation
13    
14    =cut
15    
16  use Jifty::Dispatcher -base;  use Jifty::Dispatcher -base;
17    
18  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
19    
20  before '*' => run {  before '*' => run {
21            warn "## ", Jifty->web->request->path;
22            Jifty->web->tangent(url => '/ldaplogin')
23                    if ( ! Jifty->web->current_user->id && Jifty->web->request->path !~ m{^/(?:ldaplogin|__jifty)} );
24    
25          my $top = Jifty->web->navigation;          my $top = Jifty->web->navigation;
26          my $user = Jifty->web->current_user->user_object;          my $user = Jifty->web->current_user->user_object;
27    
28  #       Jifty->log->debug("current_user = ", dump( $user ));  #       Jifty->log->debug("current_user = ", dump( $user ));
29    
30          $top->child( _('Find People') => url => '/search-users' );          $top->child( _('People') => url => '/people' );
31          $top->child( _('Sync Organization') => url => '/sync' );          my $o = $top->child( _('Organizations') => url => '/organizations' );
32            $o->child( _('New') => url => '/organizations/new' );
33    
34            $top->child( _('Sync') => url => '/sync' );
35            $top->child( _('LDAP') => url => '/ldap' );
36            my $strix = $top->child( _('Strix') => url => '/strix' );
37            $strix->child( _('Name differences') => url => '/strix/name_diff' );
38            $strix->child( _('SQL') => url => '/strix/sql' );
39            $strix->child( _('Navigation') => url => '/strix/site-navigation' );
40            $strix->child( _('Layout') => url => '/strix/layout' );
41    
42  #       $top->child( 'Prefs' => url => '/prefs' ) if Jifty->web->current_user->id;  #       $top->child( 'Prefs' => url => '/prefs' ) if Jifty->web->current_user->id;
43    
44  };  };
45    
46    sub first_instance {
47            my $selection = A3C::Model::StrixInstanceSelectionCollection->new;
48            $selection->unlimit;
49            my $instance = $selection->first->instance->instance;
50            warn "# using default instance $instance";
51            return $instance;
52    }
53    
54    before '/strix/' => run {
55    
56            if ( ! get('instance') ) {
57                    set 'instance' => first_instance;
58            }
59    
60    };
61    
62  1;  1;

Legend:
Removed from v.55  
changed lines
  Added in v.197

  ViewVC Help
Powered by ViewVC 1.1.26