Line | |
---|
1 | package LATMOS::Accounts::Web::Controller::Aliases; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use base 'Catalyst::Controller'; |
---|
6 | |
---|
7 | =head1 NAME |
---|
8 | |
---|
9 | LATMOS::Accounts::Web::Controller::Aliases - Catalyst Controller |
---|
10 | |
---|
11 | =head1 DESCRIPTION |
---|
12 | |
---|
13 | Catalyst Controller. |
---|
14 | |
---|
15 | =head1 METHODS |
---|
16 | |
---|
17 | =cut |
---|
18 | |
---|
19 | |
---|
20 | =head2 index |
---|
21 | |
---|
22 | =cut |
---|
23 | |
---|
24 | sub index :Path :Args(0) { |
---|
25 | my ( $self, $c ) = @_; |
---|
26 | |
---|
27 | $c->stash->{ofilter} = $c->model('AttrFilter', 'aliases'); |
---|
28 | } |
---|
29 | |
---|
30 | sub default :LocalPath { |
---|
31 | my ( $self, $c, undef, $alias) = @_; |
---|
32 | |
---|
33 | my $db = $c->model('Accounts')->db; |
---|
34 | |
---|
35 | my $oalias = $db->get_object('aliases', $alias); |
---|
36 | $c->stash->{aliasesname} = $alias; |
---|
37 | $c->stash->{aliases} = $oalias; |
---|
38 | $c->stash->{page}{title} = "Gestion des alias"; |
---|
39 | |
---|
40 | $c->stash->{form} = $c->model('AttrForms', 'aliases', $oalias); |
---|
41 | |
---|
42 | if ($c->req->param('make_active')) { |
---|
43 | $c->stash->{aliases}->set_c_fields('exported' => 1); |
---|
44 | $db->commit; |
---|
45 | } |
---|
46 | elsif ($c->req->param('make_inactive')) { |
---|
47 | $c->stash->{aliases}->set_c_fields('exported' => 0); |
---|
48 | $db->commit; |
---|
49 | } |
---|
50 | elsif ($c->req->param('delete')) { |
---|
51 | $db->delete_object('aliases', $alias); |
---|
52 | $db->commit; |
---|
53 | $c->res->redirect('/aliases'); |
---|
54 | return; |
---|
55 | } |
---|
56 | else { |
---|
57 | $c->stash->{form}->set_attrs; |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | =head1 AUTHOR |
---|
62 | |
---|
63 | Olivier Thauvin |
---|
64 | |
---|
65 | =head1 LICENSE |
---|
66 | |
---|
67 | This library is free software. You can redistribute it and/or modify |
---|
68 | it under the same terms as Perl itself. |
---|
69 | |
---|
70 | =cut |
---|
71 | |
---|
72 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.