source: LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Groups.pm @ 125

Last change on this file since 125 was 125, checked in by nanardon, 15 years ago
  • add group form
File size: 1.4 KB
Line 
1package LATMOS::Accounts::Web::Controller::Groups;
2
3use strict;
4use warnings;
5use base 'Catalyst::Controller';
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Groups - 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    my $base = $c->model('Accounts')->db;
27    my %filter = map  {
28        $c->req->params->{attr}[$_] && $c->req->params->{attrval}[$_]
29        ? ($c->req->params->{attr}[$_] => $c->req->params->{attrval}[$_])
30        : ()
31    } (0 .. $#{ $c->req->params->{attr} || []});
32    $c->stash->{groupslist} = %filter
33        ? [ $base->search_objects('group', %filter) ]
34        : [ $base->list_objects('group') ];
35}
36
37sub default : LocalPath {
38    my ( $self, $c, undef, $groupname, $subform ) = @_;
39
40    my $base = $c->model('Accounts')->db;
41
42    $c->stash->{groupname} = $groupname;
43    $c->stash->{group} = $base->get_object('group', $groupname);
44    $c->stash->{subform} = $subform || '';
45
46    for ($subform) {
47        # Exceptions...
48        # /^$/ $c->stash->{template} =
49
50        $c->stash->{form} = $c->model('AttrForms', 'group' . $c->stash->{subform}, $c->stash->{group});
51        $c->stash->{form}->set_attrs;
52    }
53}
54
55=head1 AUTHOR
56
57Thauvin Olivier
58
59=head1 LICENSE
60
61This library is free software, you can redistribute it and/or modify
62it under the same terms as Perl itself.
63
64=cut
65
661;
Note: See TracBrowser for help on using the repository browser.