r25114 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25113‎ | r25114 | r25115 >
Date:08:08, 24 August 2007
Author:david
Status:old
Tags:
Comment:
Jump to the particular thread being operated on when editing and returning from an edit. Also, headers now start at h2 instead of h1 (duh).
Modified paths:
  • /branches/liquidthreads/extensions/LqtExtension.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtExtension.php
@@ -128,7 +128,7 @@
129129 protected $title;
130130 protected $request;
131131
132 - protected $headerLevel = 1; /* h1, h2, h3, etc. */
 132+ protected $headerLevel = 2; /* h1, h2, h3, etc. */
133133 protected $user_colors;
134134 protected $user_color_index;
135135 const number_of_user_colors = 6;
@@ -222,10 +222,10 @@
223223 return self::permalinkUrlWithQuery( $changed_thread, array('diff'=>$curr_rev_id, 'oldid'=>$prev_rev->getId()) );
224224 }
225225
226 - static function talkpageUrl( $title, $method = null, $operand = null ) {
 226+ static function talkpageUrl( $title, $method = null, $operand = null, $includeFragment = true ) {
227227 $query = $method ? "lqt_method=$method" : "";
228228 $query = $operand ? "$query&lqt_operand={$operand->id()}" : $query;
229 - return $title->getFullURL( $query );
 229+ return $title->getFullURL( $query ) . ($operand && $includeFragment ? "#lqt_thread_{$operand->id()}" : "");
230230 }
231231
232232 /*************************************************************
@@ -311,13 +311,6 @@
312312 // $wgOut->setArticleRelated( false );
313313 $this->output->setArticleFlag( false );
314314
315 - // I have lost track of where the redirect happens, so I can't set a flag there until I find it.
316 - // In the meantime, just check if somewhere somebody redirected. I'm afraid this might have
317 - // unwanted side-effects.
318 - if ( $this->output->getRedirect() != '' ) {
319 - $this->output->redirect( $this->title->getFullURL() );
320 - }
321 -
322315 // For replies and new posts, insert the associated thread object into the DB.
323316 if ($edit_type != 'editExisting' && $edit_type != 'summarize' && $e->didSave) {
324317 if ( $edit_type == 'reply' ) {
@@ -344,6 +337,13 @@
345338 $thread->setRootRevision( Revision::newFromTitle($thread->root()->getTitle()) );
346339 $thread->commitRevision( Threads::CHANGE_EDITED_ROOT, $thread, $e->summary );
347340 }
 341+
 342+ // I have lost track of where the redirect happens, so I can't set a flag there until I find it.
 343+ // In the meantime, just check if somewhere somebody redirected. I'm afraid this might have
 344+ // unwanted side-effects.
 345+ if ( $this->output->getRedirect() != '' ) {
 346+ $this->output->redirect( $this->title->getFullURL() . '#' . 'lqt_thread_' . $thread->id() );
 347+ }
348348 }
349349
350350 function renameThread($t,$s,$reason) {
@@ -544,6 +544,8 @@
545545 $is_changed_thread = $thread->isHistorical() && $thread->changeObject() == $thread->id();
546546
547547 $this->showThreadHeading( $thread );
 548+
 549+ $this->output->addHTML( "<a name=\"lqt_thread_{$thread->id()}\" ></a>" );
548550
549551 if ($thread->type() == Threads::TYPE_MOVED) {
550552 $revision = Revision::newFromTitle( $thread->title() );

Status & tagging log