Changeset 181


Ignore:
Timestamp:
04/11/09 02:39:36 (15 years ago)
Author:
nanardon
Message:
  • ballot confirm now use template
Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MANIFEST

    r180 r181  
    5757root/static/vote.css 
    5858root/mail/poll_request.tt 
     59root/mail/ballot_confirm.tt 
    5960root/templates/admin/default.tt 
    6061root/templates/admin/denied.tt 
  • trunk/lib/Vote/Controller/Ballot.pm

    r180 r181  
    117117            $c->req->address, 
    118118        ); # TODO trap error 
    119         $vote->mail_ballot_confirm($mail, $id, { 
    120                 ballotid => $c->stash->{ballotid}, 
    121                 url => $c->uri_for('/vote', $id), 
    122         }); 
     119        $c->forward( 
     120            q'Vote::View::Mail', 'render', 
     121            [ 'ballot_confirm.tt', { 
     122                From => $mail, 
     123                To => $mail, 
     124                Subject => 'Confirmation de vote: ' . $vote->vote_info($id)->{label}, 
     125                mail => { 
     126                    ballotid => $c->stash->{ballotid}, 
     127                    voteid => $id, 
     128                } 
     129            } ] 
     130        ); 
     131 
    123132        $c->stash->{template} = 'ballot/done.tt'; 
    124133        $c->delete_session('Vote terminé'); 
  • trunk/lib/Vote/Controller/Newpoll.pm

    r180 r181  
    4646                    reqid => $reqid, 
    4747                } 
    48             } ]); 
     48            } ] 
     49        ); 
    4950 
    5051        $c->stash->{template} = 'newpoll/request.tt'; 
  • trunk/lib/Vote/DB.pm

    r180 r181  
    66use warnings; 
    77use Vote; 
    8 use Mail::Mailer; 
    98use base 'Vote::DB::common'; 
    109use Vote::DB::Poll; 
     
    172171} 
    173172 
    174 sub mail_ballot_confirm { 
    175     my ($self, $vid, $voteid, $info) = @_; 
    176     $self->poll($voteid)->mail_ballot_confirm($vid, $info); 
    177 } 
    178  
    179173sub vote_voting_count { 
    180174    my ($self, $id) = @_; 
  • trunk/lib/Vote/DB/Poll.pm

    r176 r181  
    66use warnings; 
    77use Vote; 
    8 use Mail::Mailer; 
    98use Crypt::RSA; 
    109use Crypt::RSA::Key::Public::SSH; 
     
    446445} 
    447446 
    448 sub mail_ballot_confirm { 
    449     my ($self, $vid, $info) = @_; 
    450     my $voteinfo = $self->info or return; 
    451     $info->{ballotid} or return; 
    452     my $mailer = new Mail::Mailer 'smtp', Server => (Vote->config->{smtp} || 'localhost'); 
    453     $ENV{MAILADDRESS} = $vid; 
    454     $mailer->open({ 
    455         From => $vid, # TODO allow to configure this 
    456         To => $vid, 
    457         Subject => 'Confirmation de vote: ' . $voteinfo->{label}, 
    458         Vote::DB::common::mail_header(), 
    459     }); 
    460     print $mailer <<EOF; 
    461  
    462 Vous venez de participer au vote: 
    463  
    464 -------- 
    465 $voteinfo->{label} 
    466 -------- 
    467  
    468 Votre bulletin est idéntifié sous le numéro: 
    469 $info->{ballotid} 
    470  
    471 Les résultats seront disponibles à cet url: 
    472 $info->{url} 
    473  
    474 Cordialement. 
    475 EOF 
    476     $mailer->close 
    477         or warn "couldn't send whole message: $!\n"; 
    478  
    479 } 
    480  
    481447sub voting_count { 
    482448    my ($self) = @_; 
Note: See TracChangeset for help on using the changeset viewer.