%args> $nlw => undef $definitionid => undef $place => undef $stfu => undef $word => undef $meaning => undef %args> <%method title> Vote Recorded (Probably) %method> <%init> our(%session,$dbh); %init> <%perl> unless(defined($session{'username'})) { %perl> Voting Error!
Sorry, you've got to be logged in!
<%perl> return; } %perl> <%perl> unless(defined($nlw) && defined($definitionid) && defined($place) ) { %perl> Voting Error!Sorry, you've got to tell me what you want to vote for!
<%perl> return; } if( ! defined( $stfu ) ) { %perl> Voting...Any previous vote will be silently removed.
<%perl> } else { %perl>Recording your vote on word "<% $word %>" in sense "<% $meaning %>".
<%perl> } # We're deleting all entries for the current wordid. Since wordid # is constrained to be a particular word with a particular meaning # in a particular language, this deletes all previous votes by the # users. $dbh->do("DELETE FROM natlangwordvotes WHERE natlangwordid=? AND userid=?", undef, $nlw, $session{'userid'}); $dbh->do("INSERT INTO natlangwordvotes (natlangwordid, definitionid, place, value, userid, time) VALUES (?, ?, ?, (SELECT votesize FROM users WHERE userid=?), ?, ?)", undef, $nlw, $definitionid, $place, $session{'userid'}, $session{'userid'}, time()); # Update natlangwordbestguesses my $jbovlastedir = $m->base_comp->attr('jbovlaste_dir'); system( "$jbovlastedir/bin/updatenlbg $jbovlastedir $nlw $place $session{'userid'} $definitionid \&"); %perl>Your vote should've been recorded.
<%perl> if( ! defined( $stfu ) ) { %perl>You may go back to where you were.
<%perl> } %perl>