Mercurial > hg > fapweb
changeset 325:aac3bdd73ec1
More work on voting.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 27 Nov 2013 23:19:00 +0200 |
parents | f3dfdb4fb221 |
children | 64c28792ae08 |
files | usrajax.php usrlogin.php vote.inc.php |
diffstat | 3 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/usrajax.php Wed Nov 27 18:48:49 2013 +0200 +++ b/usrajax.php Wed Nov 27 23:19:00 2013 +0200 @@ -104,8 +104,19 @@ $cid = $compo["id"]; foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$cid) as $entry) { + $value = stGetRequestItem("", 0); + if (!stUpdateVote($voteKeyId, $entry["id"], $value)) + { + stError("Could not set vote for compo #".$cid.", entry #".$entry["id"]); + break; + } } } + if (!$errorSet) + { + stSetSessionItem("mode", "done"); + header("Location: ".stGetRequestItem("goto", "vote")); + } } break;
--- a/usrlogin.php Wed Nov 27 18:48:49 2013 +0200 +++ b/usrlogin.php Wed Nov 27 23:19:00 2013 +0200 @@ -65,7 +65,7 @@ $error = 1; } -$nextPage = ($error != 0) ? $errorPage : $gotoPage; +$nextPage = ($error != 0 && $errorPage !== FALSE) ? $errorPage : $gotoPage; header("Location: ". ($nextPage !== FALSE ? $nextPage : stGetSetting("defaultPage")).
--- a/vote.inc.php Wed Nov 27 18:48:49 2013 +0200 +++ b/vote.inc.php Wed Nov 27 23:19:00 2013 +0200 @@ -82,6 +82,7 @@ function updateVote(eid, value) { + sendPOSTRequest("action=set&entry_id="+eid+"&vote="+value, msuccess, mfail); return false; } @@ -148,7 +149,7 @@ echo "<td class=\"vvalue\">". stGetFormRadioButtonInput( - "entry".$eid, "", "", $i, ($i == $val), + "ventry".$eid, "", "", $i, ($i == $val), "", "onClick=\"updateVote(".$eid.",".$i.")\""). "</td>"; @@ -174,6 +175,7 @@ { // Voting finished echo stGetSetting("voteFinishedText"); + echo "<p>Or perhaps <a href=\"vote\">vote again!</a></p>\n"; stSessionEnd(SESS_USER); } ?> \ No newline at end of file