package LATMOS::Accounts::Web::Controller::Sites;

use strict;
use warnings;
use base 'LATMOS::Accounts::Web::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->{siteslist} = [  map { $_->id } @{ $c->stash->{objectslist} } ];
}

sub default : LocalPath {
    my ( $self, $c, undef, $sitename, $subform ) = @_;

    my $base = $c->model('Accounts')->db;

    $c->stash->{sitename} = $sitename;
    $c->stash->{site} = $base->get_object('site', $sitename);
    $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;
