source: LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller.pm @ 272

Last change on this file since 272 was 272, checked in by nanardon, 15 years ago
  • add ajax functionnality
File size: 1.3 KB
Line 
1package LATMOS::Accounts::Web::Controller;
2
3use strict;
4use warnings;
5use base 'Catalyst::Controller';
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller - Base class Controller for LATMOS::Accounts::Web
10
11=head1 DESCRIPTION
12
13[enter your description here]
14
15=head1 METHODS
16
17=cut
18
19=head2 default
20
21=cut
22
23sub begin : Private {
24    my ( $self, $c ) = @_;
25
26    my $menu = '';
27    my @menus = (
28        [ 'users' => 'Utilisateurs' ],
29        [ 'create/user' => 'Créer un Utilisateur' ],
30        [ 'groups' => 'Groupes' ],
31        [ 'create/group' => 'Créer un Groupe' ],
32        [ 'sites' => 'Sites' ],
33    );
34    foreach(@menus) {
35        $menu .= sprintf(
36            q{<a href="%s"><span%s>%s</span></a>},
37            $c->uri_for('/' . $_->[0]),
38            ($c->req->path =~ m:^$_->[0]: ? ' id="actif"' : ''),
39            $_->[1],
40        );
41
42    }
43    $c->stash->{mainmenu} = $menu;
44    if (!$c->user_exists && $c->req->path ne 'login') {
45        $c->forward('/login');
46    }
47}
48
49=head2 end
50
51Attempt to render a view, if needed.
52
53=cut 
54
55sub end : ActionClass('RenderView') {
56    my ($self, $c) = @_;
57    $c->forward($c->view('TT'));
58    $c->model('Accounts')->db->rollback;
59}
60
61=head1 AUTHOR
62
63Thauvin Olivier
64
65=head1 LICENSE
66
67This library is free software, you can redistribute it and/or modify
68it under the same terms as Perl itself.
69
70=cut
71
721;
Note: See TracBrowser for help on using the repository browser.