Changeset 75


Ignore:
Timestamp:
03/18/09 17:33:20 (15 years ago)
Author:
nanardon
Message:
  • fix #8: allow to change voting list during poll
Location:
trunk
Files:
2 edited

Legend:

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

    r74 r75  
    5656    $c->stash->{page}{title} = $c->model('Vote')->vote_info($id)->{label} . ': Administration'; 
    5757 
    58     if ($vote->vote_status($id) eq 'BEFORE') { 
    59         if (my ($upload) = $c->req->upload('votinglist')) { 
    60             $vote->voting_from_file( 
    61                 $id, 
    62                 $upload->fh, 
    63                 $c->req->param('delete'), 
    64             ) and $vote->db->commit; 
    65         } elsif ($c->req->param('addch')) { 
     58    warn $vote->vote_status($id); 
     59    for ($vote->vote_status($id) || '') { 
     60    /^BEFORE$/ and do { 
     61        if ($c->req->param('addch')) { 
    6662            $vote->vote_add_choice($id, $c->req->param('addch')) 
    6763                and $vote->db->commit; 
     
    8581                qw(label description start end choice_count free_choice) 
    8682            ) and $vote->db->commit; 
     83        } 
     84    }; 
     85 
     86    /^(BEFORE|RUNNING)$/ and do { 
     87        warn "XX"; 
     88        if (my ($upload) = $c->req->upload('votinglist')) { 
     89            $vote->voting_from_file( 
     90                $id, 
     91                $upload->fh, 
     92                $c->req->param('delete'), 
     93            ) and $vote->db->commit; 
    8794        } elsif($c->req->param('delvoting')) { 
    8895            $vote->delete_voting($c->req->param('delvoting')) 
     
    96103            }); 
    97104        } 
    98     } elsif ($vote->vote_status($id) eq 'AFTER') { 
     105    }; 
     106 
     107    /^AFTER$/ and do { 
    99108        if ($c->req->param('mapfrom') && $c->req->param('mapto')) { 
    100109            $vote->vote_map_value( 
     
    115124            } 
    116125        } 
    117     } else { 
    118         # can't modify vote after date 
    119         $c->stash->{template} = 'admin/denied.tt'; 
    120         return; 
     126    }; 
    121127    } 
    122128 
  • trunk/root/templates/admin/default.tt

    r73 r75  
    6666</tr> 
    6767</table> 
    68  
     68[% ELSE %] 
     69[% INCLUDE 'includes/poll.tt' %] 
     70[% END %] 
    6971<hr> 
    7072 
     73[% IF vote.vote_status(voteid) != 'AFTER' %] 
    7174Liste des votants : 
    7275<table border="1"> 
Note: See TracChangeset for help on using the changeset viewer.