Changeset 38


Ignore:
Timestamp:
03/16/09 02:48:55 (15 years ago)
Author:
nanardon
Message:
  • more html improvement
Location:
trunk
Files:
1 added
10 edited

Legend:

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

    r33 r38  
    4141 
    4242    $c->session->{vpassword} = $password; 
     43    warn $vote->vote_status($id); 
    4344 
    4445    if ($vote->vote_status($id) eq 'BEFORE') { 
  • trunk/lib/Vote/Controller/Ballot.pm

    r36 r38  
    9191 
    9292    if ($c->req->param('confirm')) { 
    93         $vote->register_ballot( 
     93        $c->stash->{ballotid} = $vote->register_ballot( 
    9494            $mail, 
    9595            $id, 
  • trunk/lib/Vote/Model/Vote.pm

    r34 r38  
    252252} 
    253253 
    254 sub vote_signing_count { 
    255     my ($self, $id) = @_; 
    256  
    257     my $sth = $self->db->prepare_cached( 
    258         q{ 
    259         select count(*) from voting 
    260         where poll = ? 
    261         } 
    262     ); 
    263     $sth->execute($id); 
    264     my $res = $sth->fetchrow_hashref; 
    265     $sth->finish; 
    266     $res->{count} 
    267 } 
    268  
    269254sub vote_choices { 
    270255    my ($self, $id) = @_; 
     
    415400} 
    416401 
    417 sub signing_count { 
     402sub vote_voting_count { 
     403    my ($self, $id) = @_; 
     404 
     405    my $sth = $self->db->prepare_cached( 
     406        q{ 
     407        select count(*) from voting 
     408        where poll = ? 
     409        } 
     410    ); 
     411    $sth->execute($id); 
     412    my $res = $sth->fetchrow_hashref; 
     413    $sth->finish; 
     414    $res->{count} 
     415} 
     416 
     417sub signing_count { vote_signing_count(@_) } 
     418 
     419sub vote_signing_count { 
    418420    my ($self, $voteid) = @_; 
    419421 
     
    431433} 
    432434 
    433 sub ballot_count { 
     435sub ballot_count { vote_ballot_count(@_) } 
     436 
     437sub vote_ballot_count { 
    434438    my ($self, $voteid) = @_; 
    435439 
     
    446450} 
    447451 
    448 sub ballot_count_nonull { 
     452sub ballot_count_nonull { vote_ballot_count_nonull(@_) } 
     453 
     454sub vote_ballot_count_nonull { 
    449455    my ($self, $voteid) = @_; 
    450456 
     
    459465    my $res = $sth->fetchrow_hashref; 
    460466    $sth->finish; 
    461     warn $res->{count}; 
    462467    $res->{count} 
    463468} 
     
    614619        push(@ids, $res); 
    615620    } 
    616     @ids 
     621    \@ids 
    617622} 
    618623 
  • trunk/root/static/vote.css

    r37 r38  
    22    border: 0; 
    33    vertical-align: middle; 
     4} 
     5 
     6td { 
     7    padding: 4px; 
    48} 
    59 
     
    1115 
    1216/* The ID used in epoll */ 
     17 
     18#footer { 
     19    padding-top: 1em; 
     20    margin-top: 1em; 
     21} 
    1322 
    1423#poll_summary { 
     
    4049    background-color: Silver; 
    4150} 
     51 
     52#admin_login { 
     53    border-style: outset; 
     54    border-width: 5px; 
     55    margin-left: 30%; 
     56    margin-right: 30%; 
     57    margin-top: 20px; 
     58    margin-bottom: 20px; 
     59    padding: 10px; 
     60} 
     61 
     62#open_poll {} 
     63 
     64#comming_poll {} 
     65 
     66#closed_poll {} 
     67 
     68#ballot_list {} 
     69 
     70#results {} 
  • trunk/root/templates/admin/login.tt

    r33 r38  
     1[% vote = c.model('Vote') %] 
     2<div id="admin_login"> 
    13<form action="[% c.uri_for('/admin', voteid) %]"> 
     4<p>Veuillez saisir le mot de passe du vote 
     5<i>[% vote.vote_info(voteid).label | html %]</i></p> 
    26<input type="password" name="vpassword"><br> 
    37<input type="submit"> 
    48<form> 
     9</div> 
  • trunk/root/templates/ballot/done.tt

    r37 r38  
     1[% INCLUDE 'includes/poll.tt' %] 
    12 
    23<div id="ballot"> 
    3 Vote réussi. 
     4<p>Vous venez de voter, le numéro de votre bulletin est le <b>[% ballotid %]</b>.</p> 
    45 
    56<p>Les résultats seront disponibles ici: 
  • trunk/root/templates/default.tt

    r15 r38  
    22[% vote = c.model('Vote') %] 
    33 
    4 <p>Vote en cours</p> 
    54 
    65[% FOREACH id = vote.list_running_vote %] 
    7 <p><a href="[% c.uri_for( 'vote', id ) %]">[% vote.vote_info(id).label | html %]</a> 
    8 <a href="[% c.uri_for( 'ballot', id ) %]">Voter</a></p> 
     6[% IF loop.first %] 
     7<div id="open_poll"> 
     8<p>Vote en cours</p> 
     9<ul> 
     10[% END %] 
     11<li><a href="[% c.uri_for( '/vote', id ) %]">[% vote.vote_info(id).label | html %]</a> 
     12<a href="[% c.uri_for( '/ballot', id ) %]">&gt; Voter</a></li> 
     13[% IF loop.last %] 
     14</ul> 
     15</div> 
     16[% END %] 
    917[% END %] 
    1018 
     19[% FOREACH id = vote.list_comming_vote %] 
     20[% IF loop.first %] 
     21<div id="comming_poll"> 
    1122<p>Vote à venir</p> 
    12  
    13 [% FOREACH id = vote.list_comming_vote %] 
    14 <p><a href="[% c.uri_for( 'vote', id ) %]">[% vote.vote_info(id).label | html %]</a></p> 
     23<ul> 
     24[% END %] 
     25<li><a href="[% c.uri_for( 'vote', id ) %]">[% vote.vote_info(id).label | html %]</a> 
     26<a href="[% c.uri_for( '/admin', id ) %]">&gt; Administrer</a></li> 
     27[% IF loop.last %] 
     28</ul> 
     29</div> 
     30[% END %] 
    1531[% END %] 
    1632 
    17 <p>Vote Fermé</p> 
    1833 
    1934[% FOREACH id = vote.list_closed_vote %] 
    20 <p><a href="[% c.uri_for( 'vote', id ) %]">[% vote.vote_info(id).label | html %]</a></p> 
     35[% IF loop.first %] 
     36<div id="closed_poll"> 
     37<p>Vote Fermé</p> 
     38<ul> 
    2139[% END %] 
     40<li><a href="[% c.uri_for( 'vote', id ) %]">[% vote.vote_info(id).label | html %]</a></li> 
     41[% IF loop.last %] 
     42</ul> 
     43</div> 
     44[% END %] 
     45[% END %] 
  • trunk/root/templates/includes/poll.tt

    r36 r38  
    11[% vote = c.model('Vote') %] 
    22[% thisvote = vote.vote_info(voteid) %] 
    3 [% signing = [vote.vote_signing(voteid)] %] 
    43 
    54<div id="poll_summary"> 
    65<p id="poll_label">[% thisvote.label | html %]</p> 
    76<p>[% thisvote.description | html %]</p> 
    8  
    9 Ont voté: [% vote.signing_count(voteid) %] /  [% signing.size %]<br> 
    10 Bulletins: [% vote.ballot_count(voteid) %] 
    11 [% IF vote.signing_count(voteid) != vote.ballot_count(voteid) %] 
     7Ont voté: [% vote.vote_signing_count(voteid) %] / [% vote.vote_voting_count(voteid) %]<br> 
     8Bulletins: [% vote.vote_ballot_count(voteid) %] 
     9[% IF vote.vote_signing_count(voteid) != vote.vote_ballot_count(voteid) %] 
    1210<p class="alert">Le nombre de bulletins et le nombre de personnes ayant voté divergent, 
    1311suspicion de tricherie</p> 
  • trunk/root/templates/includes/signing_list.tt

    r36 r38  
    11[% vote = c.model('Vote') %] 
    22 
    3 [% signing = [ vote.vote_signing(voteid) ] %] 
    4 [% FOREACH voting = signing %] 
     3[% FOREACH id = vote.vote_voting(voteid) %] 
     4[% voting = vote.voting_info(id) %] 
    55[% IF loop.first %] 
    66<div id="voting_list"> 
    7 Liste des votants: 
     7<p>Liste des votants:</p> 
    88<table border="1"> 
    99<tr><th>Votant</th><th>Date du vote</th></tr> 
  • trunk/root/templates/vote/default.tt

    r36 r38  
    99<p>Avant</p> 
    1010[% CASE 'AFTER' %] 
    11 <p>Resultats:</p> 
    12 Nombre de vote(s) exprimé(s): [% vote.ballot_count_nonull(voteid) %] 
    13 [% IF vote.ballot_count(voteid) %] 
    14 ([% vote.ballot_count_nonull(voteid) * 100 / vote.ballot_count(voteid) %]%) 
    15 [% END %] 
    16 <br> 
    17  
    18 <table border="1"> 
    19 <tr><th>choix</th><th>Nb voix</th><th>%</th><th></th></tr> 
    20 [% FOREACH res = vote.vote_results_nonull(voteid) %] 
    21 <tr> 
    22 <td>[% res.value | html %]</td> 
    23 <td>[% res.count %]</td> 
    24 <td>[% res.count * 100 / vote.ballot_count_nonull(voteid) %]</td> 
    25 <td><img src="[% c.uri_for('/static', 'images', 'green-h.png') %]"  
    26 height="10px" width="[% res.count * 300 / vote.ballot_count_nonull(voteid) %]px"></td> 
    27 </tr> 
    28 [% END %] 
    29 </table> 
    30  
    31 Liste des bulletins: 
    32 <table border="1"> 
    33 <tr><th>numéro</th><th>Id</th><th>contenu</th></tr> 
    34 [% FOREACH id = vote.list_vote_ballot(voteid) %] 
    35 <tr> 
    36 <td>[% loop.count %]</td> 
    37 <td>[% id | html %]</td> 
    38 <td> 
    39 [% FOREACH item = [ vote.ballot_items(id) ] %] 
    40 [% item.v %]<br> 
    41 [% END %] 
    42 </td> 
    43 </tr> 
    44 [% END %] 
    45 </table> 
     11[% INCLUDE 'includes/poll_results.tt' %] 
    4612[% END %] 
    4713 
Note: See TracChangeset for help on using the changeset viewer.