Index: trunk/extensions/AJAXPoll/AJAXPoll.php |
— | — | @@ -17,7 +17,8 @@ |
18 | 18 | * @ingroup Extensions |
19 | 19 | * @author Dariusz Siedlecki <datrio@gmail.com> |
20 | 20 | * @author Jack Phoenix <jack@countervandalism.net> |
21 | | - * @version 1.4.1 |
| 21 | + * @author Thomas Gries |
| 22 | + * @version 1.500 |
22 | 23 | * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation |
23 | 24 | */ |
24 | 25 | |
— | — | @@ -29,8 +30,8 @@ |
30 | 31 | $wgExtensionCredits['parserhook'][] = array( |
31 | 32 | 'path' => __FILE__, |
32 | 33 | 'name' => 'AJAX Poll', |
33 | | - 'version' => '1.4.2', |
34 | | - 'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix' ), |
| 34 | + 'version' => '1.500', |
| 35 | + 'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries', ), |
35 | 36 | 'description' => 'Allows AJAX-based polls with <tt><poll></tt> tag', |
36 | 37 | 'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll', |
37 | 38 | ); |
— | — | @@ -188,7 +189,7 @@ |
189 | 190 | 'COUNT(*) AS c', |
190 | 191 | array( |
191 | 192 | 'poll_id' => $ID, |
192 | | - 'poll_user' => $dbw->addQuotes( $user ) |
| 193 | + 'poll_user' => $user |
193 | 194 | ), |
194 | 195 | __METHOD__ |
195 | 196 | ); |
— | — | @@ -198,12 +199,12 @@ |
199 | 200 | $updateQuery = $dbw->update( |
200 | 201 | 'poll_vote', |
201 | 202 | array( |
202 | | - "poll_answer='{$answer}'", |
| 203 | + 'poll_answer' => $answer, |
203 | 204 | 'poll_date' => wfTimestampNow() |
204 | 205 | ), |
205 | 206 | array( |
206 | 207 | 'poll_id' => $ID, |
207 | | - 'poll_user' => $dbw->addQuotes( $user ) |
| 208 | + 'poll_user' => $user |
208 | 209 | ), |
209 | 210 | __METHOD__ |
210 | 211 | ); |
— | — | @@ -218,7 +219,7 @@ |
219 | 220 | 'poll_vote', |
220 | 221 | array( |
221 | 222 | 'poll_id' => $ID, |
222 | | - 'poll_user' => $dbw->addQuotes( $user ), |
| 223 | + 'poll_user' => $user, |
223 | 224 | 'poll_ip' => wfGetIP(), |
224 | 225 | 'poll_answer' => $answer, |
225 | 226 | 'poll_date' => wfTimestampNow() |
— | — | @@ -275,7 +276,7 @@ |
276 | 277 | array( 'poll_answer', 'poll_date' ), |
277 | 278 | array( |
278 | 279 | 'poll_id' => $ID, |
279 | | - 'poll_user' => $dbw->addQuotes( $user ) |
| 280 | + 'poll_user' => $user |
280 | 281 | ), |
281 | 282 | __METHOD__ |
282 | 283 | ); |
— | — | @@ -321,17 +322,13 @@ |
322 | 323 | $percent = $wgLang->formatNum( round( ( isset( $poll_result[$i + 1] ) ? $poll_result[$i + 1] : 0 ) * 100 / $amountOfVotes, 2 ) ); |
323 | 324 | } |
324 | 325 | |
325 | | - if ( isset( $r[0] ) && ( $r[0] - 1 == $i ) ) { |
326 | | - $our = true; |
327 | | - } else { |
328 | | - $our = false; |
329 | | - } |
| 326 | + $our = ( isset( $r[0] ) && ( $r[0] - 1 == $i ) ); |
330 | 327 | |
331 | 328 | // If AJAX is enabled, as it is by default in modern MWs, we can |
332 | 329 | // just use sajax library function here for that AJAX-y feel. |
333 | 330 | // If not, we'll have to submit the form old-school way... |
334 | 331 | if ( $wgUseAjax ) { |
335 | | - $submitJS = "sajax_do_call(\"submitVote\", [\"" . $ID . "\", \"" . $i . "\"], document.getElementById(\"pollContainer" . $ID . "\"));"; |
| 332 | + $submitJS = "sajax_do_call(\"submitVote\",[\"" . $ID . "\",\"" . $i . "\"], document.getElementById(\"pollContainer" . $ID . "\"));"; |
336 | 333 | } else { |
337 | 334 | $submitJS = "document.getElementById(\"pollIdAnswer" . $ID . "\").submit();"; |
338 | 335 | } |
— | — | @@ -343,9 +340,9 @@ |
344 | 341 | $ans_no . "' onclick='document.getElementById(\"pollAjax" . |
345 | 342 | $ID . "\").innerHTML=\"" . wfMsg( 'poll-submitting' ) . |
346 | 343 | "\"; document.getElementById(\"pollAjax" . $ID . |
347 | | - "\").style.display=\"block\"; this.getElementsByTagName(\"input\")[0].checked = true; " . |
| 344 | + "\").style.display=\"block\";this.getElementsByTagName(\"input\")[0].checked=true; " . |
348 | 345 | $submitJS . "'><input type='radio' id='p_answer" . $ans_no . |
349 | | - "' name='p_answer' value='" . $i . "' />" . |
| 346 | + "' name='p_answer' value='" . $i . "'" . ( $our ? 'checked=true ' : '' ) . "/>" . |
350 | 347 | strip_tags( $lines[$i] ) . |
351 | 348 | "</label></div> <div class='pollAnswerVotes" . ( $our ? ' ourVote' : '' ) . |
352 | 349 | "' onmouseover='span=this.getElementsByTagName(\"span\")[0];tmpPollVar=span.innerHTML;span.innerHTML=span.title;span.title=\"\";' onmouseout='span=this.getElementsByTagName(\"span\")[0];span.title=span.innerHTML;span.innerHTML=tmpPollVar;'><span title='" . |
Index: trunk/extensions/AJAXPoll/AJAXPoll.css |
— | — | @@ -26,14 +26,15 @@ |
27 | 27 | } |
28 | 28 | |
29 | 29 | .poll .pollAnswerName { |
30 | | - padding-left: 10px; |
| 30 | + margin-top: 5px; |
| 31 | + padding-left: 0px; |
31 | 32 | font-size: 0.9em; |
32 | 33 | } |
33 | 34 | |
34 | 35 | .poll .pollAnswerVotes { |
35 | 36 | border: 1px solid #CCC; |
36 | 37 | width: 100%; |
37 | | - margin-left: 10px; |
| 38 | + margin-left: 0px; |
38 | 39 | height: 12px; |
39 | 40 | font-size: 10px; |
40 | 41 | position: relative; |
— | — | @@ -66,4 +67,21 @@ |
67 | 68 | |
68 | 69 | .poll label { |
69 | 70 | cursor: pointer; |
| 71 | +} |
| 72 | +.poll input { |
| 73 | + cursor: pointer; |
| 74 | + vertical-align: middle; |
| 75 | + margin-top: 0px; |
| 76 | + margin-bottom: 0px; |
| 77 | + margin-left: 0px; |
| 78 | +} |
| 79 | + |
| 80 | +.poll #pollInfo { |
| 81 | + margin-top: 20px; |
| 82 | + color: grey; |
| 83 | +} |
| 84 | + |
| 85 | +.poll .pollMisc { |
| 86 | + margin-bottom: 20px; |
| 87 | + color: grey; |
70 | 88 | } |
\ No newline at end of file |