diff --git a/foundation.gnome.org/vote/results.wml b/foundation.gnome.org/vote/results.wml index ac69bab..2c397de 100644 --- a/foundation.gnome.org/vote/results.wml +++ b/foundation.gnome.org/vote/results.wml @@ -38,85 +38,28 @@ if ($display && $election_id >= 0) { $error .= "The voting period for the specified ".elec_election_get_type ($election)." starts on ".$election["voting_start"]." (UTC) and ends on ".$election["voting_end"]." (UTC). It is not possible to see the results now.
\n"; $display = FALSE; } + else + { + $results = elec_get_results($handle, $election_id); + } } if (isset ($election) && $election !== FALSE) { - echo "

Results for the ".$election["name"]."

\n"; -} - -if ($display) { - $anon_tokens = elec_get_anon_tokens_for_election ($handle, $election_id); - if ($anon_tokens === FALSE) { - $error .= "Can not get the anonymous tokens for this ".elec_election_get_type ($election).".\n"; + if ($results !== FALSE) + { + echo "

Results for the ".$election["name"]."

\n"; + } else { + $error .= "The voting period for the specified ".elec_election_get_type ($election)." has closed, but the results of the election have not yet been calculated. It is not possible to see the results now.
\n"; + echo "

In the meantime, you can look at the list of all votes and verify that your vote is correct.

\n"; $display = FALSE; } } if ($display) { - $results = elec_get_results_election ($handle, $election_id); - if ($results === FALSE) { - $error .= "Can not get the results for this ".elec_election_get_type ($election).".\n"; - $display = FALSE; - } -} - -if ($display) { - $blank_results = elec_get_blank_votes_election ($handle, $election_id); - if ($results === FALSE) { - $error .= "Can not get the blank votes for this ".elec_election_get_type ($election).".\n"; - $display = FALSE; - } -} - -if ($display) { - $choices = elec_choices_get ($handle, $election_id); - if ($choices === FALSE) { - $error .= "The ".elec_election_get_type ($election)." is not properly set up.\n"; - $display = FALSE; - } -} - -if ($display) { - $nb_voters = count ($anon_tokens); - - $automatic_results = array (); - - echo "

Please note that these results are automatically calculated and are thus not the official results.

\n"; - - echo "

".$election["question"]."

"; - echo "

".$nb_voters." members voted for this ".elec_election_get_type ($election).". The repartition of the votes is:

\n"; - - echo "
\n"; - foreach ($results as $result) { - $found = FALSE; - foreach ($choices as $choice) { - if ($choice["id"] == $result["choice_id"]) { - echo "".$choice["choice"]." (".$result["total_choice"]." votes)
\n"; - $automatic_results[] = $choice["choice"]; - $found = TRUE; - break; - } - } - - if (!$found) { - echo "Unknown value (".$result["choice_id"].") (".$result["total_choice"]." votes)
\n"; - $automatic_results[] = "Unknown value (".$result["choice_id"].")"; - $error .= "There was an unkown vote: ".$result["choice_id"]."
\n"; - } - } - if ($blank_results > 0) { - echo "
"; - echo "blank votes: ".$blank_results."
\n"; - } - echo "
\n"; - - echo "

The automatic result of this ".elec_election_get_type ($election)." is thus:

\n"; - echo "
\n"; - for ($i = 0; $i < $election["choices_nb"]; $i++) { - echo "".$automatic_results[$i]."
\n"; - } - echo "
\n"; - + echo "
"; + echo $results["result"]; + echo "
"; + echo "

Please look at the list of all votes and verify that your vote is correct.

\n"; } diff --git a/foundation.gnome.org/vote/vote.wml b/foundation.gnome.org/vote/vote.wml index 7c88357..62d37df 100644 --- a/foundation.gnome.org/vote/vote.wml +++ b/foundation.gnome.org/vote/vote.wml @@ -1,14 +1,6 @@ - - - The GNOME Foundation - Votes - - - - - 1) { if (!elec_verify_email_tmp_token ($handle, $election_id, $email, $tmp_token)) { $step = 1; - $error .= "The e-mail address and token you gave do not match an existing voter.
\n"; + $error .= "The e-mail address and token you gave do not match an existing voter, or you have already voted.
\n"; } else { - $choices_nb = $election["choices_nb"]; $choices = elec_choices_get ($handle, $election_id); - if (!elec_verify_elections ($choices_nb, $choices)) { + if (!elec_verify_elections ($choices)) { $error .= "The ".elec_election_get_type ($election)." is not properly set up.\n"; $step = 0; } } } +?> + + + + + + The GNOME Foundation - Votes + + + + + + + + + + + + + +".$election["name"]."\n"; } if ($step >= 2) { - if ($choices_nb == 1) { - $votes_array = array (); - - if (isset ($_POST["vote"])) - $vote = $_POST["vote"]; - else - $vote = -1; - - } else { - $votes_array = elec_vote_get_votes_from_post ($choices); $vote = -1; - } - $res = elec_verify_vote_is_valid ($choices_nb, $choices, $vote, $votes_array); + $res = elec_verify_vote_is_valid ($choices, $vote, $votes_array); if ($res != "") { $error .= "The vote you made is not valid: ".$res."
\n"; @@ -142,7 +250,11 @@ if (isset ($error) && $error != "") { } if ($step != $max_step && $step >= 1) { - echo "
\n"; + echo "\n"; } echo $result; @@ -153,18 +265,14 @@ if ($step != $max_step && $step >= 1) { echo " \n"; } if ($step > 2) { - if ($choices_nb == 1) - echo " \n"; - else { - foreach ($choices as $choice) { - $name = "vote".$choice["id"]; - if (in_array ($choice["id"], $votes_array)) - $value = "on"; - else - $value = ""; + $index=0; + + foreach ($votes_array as $vote) { + $index++; + $name = "pref".$index; + $value = "vote".$vote; echo " \n"; - } } } echo " \n"; @@ -173,3 +281,6 @@ if ($step != $max_step && $step >= 1) { echo "
\n"; } ?> + + + diff --git a/foundation.gnome.org/vote/votes.wml b/foundation.gnome.org/vote/votes.wml index e54ad56..5e481f2 100644 --- a/foundation.gnome.org/vote/votes.wml +++ b/foundation.gnome.org/vote/votes.wml @@ -66,7 +66,8 @@ if ($display) { $choices_name[$choice["id"]] = $choice["choice"]; } - echo "

Please look at the automatic results to have a summary of the votes.

\n"; + echo "

Please look at the automatic results to have a summary of the votes. "; + echo "You can also download the ballots in the OpenSTV .blt file format and verify the results.

\n"; echo "

Please note that these results are automatically calculated and are thus not the official results.

\n"; @@ -92,14 +93,16 @@ if ($display) { } else if (count ($votes) == 0) { echo "This member chose to vote for
none of the possible choices."; } else { + echo "
    "; foreach ($votes as $vote) { - if (array_key_exists ($vote, $choices_name)) - echo "".$choices_name[$vote]."
    \n"; + if (array_key_exists ($vote["choice_id"], $choices_name)) + echo "
  1. ".$votes["preference"]." ".$choices_name[$vote["choice_id"]]."
  2. \n"; else { - echo "Unknown value (".$vote.")
    \n"; - $error .= "There was an unkown vote for anonymous token ".$anon_token["anon_token"].": ".$vote."
    \n"; + echo "
  3. Unknown value (".$vote["choice_id"].")
  4. \n"; + $error .= "There was an unkown vote for anonymous token ".$anon_token["anon_token"].": ".$vote["choice_id"]."
    \n"; } } + echo "
"; } echo "\n";