source: trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Sites.pm @ 1650

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

fix conflict

  • Property svn:keywords set to Id Rev
File size: 1.6 KB
Line 
1package LATMOS::Accounts::Web::Controller::Sites;
2
3use strict;
4use warnings;
5use base 'Catalyst::Controller';
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Site - 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', 'site');
28    $c->stash->{page}{title} = "Liste des sites";
29}
30
31sub default : LocalPath {
32    my ( $self, $c, undef, $sitename, $subform ) = @_;
33
34    my $base = $c->model('Accounts')->db;
35
36    $c->stash->{page}{title} = "Site :: $sitename";
37    $c->stash->{sitename} = $sitename;
38    $c->stash->{site} = $base->get_object('site', $sitename) or do {
39        $c->forward('/no_object');
40        return;
41    };
42
43    if ($c->req->param('make_active')) {
44        $c->stash->{site}->set_c_fields('exported' => 1);
45        $base->commit;
46    }
47    if ($c->req->param('make_inactive')) {
48        $c->stash->{site}->set_c_fields('exported' => 0);
49        $base->commit;
50    }
51    if ($c->req->param('delete')) {
52        $base->delete_object('site', $sitename);
53        $base->commit;
54        $c->res->redirect('/sites');
55    }
56
57    $c->stash->{subform} = $subform || '';
58
59    for ($subform) {
60        # Exceptions...
61        # /^$/ $c->stash->{template} =
62
63        $c->stash->{form} = $c->model('AttrForms', 'site' . $c->stash->{subform}, $c->stash->{site});
64        $c->stash->{form}->set_attrs;
65    }
66}
67
68=head1 AUTHOR
69
70Thauvin Olivier
71
72=head1 LICENSE
73
74This library is free software, you can redistribute it and/or modify
75it under the same terms as Perl itself.
76
77=cut
78
791;
Note: See TracBrowser for help on using the repository browser.