Changeset 221 for trunk


Ignore:
Timestamp:
04/20/09 03:24:26 (15 years ago)
Author:
nanardon
Message:
  • add a select build from voting list on ballot
Location:
trunk
Files:
5 edited

Legend:

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

    r217 r221  
    7474                map { $_ => ($c->req->param($_) || undef) } 
    7575                grep { exists($c->req->params->{$_}) } 
    76                 qw(label description start end choice_count free_choice elected_count) 
     76                qw(label description start end choice_count free_choice elected_count elected_choice) 
    7777            ) and $poll->commit; 
    7878        } elsif ($c->req->param('encrypted')) { 
  • trunk/lib/Vote/Controller/Ballot.pm

    r219 r221  
    8484        lc($_) 
    8585    } ($c->req->param('fsbal')) ]; 
     86    $c->stash->{esbal} = [ grep { $_ } $c->req->param('esbal') ]; 
     87 
    8688    $c->request->parameters->{fsbal} = $c->stash->{fsbal}; 
    8789 
    8890    my @sbalval = grep { $_ } map { lc($choices{$_} || '') } $c->req->param('sbal'); 
    8991 
    90     my @ballot = grep { $_ } (@sbalval, @{$c->stash->{fsbal} || []}); 
     92    my @ballot = grep { $_ } ( 
     93        @sbalval, 
     94        @{$c->stash->{fsbal} || []}, 
     95        @{$c->stash->{esbal} || []}, 
     96    ); 
    9197    if (scalar(@ballot) > $poll->info('choice_count')) { 
    9298        $c->req->parameters->{'ballot'} = ''; 
  • trunk/root/templates/admin/ballot.tt

    r217 r221  
    2020<td>Nombre de choix libres:</td> 
    2121<td><input type="text" size="3" name="free_choice" value="[% c.req.param('free_choice') || poll.info('free_choice') || 0 | html %]"></td> 
     22</tr> 
     23 
     24<tr> 
     25<td>Nombre de choix à partir de la liste des électeurs:</td> 
     26<td><input type="text" size="3" name="elected_choice" value="[% c.req.param('elected_choice') || poll.info('elected_choice') || 0 | html %]"></td> 
    2227</tr> 
    2328 
  • trunk/root/templates/ballot/default.tt

    r206 r221  
    2424<input type="hidden" name="fsbal" value="[% ch %]"> 
    2525[% END %] 
    26 [% IF ! c.req.param('fsbal').size && ! c.req.param('sbal').size %] 
     26[% FOREACH ch = c.req.param('esbal') %] 
     27[% ch | html %]<br> 
     28<input type="hidden" name="esbal" value="[% ch %]"> 
     29[% END %] 
     30[% IF ! c.req.param('fsbal').size && ! c.req.param('sbal').size && ! c.req.param('esbal').size %] 
    2731<i>Vote blanc</i><br> 
    2832[% END %] 
  • trunk/root/templates/includes/ballot_form.tt

    r219 r221  
    33<!-- $Id$ --> 
    44[% FOREACH key = poll.choices() %] 
     5[% "<p>Candidats:</p>" IF loop.first %] 
    56[% choice = poll.choice(key) %] 
    67<input type="checkbox" name="sbal" value="[% key %]"[% " checked" IF sbal.$key %]> 
     
    1011[% count = 0 %] 
    1112[% WHILE count < (poll.info('elected_choice') || 0) %] 
     13[% "<p>Depuis la liste électorale</p>" IF count == 0 %] 
    1214[% FOREACH vkey = poll.voting_keys %] 
    1315[% voting = poll.voting(vkey) %] 
    1416[% '<select name="esbal"><option value=""></option>' IF loop.first %] 
    15 <option value="[% voting.info.id || voting.info.mail | html %]"> 
    16     [% voting.info.id || voting.info.mail | html %] 
     17<option value="[% voting.info.label || voting.info.mail | html %]" 
     18    [% " selected" IF esbal.$count == (voting.info.label || voting.info.mail) %]> 
     19    [% voting.info.label || voting.info.mail | html %] 
    1720</option> 
    1821[% '</select>' IF loop.last %] 
Note: See TracChangeset for help on using the changeset viewer.