Changeset 183 for trunk/lib


Ignore:
Timestamp:
04/12/09 18:33:25 (15 years ago)
Author:
nanardon
Message:
  • output a pdf report using LaTeX
Location:
trunk/lib/Vote
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Vote/Controller/Admin.pm

    r182 r183  
    214214} 
    215215 
    216 sub dec: LocalRegex('^(\d+)/dec$') { 
    217     my ($self, $c, $id, @sub) = @_; 
    218     ($c->stash->{voteid}) = @{ $c->req->snippets || [] }; 
    219     my $vote = $c->model('Vote'); 
    220  
    221     $vote->vote_info($id) or do { 
    222         $c->res->redirect($c->uri_for('/')); 
    223         return; 
    224     }; 
    225  
    226     $c->forward('auth') or return; 
    227     $c->stash->{page}{title} = $c->model('Vote')->vote_info( 
    228         $c->stash->{voteid} 
    229     )->{label} . ': Administration, bulletin'; 
    230     $c->model('Vote')->poll($c->stash->{voteid})->decrypted_ballots; 
    231 } 
    232  
    233216sub end : Private { 
    234217    my ($self, $c) = @_; 
    235218    if ($c->res->body) { return } 
     219    elsif ($c->stash->{latex}) { $c->forward(qw/Vote::View::Latex/) } 
    236220    else { $c->forward(qw/Vote::View::TT/) } 
    237221} 
  • trunk/lib/Vote/Controller/Vote.pm

    r180 r183  
    4040} 
    4141 
     42sub report: LocalRegex('^(\d+)/report.(\w+)$') { 
     43    my ($self, $c, $id, @sub) = @_; 
     44    ($c->stash->{voteid}, $c->stash->{format}) = @{ $c->req->snippets || [] }; 
     45    my $vote = $c->model('Vote'); 
     46 
     47    $vote->vote_info($id) or do { 
     48        $c->res->redirect($c->uri_for('/')); 
     49        return; 
     50    }; 
     51 
     52    $c->stash->{template} = 'poll_report.tt'; 
     53    $c->stash->{latex} = 1; 
     54} 
     55 
    4256sub end : Private { 
    4357    my ($self, $c) = @_; 
    4458    if ($c->res->body) { return } 
     59    elsif ($c->stash->{latex}) { $c->forward(qw/Vote::View::Latex/) } 
    4560    else { $c->forward(qw/Vote::View::TT/) } 
    4661} 
Note: See TracChangeset for help on using the changeset viewer.