Changeset 180


Ignore:
Timestamp:
04/11/09 02:10:50 (15 years ago)
Author:
nanardon
Message:
  • use template for mail, adding atalyst module (#5)
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r154 r180  
    11This file documents the revision history for Perl extension Vote. 
     2 
     32.00 
     4        - allow to encrypt ballot 
     5        - preserve line break in ballot page 
     6        - group value per ballot 
    27 
    381.00  2009-04-03 16:00 
  • trunk/MANIFEST

    r176 r180  
    3030lib/Vote/Model/Vote.pm 
    3131lib/Vote/Template/Plugin/Mail.pm 
     32lib/Vote/View/Mail.pm 
    3233lib/Vote/View/TT.pm 
    3334Makefile.PL 
     
    5556root/static/js/CalendarPopup.js 
    5657root/static/vote.css 
     58root/mail/poll_request.tt 
    5759root/templates/admin/default.tt 
    5860root/templates/admin/denied.tt 
     
    9799t/controller_Vote.t 
    98100t/model_Vote.t 
     101t/view_Mail.t 
    99102t/view_TT.t 
    100103epoll.yml.example 
  • trunk/lib/Vote/Controller/Ballot.pm

    r128 r180  
    126126} 
    127127 
     128sub end : Private { 
     129    my ($self, $c) = @_; 
     130    if ($c->res->body) { return } 
     131    else { $c->forward(qw/Vote::View::TT/) } 
     132} 
     133 
    128134=head1 AUTHOR 
    129135 
  • trunk/lib/Vote/Controller/Newpoll.pm

    r174 r180  
    3333    $c->stash->{page}{title} = 'Créer un nouveau vote'; 
    3434    if ($c->req->param('mail')) { 
    35         $c->model('Vote')->create_poll_request( 
     35        my $reqid = $c->model('Vote')->create_poll_request( 
    3636            mail => $c->req->param('mail'), 
    37             url => $c->uri_for('/newpoll'), 
    3837            label => $c->req->param('label'), 
    3938        ); 
     39        $c->forward( 
     40            q'Vote::View::Mail', 'render', 
     41            [ 'poll_request.tt', { 
     42                To => $c->req->param('mail'), 
     43                Subject => "New poll request", 
     44                mail => { 
     45                    label => $c->req->param('label'), 
     46                    reqid => $reqid, 
     47                } 
     48            } ]); 
     49 
    4050        $c->stash->{template} = 'newpoll/request.tt'; 
    4151    } 
     
    6272} 
    6373 
     74sub end : Private { 
     75    my ($self, $c) = @_; 
     76    if ($c->res->body) { return } 
     77    else { $c->forward(qw/Vote::View::TT/) } 
     78} 
     79 
    6480=head1 AUTHOR 
    6581 
  • trunk/lib/Vote/Controller/Root.pm

    r128 r180  
    4444=cut  
    4545 
    46 sub end : ActionClass('RenderView') {} 
     46sub end : Private { 
     47    my ($self, $c) = @_; 
     48    if ($c->res->body) { return } 
     49    else { $c->forward(qw/Vote::View::TT/) } 
     50} 
    4751 
    4852=head1 AUTHOR 
  • trunk/lib/Vote/Controller/Vote.pm

    r128 r180  
    4040} 
    4141 
     42sub end : Private { 
     43    my ($self, $c) = @_; 
     44    if ($c->res->body) { return } 
     45    else { $c->forward(qw/Vote::View::TT/) } 
     46} 
     47 
    4248=head1 AUTHOR 
    4349 
  • trunk/lib/Vote/DB.pm

    r175 r180  
    360360 
    361361    $addreq->execute($reqid, $info{label}, $info{mail}); 
    362     my $mailer = new Mail::Mailer 'smtp', Server => (Vote->config->{smtp} || 'localhost'); 
    363     $ENV{MAILADDRESS} = undef; 
    364     $mailer->open({ 
    365         From => 'Voting system <nomail@nomail.com>', # TODO allow to configure this 
    366         To => $info{mail}, 
    367         Subject => 'Votre nouveau vote', 
    368         Vote::DB::common::mail_header(), 
    369     }); 
    370     print $mailer <<EOF; 
    371  
    372 Vous avez demandez la création d'un nouveau vote: 
    373 $info{label} 
    374  
    375 Pour valider votre demande, veuiller allez visitez la page: 
    376 $info{url}/$reqid 
    377  
    378 A bientÃŽt 
    379 EOF 
    380     $mailer->close 
    381         or warn "couldn't send whole message: $!\n"; 
    382362    $self->db->commit; 
    383     1; 
     363    $reqid; 
    384364} 
    385365 
Note: See TracChangeset for help on using the changeset viewer.