Last change
on this file since 377 was
369,
checked in by misc, 14 years ago
|
- fix french string that I forgot to translate in english
|
File size:
1.5 KB
|
Line | |
---|
1 | package Epoll::Controller::Ajax; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use base 'Catalyst::Controller'; |
---|
6 | |
---|
7 | =head1 NAME |
---|
8 | |
---|
9 | Epoll::Controller::Ajax - 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 :Path :Args(0) { |
---|
25 | my ( $self, $c ) = @_; |
---|
26 | |
---|
27 | $c->response->body('Matched Epoll::Controller::Ajax in Ajax.'); |
---|
28 | } |
---|
29 | |
---|
30 | sub datecheck :Path { |
---|
31 | my ( $self, $c ) = @_; |
---|
32 | |
---|
33 | my $poll = $c->model('Vote'); |
---|
34 | if ($c->req->param('dstart') && $c->req->param('dend')) { |
---|
35 | |
---|
36 | my $start = $c->req->param('dstart') . ' ' . ($c->req->param('hstart') || ''); |
---|
37 | my $end = $c->req->param('dend') . ' ' . ($c->req->param('hend') || ''); |
---|
38 | |
---|
39 | if ($poll->check_date_max($start)) { |
---|
40 | if ($poll->check_date_max($end, $start)) { |
---|
41 | $c->response->body('<input type="submit" name="polldate" value="' . $c->localize('Save') . '">'); |
---|
42 | } else { |
---|
43 | |
---|
44 | $c->response->body( $c->localize('The vote finish before starting')); |
---|
45 | } |
---|
46 | } else { |
---|
47 | $c->response->body( $c->localize('The start of the vote must be in the future')); |
---|
48 | } |
---|
49 | } else { |
---|
50 | $c->response->body( $c->localize('You must define a start and a end date')); |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | sub end : Private { |
---|
55 | my ($self, $c) = @_; |
---|
56 | if ($c->res->body) { return } |
---|
57 | else { $c->forward(qw/Epoll::View::Ajax/) } |
---|
58 | } |
---|
59 | |
---|
60 | |
---|
61 | =head1 AUTHOR |
---|
62 | |
---|
63 | Olivier Thauvin |
---|
64 | |
---|
65 | =head1 LICENSE |
---|
66 | |
---|
67 | This library is free software. You can redistribute it and/or modify |
---|
68 | it under the same terms as Perl itself. |
---|
69 | |
---|
70 | =cut |
---|
71 | |
---|
72 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.