source: trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/NetZones.pm @ 1632

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

fix conflict

File size: 1.5 KB
Line 
1package LATMOS::Accounts::Web::Controller::NetZones;
2
3use strict;
4use warnings;
5use base 'Catalyst::Controller';
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Users - 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 : 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
31sub 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
61Thauvin Olivier
62
63=head1 LICENSE
64
65This library is free software, you can redistribute it and/or modify
66it under the same terms as Perl itself.
67
68=cut
69
701;
Note: See TracBrowser for help on using the repository browser.