source: trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Aliases.pm

Last change on this file was 1162, checked in by nanardon, 12 years ago

fix conflict

File size: 1.4 KB
Line 
1package LATMOS::Accounts::Web::Controller::Aliases;
2
3use strict;
4use warnings;
5use base 'Catalyst::Controller';
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Aliases - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19
20=head2 index
21
22=cut
23
24sub index :Path :Args(0) {
25    my ( $self, $c ) = @_;
26
27    $c->stash->{ofilter} = $c->model('AttrFilter', 'aliases');
28}
29
30sub 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
63Olivier Thauvin
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.