r51739 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51738‎ | r51739 | r51740 >
Date:11:34, 11 June 2009
Author:jan
Status:deferred
Tags:
Comment:
Add function for changing vote
Modified paths:
  • /trunk/extensions/Poll/Poll.i18n.php (modified) (history)
  • /trunk/extensions/Poll/Poll_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Poll/Poll_body.php
@@ -84,6 +84,7 @@
8585 }
8686 else {
8787 $wgOut->addHtml( Xml::openElement( 'form', array('method'=> 'post', 'action' => $this->getTitle()->getFullURL('action=submit') ) ) );
 88+
8889 $wgOut->addHtml( Xml::openElement( 'table' ) );
8990 $wgOut->addHtml( '<tr><td>'.wfMsg( 'poll-question' ).':</td><td>'.Xml::input('question').'</td></tr>' );
9091 $wgOut->addHtml( '<tr><td>'.wfMsg( 'poll-alternative' ).' 1:</td><td>'.Xml::input('poll_alternative_1').'</td></tr>' );
@@ -124,7 +125,6 @@
125126 $creater = htmlentities( $row->creater, ENT_QUOTES, 'UTF-8' );
126127 $multi = $row->multi;
127128 }
128 -
129129 $wgOut->addHtml( Xml::openElement( 'form', array('method'=> 'post', 'action' => $this->getTitle()->getFullURL('action=submit&id='.$vid) ) ) );
130130 $wgOut->addHtml( Xml::openElement( 'table' ) );
131131 $wgOut->addHtml( '<tr><th>'.$question.'</th></tr>' );
@@ -373,7 +373,9 @@
374374 $wgOut->addHtml( '<a href="'.$this->getTitle()->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' );
375375 }
376376 else {
377 - $wgOut->addWikiMsg( 'poll-vote-already-error' );
 377+ $dbw->update( 'poll_answer', array( 'vote' => $vote ), array( 'uid' => $uid, 'pid' => $pid ) );
 378+
 379+ $wgOut->addWikiMsg( 'poll-vote-changed' );
378380 $wgOut->addHtml( '<a href="'.$this->getTitle()->getFullURL('action=list').'">'.wfMsg('poll-back').'</a>' );
379381 }
380382 }
Index: trunk/extensions/Poll/Poll.i18n.php
@@ -56,6 +56,7 @@
5757 'poll-administration' => 'Administration:',
5858 'poll-no-dis' => 'No Description!',
5959 'poll-create-allow-more' => 'Allow Multi-Vote',
 60+ 'poll-vote-changed' => 'Vote has been changed!',
6061 );
6162
6263 /** German (Deutsch)
@@ -105,4 +106,5 @@
106107 'poll-administration' => 'Administration:',
107108 'poll-no-dis' => 'Keine Beschreibung vorhanden!',
108109 'poll-create-allow-more' => 'Mehfachabstimmung erlaubt',
 110+ 'poll-vote-changed' => 'Stimme wurde geändert!',
109111 );

Status & tagging log