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

Last change on this file since 718 was 718, checked in by nanardon, 14 years ago
  • trap error when object does not exists instead dying
  • Property svn:keywords set to Id Rev
File size: 1.2 KB
Line 
1package LATMOS::Accounts::Web::Controller::Sites;
2
3use strict;
4use warnings;
5use base 'LATMOS::Accounts::Web::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->{siteslist} = [  map { $_->id } @{ $c->stash->{objectslist} } ];
29}
30
31sub default : LocalPath {
32    my ( $self, $c, undef, $sitename, $subform ) = @_;
33
34    my $base = $c->model('Accounts')->db;
35
36    $c->stash->{sitename} = $sitename;
37    $c->stash->{site} = $base->get_object('site', $sitename) or do {
38        $c->forward('/no_object');
39        return;
40    };
41
42    $c->stash->{subform} = $subform || '';
43
44    for ($subform) {
45        # Exceptions...
46        # /^$/ $c->stash->{template} =
47
48        $c->stash->{form} = $c->model('AttrForms', 'site' . $c->stash->{subform}, $c->stash->{site});
49        $c->stash->{form}->set_attrs;
50    }
51}
52
53=head1 AUTHOR
54
55Thauvin Olivier
56
57=head1 LICENSE
58
59This library is free software, you can redistribute it and/or modify
60it under the same terms as Perl itself.
61
62=cut
63
641;
Note: See TracBrowser for help on using the repository browser.