Changeset 42
- Timestamp:
- 03/16/09 18:57:18 (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Vote/Controller/Admin.pm
r39 r42 65 65 and $vote->db->commit; 66 66 } elsif ($c->req->param('mail')) { 67 $vote->addupd_voting($id, $c->req->param(' id'), $c->req->param('mail'))67 $vote->addupd_voting($id, $c->req->param('mail'), $c->req->param('id')) 68 68 and $vote->db->commit; 69 69 } elsif($c->req->param('mailpasswd')) { -
trunk/lib/Vote/Model/Vote.pm
r38 r42 458 458 q{ 459 459 select count(*) from ballot where poll = ? 460 and id in (select id from ballot_item) and invalid = 'false' 460 and id in (select id from ballot_item) and 461 (invalid = 'false' or invalid is null) 461 462 } 462 463 ); … … 486 487 487 488 $vinfo->{password} or return; 488 warn $vinfo->{password};489 489 if (crypt($passwd, $vinfo->{password} || '') eq $vinfo->{password}) { 490 490 return 1; … … 537 537 my $sth = $self->db->prepare( 538 538 q{ 539 select count(ballot.id), value from ballot join ballot_item 540 on ballot.id = ballot_item.id where ballot.poll = ? and invalid = 'false' 541 group by value 539 select count(ballot.id), coalesce(corrected, value) as value 540 from ballot join ballot_item 541 on ballot.id = ballot_item.id where ballot.poll = ? and 542 (invalid = 'false' or invalid is null) 543 group by coalesce(corrected, value) 542 544 order by count desc 543 545 } … … 622 624 } 623 625 626 sub vote_ballot_untrusted_values { 627 my ($self, $voteid) = @_; 628 629 my $getval = $self->db->prepare_cached( 630 q{ 631 select value from ballot join ballot_item 632 on ballot.id = ballot_item.id 633 where poll = ? and fromlist = false 634 group by value order by value 635 } 636 ); 637 $getval->execute($voteid); 638 my @vals; 639 while (my $res = $getval->fetchrow_hashref) { 640 push(@vals, $res->{value}); 641 } 642 @vals 643 } 644 645 sub vote_ballot_values { 646 my ($self, $voteid) = @_; 647 648 my $getval = $self->db->prepare_cached( 649 q{ 650 select value from ballot join ballot_item 651 on ballot.id = ballot_item.id 652 where poll = ? 653 group by value order by value 654 } 655 ); 656 $getval->execute($voteid); 657 my @vals; 658 while (my $res = $getval->fetchrow_hashref) { 659 push(@vals, $res->{value}); 660 } 661 @vals 662 } 663 664 sub vote_map_value { 665 my ($self, $voteid, $from, $to) = @_; 666 667 my $sth = $self->db->prepare_cached( 668 q{ 669 update ballot_item set corrected = ? where 670 id in (select id from ballot where poll = ?) 671 and value = ? 672 } 673 ); 674 675 $sth->execute($to, $voteid, $from) or $self->db->rollback; 676 $self->db->commit; 677 } 678 624 679 sub addupd_voting { 625 680 my ($self, $voteid, $mail, $id) = @_; … … 631 686 ); 632 687 633 if ($upd->execute($ mail, $voteid, $id) == 0) {688 if ($upd->execute($id, $mail, $voteid) == 0) { 634 689 my $add = $self->db->prepare_cached(q{ 635 690 insert into voting (poll, label, mail) values (?,?,?) -
trunk/root/templates/admin/default.tt
r34 r42 87 87 [% FOREACH bid = vote.list_vote_ballot_needvalid(voteid) %] 88 88 [% IF loop.first %] 89 <div id="ballot_to_valid"> 90 <p>Bulletins à valider</p> 89 91 <form action="[% c.uri_for(voteid) %]"> 90 92 <table border="1"> … … 93 95 <td>[% bid %]</td> 94 96 <td> 95 [% FOREACH item = [ vote.ballot_items(bid) ]%]96 [% item.v %]<br>97 [% FOREACH item = vote.ballot_items(bid) %] 98 [% loop.count %]- [% item.v %]<br> 97 99 [% END %] 98 100 </td> … … 106 108 <input type="submit"> 107 109 </form> 110 </div> 108 111 [% END %] 109 112 [% END %] -
trunk/root/templates/ballot/closed.tt
r18 r42 1 Ce vote est clos. 1 [% INCLUDE 'includes/poll.tt' %] 2 3 [% vote = c.model('Vote') %] 4 5 <div id="ballot"> 6 [% IF vote.vote_status(voteid) == 'BEFORE' %] 7 Ce Vote n'est pas encore ouvert 8 [% ELSIF vote.vote_status(voteid) == 'AFTER' %] 9 Ce vote est terminé, les résultats sont disponibles 10 <a href="[% c.uri_for('/vote', voteid) %]">ici</a>. 11 [% END %] 12 </div>
Note: See TracChangeset
for help on using the changeset viewer.