Index: trunk/extensions/CodeReview/CodeRevisionView.php |
— | — | @@ -9,8 +9,15 @@ |
10 | 10 | $this->mRepo = CodeRepository::newFromName( $repoName ); |
11 | 11 | $this->mRev = $this->mRepo ? $this->mRepo->getRevision( intval( $rev ) ) : null; |
12 | 12 | $this->mPreviewText = false; |
| 13 | + # URL params... |
| 14 | + $this->mAddTags = $this->splitTags( $wgRequest->getText( 'wpTag' ) ); |
| 15 | + $this->mRemoveTags = $this->splitTags( $wgRequest->getText( 'wpRemoveTag' ) ); |
| 16 | + $this->mStatus = $wgRequest->getText('wpStatus') ? |
| 17 | + $wgRequest->getText('wpStatus') : $this->mRev->getStatus(); |
| 18 | + $this->jumpToNext = $wgRequest->getCheck('wpSaveAndNext'); |
13 | 19 | $this->mReplyTarget = $replyTarget ? |
14 | 20 | (int)$replyTarget : $wgRequest->getIntOrNull( 'wpParent' ); |
| 21 | + $this->text = $wgRequest->getText( "wpReply{$this->mReplyTarget}" ); |
15 | 22 | $this->mSkipCache = ($wgRequest->getVal( 'action' ) == 'purge'); |
16 | 23 | } |
17 | 24 | |
— | — | @@ -201,7 +208,25 @@ |
202 | 209 | return $list; |
203 | 210 | } |
204 | 211 | |
205 | | - function statusForm() { |
| 212 | + protected function splitTags( $input ) { |
| 213 | + $tags = array_map( 'trim', explode( ",", $input ) ); |
| 214 | + foreach( $tags as $key => $tag ) { |
| 215 | + $normal = $this->mRev->normalizeTag( $tag ); |
| 216 | + if( $normal === false ) { |
| 217 | + return null; |
| 218 | + } |
| 219 | + $tags[$key] = $normal; |
| 220 | + } |
| 221 | + return $tags; |
| 222 | + } |
| 223 | + |
| 224 | + protected function listTags( $tags ) { |
| 225 | + if( empty($tags) ) |
| 226 | + return ""; |
| 227 | + return implode(",",$tags); |
| 228 | + } |
| 229 | + |
| 230 | + protected function statusForm() { |
206 | 231 | global $wgUser; |
207 | 232 | if( $wgUser->isAllowed( 'codereview-set-status' ) ) { |
208 | 233 | $repo = $this->mRepo->getName(); |
— | — | @@ -217,8 +242,7 @@ |
218 | 243 | $states = CodeRevision::getPossibleStates(); |
219 | 244 | $out = ''; |
220 | 245 | foreach( $states as $state ) { |
221 | | - $out .= Xml::option( $this->statusDesc( $state ), $state, |
222 | | - $this->mRev->getStatus() == $state ); |
| 246 | + $out .= Xml::option( $this->statusDesc( $state ), $state, $this->mStatus === $state ); |
223 | 247 | } |
224 | 248 | return $out; |
225 | 249 | } |
— | — | @@ -228,10 +252,10 @@ |
229 | 253 | $repo = $this->mRepo->getName(); |
230 | 254 | $rev = $this->mRev->getId(); |
231 | 255 | return '<div><table><tr><td>' . |
232 | | - Xml::inputLabel( wfMsg('code-rev-tag-add'), 'wpTag', 'wpTag', '' ) . |
233 | | - '</td><td> </td><td>' . |
234 | | - Xml::inputLabel( wfMsg('code-rev-tag-remove'), 'wpRemoveTag', 'wpRemoveTag', '' ) . |
235 | | - '</td></tr></table></div>'; |
| 256 | + Xml::inputLabel( wfMsg('code-rev-tag-add'), 'wpTag', 'wpTag', 20, |
| 257 | + $this->listTags($this->mAddTags) ) . '</td><td> </td><td>' . |
| 258 | + Xml::inputLabel( wfMsg('code-rev-tag-remove'), 'wpRemoveTag', 'wpRemoveTag', 20, |
| 259 | + $this->listTags($this->mRemoveTags) ) . '</td></tr></table></div>'; |
236 | 260 | } |
237 | 261 | |
238 | 262 | protected function formatTag( $tag ) { |
— | — | @@ -405,12 +429,12 @@ |
406 | 430 | |
407 | 431 | protected function postCommentForm( $parent=null ) { |
408 | 432 | global $wgUser; |
409 | | - if( $this->mPreviewText != false && $parent === $this->mReplyTarget ) { |
| 433 | + if( $this->mPreviewText !== false && $parent === $this->mReplyTarget ) { |
410 | 434 | $preview = $this->previewComment( $this->mPreviewText ); |
411 | 435 | $text = htmlspecialchars( $this->mPreviewText ); |
412 | 436 | } else { |
413 | 437 | $preview = ''; |
414 | | - $text = ''; |
| 438 | + $text = $this->text; |
415 | 439 | } |
416 | 440 | $repo = $this->mRepo->getName(); |
417 | 441 | $rev = $this->mRev->getId(); |
Index: trunk/extensions/CodeReview/CodeRevisionCommitter.php |
— | — | @@ -5,13 +5,6 @@ |
6 | 6 | function __construct( $repoName, $rev ){ |
7 | 7 | // Parent should set $this->mRepo, $this->mRev, $this->mReplyTarget |
8 | 8 | parent::__construct( $repoName, $rev ); |
9 | | - |
10 | | - global $wgRequest; |
11 | | - $this->mAddTags = $this->splitTags( $wgRequest->getText( 'wpTag' ) ); |
12 | | - $this->mRemoveTags = $this->splitTags( $wgRequest->getText( 'wpRemoveTag' ) ); |
13 | | - $this->mStatus = $wgRequest->getText( 'wpStatus' ); |
14 | | - $this->text = $wgRequest->getText( "wpReply{$this->mReplyTarget}" ); |
15 | | - $this->jumpToNext = $wgRequest->getCheck('wpSaveAndNext'); |
16 | 9 | } |
17 | 10 | |
18 | 11 | function execute() { |
— | — | @@ -70,18 +63,6 @@ |
71 | 64 | $wgOut->redirect( $redirTitle->getFullUrl() ); |
72 | 65 | } |
73 | 66 | |
74 | | - function splitTags( $input ) { |
75 | | - $tags = array_map( 'trim', explode( ",", $input ) ); |
76 | | - foreach( $tags as $key => $tag ) { |
77 | | - $normal = $this->mRev->normalizeTag( $tag ); |
78 | | - if( $normal === false ) { |
79 | | - return null; |
80 | | - } |
81 | | - $tags[$key] = $normal; |
82 | | - } |
83 | | - return $tags; |
84 | | - } |
85 | | - |
86 | 67 | public function validPost( $permission ) { |
87 | 68 | global $wgUser, $wgRequest; |
88 | 69 | return parent::validPost($permission) && $wgRequest->wasPosted() |