1 | package LATMOS::Accounts::Web::Controller::NetZones; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use base 'Catalyst::Controller'; |
---|
6 | |
---|
7 | =head1 NAME |
---|
8 | |
---|
9 | LATMOS::Accounts::Web::Controller::Users - 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 : Private { |
---|
25 | my ( $self, $c ) = @_; |
---|
26 | |
---|
27 | $c->stash->{ofilter} = $c->model('AttrFilter', 'netzone'); |
---|
28 | $c->stash->{page}{title} = "Liste des zones réseaux"; |
---|
29 | } |
---|
30 | |
---|
31 | sub default : LocalPath { |
---|
32 | my ( $self, $c, undef, $netzonename ) = @_; |
---|
33 | |
---|
34 | my $base = $c->model('Accounts')->db; |
---|
35 | $c->stash->{netzone} = $base->get_object('netzone', $netzonename) or do { |
---|
36 | $c->forward('/no_object'); |
---|
37 | return; |
---|
38 | }; |
---|
39 | $c->stash->{page}{title} = "Zone réseau :: $netzonename"; |
---|
40 | $c->stash->{netzonename} = $netzonename; |
---|
41 | $c->stash->{form} = $c->model('AttrForms', 'netzone', $c->stash->{netzone}); |
---|
42 | $c->stash->{form}->set_attrs; |
---|
43 | |
---|
44 | if ($c->req->param('make_active')) { |
---|
45 | $c->stash->{netzone}->set_c_fields('exported' => 1); |
---|
46 | $base->commit; |
---|
47 | } |
---|
48 | if ($c->req->param('make_inactive')) { |
---|
49 | $c->stash->{netzone}->set_c_fields('exported' => 0); |
---|
50 | $base->commit; |
---|
51 | } |
---|
52 | if ($c->req->param('delete')) { |
---|
53 | $base->delete_object('netzone', $netzonename); |
---|
54 | $base->commit; |
---|
55 | $c->res->redirect('/netzones'); |
---|
56 | } |
---|
57 | } |
---|
58 | |
---|
59 | =head1 AUTHOR |
---|
60 | |
---|
61 | Thauvin Olivier |
---|
62 | |
---|
63 | =head1 LICENSE |
---|
64 | |
---|
65 | This library is free software, you can redistribute it and/or modify |
---|
66 | it under the same terms as Perl itself. |
---|
67 | |
---|
68 | =cut |
---|
69 | |
---|
70 | 1; |
---|