package LATMOS::Accounts::Web::Controller::Sites; use strict; use warnings; use base 'Catalyst::Controller'; =head1 NAME LATMOS::Accounts::Web::Controller::Site - Catalyst Controller =head1 DESCRIPTION Catalyst Controller. =head1 METHODS =cut =head2 index =cut sub index : Private { my ( $self, $c ) = @_; $c->stash->{ofilter} = $c->model('AttrFilter', 'site'); $c->stash->{page}{title} = "Liste des sites"; } sub default : LocalPath { my ( $self, $c, undef, $sitename, $subform ) = @_; my $base = $c->model('Accounts')->db; $c->stash->{page}{title} = "Site :: $sitename"; $c->stash->{sitename} = $sitename; $c->stash->{site} = $base->get_object('site', $sitename) or do { $c->forward('/no_object'); return; }; if ($c->req->param('make_active')) { $c->stash->{site}->set_c_fields('exported' => 1); $base->commit; } if ($c->req->param('make_inactive')) { $c->stash->{site}->set_c_fields('exported' => 0); $base->commit; } if ($c->req->param('delete')) { $base->delete_object('site', $sitename); $base->commit; $c->res->redirect('/sites'); } $c->stash->{subform} = $subform || ''; for ($subform) { # Exceptions... # /^$/ $c->stash->{template} = $c->stash->{form} = $c->model('AttrForms', 'site' . $c->stash->{subform}, $c->stash->{site}); $c->stash->{form}->set_attrs; } } =head1 AUTHOR Thauvin Olivier =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1;