Last change
on this file since 144 was
144,
checked in by nanardon, 15 years ago
|
- make AttrForm? model usable also for object creation
|
-
Property svn:keywords set to
Id Rev
|
File size:
1.2 KB
|
Line | |
---|
1 | package LATMOS::Accounts::Web::Controller::Create; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use base 'LATMOS::Accounts::Web::Controller'; |
---|
6 | |
---|
7 | =head1 NAME |
---|
8 | |
---|
9 | LATMOS::Accounts::Web::Controller::Create - Catalyst Controller |
---|
10 | |
---|
11 | =head1 DESCRIPTION |
---|
12 | |
---|
13 | Catalyst Controller. |
---|
14 | |
---|
15 | =head1 METHODS |
---|
16 | |
---|
17 | =cut |
---|
18 | |
---|
19 | |
---|
20 | =head2 index |
---|
21 | |
---|
22 | =cut |
---|
23 | |
---|
24 | sub index : Private { |
---|
25 | my ( $self, $c ) = @_; |
---|
26 | |
---|
27 | $c->response->body('Matched LATMOS::Accounts::Web::Controller::Create in Create.'); |
---|
28 | } |
---|
29 | |
---|
30 | sub user : Local { |
---|
31 | my ( $self, $c ) = @_; |
---|
32 | |
---|
33 | my $base = $c->model('Accounts')->db; |
---|
34 | $c->stash->{form} = $c->model('AttrForms', undef, 'user', $base); |
---|
35 | for ($c->req->param('step') || '') { |
---|
36 | /^1$/ and do { |
---|
37 | $c->stash->{step} = 2; |
---|
38 | $c->req->params->{id} = lc($c->req->param('sn')); |
---|
39 | last; |
---|
40 | }; |
---|
41 | /^2$/ and do { |
---|
42 | $base->create_c_object('user', $c->req->params->{id}, %{ $c->req->params }); |
---|
43 | $base->commit; |
---|
44 | $c->res->redirect($c->uri_for('/users', $c->req->params->{id})); |
---|
45 | last; |
---|
46 | }; |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | =head1 AUTHOR |
---|
51 | |
---|
52 | Thauvin Olivier |
---|
53 | |
---|
54 | =head1 LICENSE |
---|
55 | |
---|
56 | This library is free software, you can redistribute it and/or modify |
---|
57 | it under the same terms as Perl itself. |
---|
58 | |
---|
59 | =cut |
---|
60 | |
---|
61 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.