Index: /trunk/lib/Vote/Controller/Admin.pm
===================================================================
--- /trunk/lib/Vote/Controller/Admin.pm	(revision 41)
+++ /trunk/lib/Vote/Controller/Admin.pm	(revision 42)
@@ -65,5 +65,5 @@
                 and $vote->db->commit;
         } elsif ($c->req->param('mail')) {
-            $vote->addupd_voting($id, $c->req->param('id'), $c->req->param('mail'))
+            $vote->addupd_voting($id, $c->req->param('mail'), $c->req->param('id'))
                 and $vote->db->commit;
         } elsif($c->req->param('mailpasswd')) {
Index: /trunk/lib/Vote/Model/Vote.pm
===================================================================
--- /trunk/lib/Vote/Model/Vote.pm	(revision 41)
+++ /trunk/lib/Vote/Model/Vote.pm	(revision 42)
@@ -458,5 +458,6 @@
         q{
         select count(*) from ballot where poll = ?
-        and id in (select id from ballot_item) and invalid = 'false'
+        and id in (select id from ballot_item) and
+        (invalid = 'false' or invalid is null)
         }
     );
@@ -486,5 +487,4 @@
 
     $vinfo->{password} or return;
-    warn $vinfo->{password};
     if (crypt($passwd, $vinfo->{password} || '') eq $vinfo->{password}) {
         return 1;
@@ -537,7 +537,9 @@
     my $sth = $self->db->prepare(
         q{
-        select count(ballot.id), value from ballot join ballot_item
-        on ballot.id = ballot_item.id where ballot.poll = ? and invalid = 'false'
-        group by value
+        select count(ballot.id), coalesce(corrected, value) as value
+        from ballot join ballot_item
+        on ballot.id = ballot_item.id where ballot.poll = ? and
+        (invalid = 'false' or invalid is null)
+        group by coalesce(corrected, value)
         order by count desc
         }
@@ -622,4 +624,57 @@
 }
 
+sub vote_ballot_untrusted_values {
+    my ($self, $voteid) = @_;
+
+    my $getval = $self->db->prepare_cached(
+        q{
+        select value from ballot join ballot_item
+        on ballot.id = ballot_item.id
+        where poll = ? and fromlist = false
+        group by value order by value
+        }
+    );
+    $getval->execute($voteid);
+    my @vals;
+    while (my $res = $getval->fetchrow_hashref) {
+        push(@vals, $res->{value});
+    }
+    @vals
+}
+
+sub vote_ballot_values {
+    my ($self, $voteid) = @_;
+
+    my $getval = $self->db->prepare_cached(
+        q{
+        select value from ballot join ballot_item
+        on ballot.id = ballot_item.id
+        where poll = ?
+        group by value order by value
+        }
+    );
+    $getval->execute($voteid);
+    my @vals;
+    while (my $res = $getval->fetchrow_hashref) {
+        push(@vals, $res->{value});
+    }
+    @vals
+}
+
+sub vote_map_value {
+    my ($self, $voteid, $from, $to) = @_;
+
+    my $sth = $self->db->prepare_cached(
+        q{
+        update ballot_item set corrected = ? where
+        id in (select id from ballot where poll = ?)
+        and value = ?
+        }
+    );
+
+    $sth->execute($to, $voteid, $from) or $self->db->rollback;
+    $self->db->commit;
+}
+
 sub addupd_voting {
     my ($self, $voteid, $mail, $id) = @_;
@@ -631,5 +686,5 @@
     );
 
-    if ($upd->execute($mail, $voteid, $id) == 0) {
+    if ($upd->execute($id, $mail, $voteid) == 0) {
         my $add = $self->db->prepare_cached(q{
             insert into voting (poll, label, mail) values (?,?,?)
Index: /trunk/root/templates/admin/default.tt
===================================================================
--- /trunk/root/templates/admin/default.tt	(revision 41)
+++ /trunk/root/templates/admin/default.tt	(revision 42)
@@ -87,4 +87,6 @@
 [% FOREACH bid = vote.list_vote_ballot_needvalid(voteid) %]
     [% IF loop.first %]
+    <div id="ballot_to_valid">
+    <p>Bulletins Ã  valider</p>
     <form action="[% c.uri_for(voteid) %]">
     <table border="1">
@@ -93,6 +95,6 @@
 <td>[% bid %]</td>
 <td>
-[% FOREACH item = [ vote.ballot_items(bid) ] %]
-[% item.v %]<br>
+[% FOREACH item = vote.ballot_items(bid) %]
+[% loop.count %]- [% item.v %]<br>
 [% END %]
 </td>
@@ -106,4 +108,5 @@
     <input type="submit">
     </form>
+    </div>
     [% END %]
 [% END %]
Index: /trunk/root/templates/ballot/closed.tt
===================================================================
--- /trunk/root/templates/ballot/closed.tt	(revision 41)
+++ /trunk/root/templates/ballot/closed.tt	(revision 42)
@@ -1,1 +1,12 @@
-Ce vote est clos.
+[% INCLUDE 'includes/poll.tt' %]
+
+[% vote = c.model('Vote') %]
+
+<div id="ballot">
+[% IF vote.vote_status(voteid) == 'BEFORE' %]
+Ce Vote n'est pas encore ouvert
+[% ELSIF vote.vote_status(voteid) == 'AFTER' %]
+Ce vote est terminÃ©, les rÃ©sultats sont disponibles
+<a href="[% c.uri_for('/vote', voteid) %]">ici</a>.
+[% END %]
+</div>
