r24507 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24506‎ | r24507 | r24508 >
Date:02:51, 1 August 2007
Author:david
Status:old
Tags:
Comment:
logs reasons given; better UI strings
Modified paths:
  • /branches/liquidthreads/extensions/LqtExtension.php (modified) (history)
  • /branches/liquidthreads/extensions/LqtModel.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtExtension.php
@@ -322,7 +322,8 @@
323323 if( $edit_type == 'editExisting' && $e->didSave ) {
324324 $subject = $this->request->getVal('lqt_subject_field', '');
325325 if ( $subject && $subject != $thread->subjectWithoutIncrement() ) {
326 - $this->renameThread($thread, $subject);
 326+ $reason = $this->request->getVal("wpSummary", "");
 327+ $this->renameThread($thread, $subject, $reason);
327328 }
328329 // this is unrelated to the subject change and is for all edits:
329330 $thread->setRootRevision( Revision::newFromTitle($thread->root()->getTitle()) );
@@ -330,11 +331,11 @@
331332 }
332333 }
333334
334 - function renameThread($t,$s) {
335 - $this->simplePageMove($t->root()->getTitle(),$s);
 335+ function renameThread($t,$s,$reason) {
 336+ $this->simplePageMove($t->root()->getTitle(),$s, $reason);
336337 // TODO here create a redirect from old page to new.
337338 foreach( $t->subthreads() as $st ) {
338 - $this->renameThread($st, $s);
 339+ $this->renameThread($st, $s, $reason);
339340 }
340341 }
341342
@@ -361,7 +362,7 @@
362363 }
363364
364365 /* Adapted from MovePageForm::doSubmit in SpecialMovepage.php. */
365 - function simplePageMove( $old_title, $new_subject ) {
 366+ function simplePageMove( $old_title, $new_subject, $reason ) {
366367 if ( $this->user->pingLimiter( 'move' ) ) {
367368 $this->out->rateLimited();
368369 return false;
@@ -380,7 +381,7 @@
381382 return false;
382383 }
383384
384 - $error = $ot->moveTo( $nt, true, "changed thread subject" );
 385+ $error = $ot->moveTo( $nt, true, "Changed thread subject: $reason" );
385386 if ( $error !== true ) {
386387 var_dump($error);
387388 echo "something bad happened trying to rename the thread."; // TODO
@@ -1123,17 +1124,22 @@
11241125 function handleGet() {
11251126 $thread_name = $this->thread->title()->getPrefixedText();
11261127 $article_name = $this->thread->article()->getTitle()->getTalkPage()->getPrefixedText();
 1128+ $edit_url = LqtView::permalinkUrl($this->thread, 'edit', $this->thread);
11271129 $this->output->addHTML(<<<HTML
11281130 <p>Moving <b>$thread_name</b>.
11291131 This thread is part of <b>$article_name</b>.</p>
 1132+ <p>To rename this thread, <a href="$edit_url">edit it</a> and change the 'Subject' field.</p>
11301133 <form id="lqt_move_thread_form" action="{$this->title->getLocalURL()}" method="POST">
11311134 <table>
11321135 <tr>
11331136 <td><label for="lqt_move_thread_target_title">Title of destination talkpage:</label></td>
1134 - <td><input id="lqt_move_thread_target_title" name="lqt_move_thread_target_title" tabindex="100" /></td>
 1137+ <td><input id="lqt_move_thread_target_title" name="lqt_move_thread_target_title" tabindex="100" size="40" /></td>
11351138 </tr><tr>
 1139+ <td><label for="lqt_move_thread_reason">Reason:</label></td>
 1140+ <td><input id="lqt_move_thread_reason" name="lqt_move_thread_reason" tabindex="200" size="40" /></td>
 1141+ </tr><tr>
11361142 <td>&nbsp;</td>
1137 - <td><input type="submit" value="Move" style="float:right;" tabindex="200" /></td>
 1143+ <td><input type="submit" value="Move" style="float:right;" tabindex="300" /></td>
11381144 </tr>
11391145 </table>
11401146 </form>
@@ -1177,14 +1183,22 @@
11781184 $this->redisplayForm(array('lqt_move_thread_target_title'), "You must specify a destination.");
11791185 return;
11801186 }
1181 -
11821187 $newtitle = Title::newFromText( $tmp )->getSubjectPage();
11831188
 1189+ $reason = $this->request->getVal('lqt_move_thread_reason', "No reason given.");
 1190+
11841191 // TODO no status code from this method.
1185 - $this->thread->moveToSubjectPage( $newtitle, true );
 1192+ $this->thread->moveToSubjectPage( $newtitle, $reason, true );
11861193
1187 -
 1194+ $this->showSuccessMessage( $newtitle->getTalkPage() );
11881195 }
 1196+
 1197+ function showSuccessMessage( $target_title ) {
 1198+ $this->output->addHTML(<<<HTML
 1199+ The thread was moved to <a href="{$target_title->getFullURL()}">{$target_title->getPrefixedText()}</a>.
 1200+HTML
 1201+ );
 1202+ }
11891203
11901204 function execute( $par = null ) {
11911205 global $wgOut, $wgRequest, $wgTitle, $wgUser;
Index: branches/liquidthreads/extensions/LqtModel.php
@@ -242,7 +242,7 @@
243243 // $revisionId );
244244 }
245245
246 - function moveToSubjectPage($title, $leave_trace) {
 246+ function moveToSubjectPage($title, $reason, $leave_trace) {
247247 $dbr =& wfGetDB( DB_MASTER );
248248
249249 if( $title->exists() ) {
@@ -273,11 +273,11 @@
274274 $this->commitRevision();
275275
276276 if($leave_trace) {
277 - $this->leaveTrace();
 277+ $this->leaveTrace($reason);
278278 }
279279 }
280280
281 - function leaveTrace() {
 281+ function leaveTrace($reason) {
282282 /* Adapted from Title::moveToNewTitle. But now the new title exists on the old talkpage. */
283283 $dbw =& wfGetDB( DB_MASTER );
284284
@@ -288,14 +288,14 @@
289289 $newid = $redirectArticle->insertOn( $dbw );
290290 $redirectRevision = new Revision( array(
291291 'page' => $newid,
292 - 'comment' => "page moved from here",
 292+ 'comment' => $reason,
293293 'text' => $redirectText ) );
294294 $redirectRevision->insertOn( $dbw );
295295 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
296296
297297 # Log the move
298298 $log = new LogPage( 'move' );
299 - $log->addEntry( 'move', $this->double->title(), "page moved from here", array( 1 => $this->title()->getPrefixedText()) );
 299+ $log->addEntry( 'move', $this->double->title(), $reason, array( 1 => $this->title()->getPrefixedText()) );
300300
301301 # Purge caches as per article creation
302302 Article::onArticleCreate( $redirectArticle->getTitle() );

Status & tagging log