Jigawatt
Arcane
Refreshing the page to vote in/view results of polls is turning prestigious RPGCodex into the laughing stock of the internet. I demand some javascript for viewing results, and AJAX for voting. Chop chop
Xor said:It needs the "stare" music from Kill Bill.
Orgasm said:
wallace said:Multiple-axis polling.
Line 1:
//Add
<script type="text/javascript">
function viewResult() {
document.getElementById("pollresultsjs").style.display = "table-row-group";
document.getElementById("pollballotjs").style.display = "none";
}
</script>
<tbody id="pollballotjs">
Lines 10-11:
//Replace
<td><input type="radio" name="vote_id" value="{poll_option.POLL_OPTION_ID}" /> </td>
<td><span class="gen">{poll_option.POLL_OPTION_CAPTION}</span></td>
//With
<td><input type="radio" name="vote_id" value="{poll_optionb.POLL_OPTION_ID}" /> </td>
<td><span class="gen">{poll_optionb.POLL_OPTION_CAPTION}</span></td>
//Only change is poll_option classname changed to poll_optionb
Line 23:
//Replace the segment
<a href="{U_VIEW_RESULTS}" class="gensmall">{L_VIEW_RESULTS}</a>
//With
<a href="{U_VIEW_RESULTS}" class="gensmall" onclick="viewResult(); return false;" </a>
End of file:
//Add
</tbody>
<tbody id="pollresultsjs" style="display:none;">
{POLL_JS}
</tbody>
Line 724
//Comment out the if statement and open bracket
if ( $user_voted || ...
Line 770
//Comment out the close bracket for the if statement
Line 771
//Replace
else
//With
if (!( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_topic_data['topic_status'] == TOPIC_LOCKED ))
//ie the inverse of the commented out if statement above
Line 775-776
//Add
'polljs' => 'viewtopic_poll_result.tpl'
//to the array
Line 786
//Replace
"poll_option"
//With
"poll_optionb"
Line 801 (before the if close bracket)
//Add
$template->assign_var_from_handle('POLL_JS', 'polljs');