r39579 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39578‎ | r39579 | r39580 >
Date:11:40, 18 August 2008
Author:siebrand
Status:old
Tags:
Comment:
Trim trailing whitespace. No functional changes.
Modified paths:
  • /trunk/extensions/LiquidThreads/Lqt.i18n.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtBaseView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtModel.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtPages.php (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt-schema-change-5.sql (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.css (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/lqt-schema-change-5.sql
@@ -3,7 +3,7 @@
44 update thread join thread as child on child.thread_parent = thread.thread_id set thread.thread_editedness = 1;
55
66 create temporary table counts ( thread_id int(8) unsigned, revision_count int(8) unsigned, author_count int(8) unsigned, rev_user int(8) unsigned );
7 -
 7+
88 insert into counts (thread_id, revision_count, author_count, rev_user) select thread_id, count(thread_id), count(distinct rev_user), rev_user from thread join revision on rev_page = thread_root group by thread_id;
99
1010 update thread join counts on thread.thread_id = counts.thread_id set thread_editedness = 2 where revision_count > 1;
Index: trunk/extensions/LiquidThreads/Lqt.i18n.php
@@ -104,7 +104,7 @@
105105 'lqt_sort_newest_changes' => 'last modified first',
106106 'lqt_sort_newest_threads' => 'newest threads first',
107107 'lqt_sort_oldest_threads' => 'oldest threads first',
108 - 'lqt-any-date' => 'Any date',
 108+ 'lqt-any-date' => 'Any date',
109109 'lqt-only-date' => 'Only these dates:',
110110 'lqt-date-from' => 'From',
111111 'lqt-date-to' => 'To',
@@ -746,7 +746,7 @@
747747 'lqt_sort_newest_changes' => 'fils de discussion plus récemment modifiés en premier',
748748 'lqt_sort_newest_threads' => 'fils de discussion les plus récents en premier',
749749 'lqt_sort_oldest_threads' => 'fils de discussion les plus anciens en premier',
750 - 'lqt-any-date' => 'Toutes les dates',
 750+ 'lqt-any-date' => 'Toutes les dates',
751751 'lqt-only-date' => 'Uniquement ces dates :',
752752 'lqt-date-from' => 'Du',
753753 'lqt-date-to' => 'au',
@@ -3094,4 +3094,3 @@
30953095 'lqt_header_warning_bold' => '討論頁頁頂',
30963096 'lqt_header_warning_new_discussion' => '開始一個新的討論',
30973097 );
3098 -
Index: trunk/extensions/LiquidThreads/LqtPages.php
@@ -171,31 +171,31 @@
172172 $i++;
173173 }
174174 $toclines[] = $sk->tocUnindent(1);
175 -
 175+
176176 $this->openDiv('lqt_toc_wrapper');
177177 $this->output->addHTML('<h2 class="lqt_toc_title">'.wfMsg('lqt_contents_title').'</h2> <ul>');
178 -
 178+
179179 foreach($threads as $t) {
180180 $this->output->addHTML('<li><a href="#'.$this->anchorName($t).'">'.$t->subjectWithoutIncrement().'</a></li>');
181181 }
182 -
 182+
183183 $this->output->addHTML('</ul></div>');
184184 }
185185
186186 function showArchiveWidget($threads) {
187187 $threadlinks = $this->permalinksForThreads($threads);
188188 $url = $this->talkpageUrl($this->title, 'talkpage_archive');
189 -
 189+
190190 if ( count($threadlinks) > 0 ) {
191191 $this->openDiv('lqt_archive_teaser');
192192 $this->output->addHTML('<h2 class="lqt_recently_archived">'.wfMsg('lqt_recently_archived').'</h2>');
193193 // $this->output->addHTML("<span class=\"lqt_browse_archive\">[<a href=\"$url\">".wfMsg('lqt_browse_archive_with_recent')."</a>]</span></h2>");
194194 $this->outputList('ul', '', '', $threadlinks);
195195 $this->closeDiv();
196 - } else {
 196+ } else {
197197 }
198198 }
199 -
 199+
200200 function show() {
201201 global $wgHooks, $wgUser;
202202 $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
@@ -203,7 +203,7 @@
204204 $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() );
205205 self::addJSandCSS();
206206 $article = new Article( $this->title );
207 -
 207+
208208 if( $this->methodApplies('talkpage_sort_order') ) {
209209 global $wgRequest;
210210 $remember_sort_checked = $wgRequest->getVal('lqt_remember_sort') ? 'checked ' : '';
@@ -233,8 +233,8 @@
234234 $lqt_sort_newest_threads = wfMsg('lqt_sort_newest_threads');
235235 $lqt_sort_oldest_threads = wfMsg('lqt_sort_oldest_threads');
236236 $go=wfMsg('go');
237 - if($wgUser->isLoggedIn()) {
238 - $remember_sort =
 237+ if($wgUser->isLoggedIn()) {
 238+ $remember_sort =
239239 <<<HTML
240240 <br />
241241 <label for="lqt_remember_sort_checkbox">
@@ -245,7 +245,7 @@
246246 $remember_sort = '';
247247 }
248248 $this->openDiv('lqt_view_options');
249 - $this->output->addHTML(
 249+ $this->output->addHTML(
250250
251251 <<<HTML
252252 <form name="lqt_sort" action="$form_action_url" method="post">$lqt_sorting_order
@@ -268,7 +268,7 @@
269269 $threads = $this->queries->query('fresh');
270270
271271 $this->openDiv('lqt_toc_archive_wrapper');
272 -
 272+
273273 $this->openDiv('lqt_archive_teaser_empty');
274274 $this->output->addHTML("<div class=\"lqt_browse_archive\"><a href=\"{$this->talkpageUrl($this->title, 'talkpage_archive')}\">".wfMsg('lqt_browse_archive_without_recent')."</a></div>");
275275 $this->closeDiv();
@@ -280,7 +280,7 @@
281281 $this->closeDiv();
282282 // Clear any floats
283283 $this->output->addHTML('<br clear="all" />');
284 -
 284+
285285 foreach($threads as $t) {
286286 $this->showThread($t);
287287 }
@@ -441,7 +441,7 @@
442442 'lqt_archive_end' => $months[$ne]))
443443 . '">'.wfMsg ( 'lqt-newer' ).'»</a>';
444444 }
445 - else {
 445+ else {
446446 $older = '<span class="lqt_newer_older_disabled" title="This link is disabled because you are viewing threads from all dates.">«'.wfMsg ( 'lqt-older' ).'</span>';
447447 $newer = '<span class="lqt_newer_older_disabled" title="This link is disabled because you are viewing threads from all dates.">'.wfMsg ( 'lqt-newer' ).'»</span>';
448448 }
@@ -642,18 +642,18 @@
643643 function show() {
644644 global $wgHooks, $wgOut, $wgTitle, $wgRequest;
645645 $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
646 -
 646+
647647 if( $wgRequest->getVal('action') === 'edit' ) {
648648 $warn_bold = '<strong>' . wfMsg('lqt_header_warning_bold') . '</strong>';
649649 $warn_link = '<a href="'.$this->talkpageUrl($wgTitle, 'talkpage_new_thread').'">'.
650650 wfMsg('lqt_header_warning_new_discussion').'</a>';
651651 $wgOut->addHTML('<p class="lqt_header_warning">' .
652652 wfMsg('lqt_header_warning_before_big', $warn_bold, $warn_link) .
653 - '<big>' . wfMsg('lqt_header_warning_big', $warn_bold, $warn_link) . '</big>' .
 653+ '<big>' . wfMsg('lqt_header_warning_big', $warn_bold, $warn_link) . '</big>' .
654654 wfMsg('lqt_header_warning_after_big', $warn_bold, $warn_link) .
655655 '</p>');
656656 }
657 -
 657+
658658 return true;
659659 }
660660 }
Index: trunk/extensions/LiquidThreads/LqtModel.php
@@ -135,14 +135,14 @@
136136
137137
138138 class ThreadHistoryIterator extends ArrayIterator {
139 -
 139+
140140 function __construct($thread, $limit, $offset) {
141141 $this->thread = $thread;
142142 $this->limit = $limit;
143143 $this->offset = $offset;
144144 $this->loadRows();
145145 }
146 -
 146+
147147 private function loadRows() {
148148 if( $this->offset == 0 ) {
149149 $this->append( $this->thread );
@@ -150,7 +150,7 @@
151151 } else {
152152 $this->offset -= 1;
153153 }
154 -
 154+
155155 $dbr =& wfGetDB( DB_SLAVE );
156156 $res = $dbr->select(
157157 'historical_thread',
@@ -188,7 +188,7 @@
189189 $this->changeUser = $t->changeUser;
190190 $this->changeUserText = $t->changeUserText;
191191 $this->editedness = $t->editedness;
192 -
 192+
193193 $this->replies = array();
194194 foreach ($t->replies as $r) {
195195 $this->replies[] = new HistoricalThread($r);
@@ -233,20 +233,20 @@
234234
235235 class Thread {
236236 /* SCHEMA changes must be reflected here. */
237 -
 237+
238238 /* ID references to other objects that are loaded on demand: */
239239 protected $rootId;
240240 protected $articleId;
241241 protected $summaryId;
242242 protected $ancestorId;
243243 protected $parentId;
244 -
 244+
245245 /* Actual objects loaded on demand from the above when accessors are called: */
246246 protected $root;
247247 protected $article;
248248 protected $summary;
249249 protected $superthread;
250 -
 250+
251251 /* Subject page of the talkpage we're attached to: */
252252 protected $articleNamespace;
253253 protected $articleTitle;
@@ -254,45 +254,45 @@
255255 /* Timestamps: */
256256 protected $modified;
257257 protected $created;
258 -
 258+
259259 protected $id;
260260 protected $revisionNumber;
261261 protected $type;
262 -
 262+
263263 /* Flag about who has edited or replied to this thread. */
264264 protected $editedness;
265 -
 265+
266266 /* Information about what changed in this revision. */
267267 protected $changeType;
268268 protected $changeObject;
269269 protected $changeComment;
270270 protected $changeUser;
271271 protected $changeUserText;
272 -
 272+
273273 /* Only used by $double to be saved into a historical thread. */
274274 protected $rootRevision;
275 -
 275+
276276 /* Copy of $this made when first loaded from database, to store the data
277277 we will write to the history if a new revision is commited. */
278278 protected $double;
279 -
 279+
280280 protected $replies;
281 -
 281+
282282 function isHistorical() {
283283 return false;
284284 }
285 -
 285+
286286 function revisionNumber() {
287287 return $this->revisionNumber;
288288 }
289 -
 289+
290290 function atRevision($r) {
291291 if ( $r == $this->revisionNumber() )
292292 return $this;
293293 else
294294 return HistoricalThread::withIdAtRevision($this->id(), $r);
295295 }
296 -
 296+
297297 function historicalRevisions() {
298298 $dbr =& wfGetDB( DB_SLAVE );
299299 $res = $dbr->select(
@@ -306,7 +306,7 @@
307307 }
308308 return $results;
309309 }
310 -/*
 310+/*
311311 function ancestors() {
312312 $id_clauses = array();
313313 foreach( explode('.', $this->path) as $id ) {
@@ -315,17 +315,17 @@
316316 $where = implode(' OR ', $id_clauses);
317317 return Threads::where($where);
318318 }
319 -*/
 319+*/
320320 private function bumpRevisionsOnAncestors($change_type, $change_object, $change_reason, $timestamp) {
321321 global $wgUser; // TODO global.
322 -
323 - $this->revisionNumber += 1;
 322+
 323+ $this->revisionNumber += 1;
324324 $this->setChangeType($change_type);
325325 $this->setChangeObject($change_object);
326326 $this->changeComment = $change_reason;
327327 $this->changeUser = $wgUser->getID();
328328 $this->changeUserText = $wgUser->getName();
329 -
 329+
330330 if( $this->hasSuperthread() )
331331 $this->superthread()->bumpRevisionsOnAncestors($change_type, $change_object, $change_reason, $timestamp);
332332 $dbr =& wfGetDB( DB_MASTER );
@@ -340,7 +340,7 @@
341341 /* WHERE */ array( 'thread_id' => $this->id ),
342342 __METHOD__);
343343 }
344 -
 344+
345345 private static function setChangeOnDescendents($thread, $change_type, $change_object) {
346346 // TODO this is ludicrously inefficient.
347347 $thread->setChangeType($change_type);
@@ -356,7 +356,7 @@
357357 self::setChangeOnDescendents($r, $change_type, $change_object);
358358 return $thread;
359359 }
360 -
 360+
361361 function commitRevision($change_type, $change_object = null, $reason = "") {
362362 global $wgUser; // TODO global.
363363 /*
@@ -369,7 +369,7 @@
370370
371371 $this->bumpRevisionsOnAncestors($change_type, $change_object, $reason, wfTimestampNow());
372372 self::setChangeOnDescendents($this->topmostThread(), $change_type, $change_object);
373 -
 373+
374374 if( $change_type == Threads::CHANGE_REPLY_CREATED
375375 && $this->editedness == Threads::EDITED_NEVER ) {
376376 $this->editedness = Threads::EDITED_HAS_REPLY;
@@ -381,9 +381,9 @@
382382 $this->editedness = Threads::EDITED_BY_AUTHOR;
383383 }
384384 }
385 -
 385+
386386 /* SCHEMA changes must be reflected here. */
387 -
 387+
388388 $dbr =& wfGetDB( DB_MASTER );
389389 $res = $dbr->update( 'thread',
390390 /* SET */array( 'thread_root' => $this->rootId,
@@ -404,15 +404,15 @@
405405 ),
406406 /* WHERE */ array( 'thread_id' => $this->id, ),
407407 __METHOD__);
408 -
 408+
409409 NewMessages::writeMessageStateForUpdatedThread($this);
410 -
411 -
 410+
 411+
412412 // RecentChange::notifyEdit( wfTimestampNow(), $this->root(), /*minor*/false, $wgUser, $summary,
413413 // $lastRevision, $this->getModified(), $bot, '', $oldsize, $newsize,
414414 // $revisionId );
415415 }
416 -
 416+
417417 function delete($reason) {
418418 $this->type = Threads::TYPE_DELETED;
419419 $this->revisionNumber += 1;
@@ -423,13 +423,13 @@
424424 $this->revisionNumber += 1;
425425 $this->commitRevision(Threads::CHANGE_UNDELETED, $this, $reason);
426426 }
427 -
 427+
428428 function moveToSubjectPage($title, $reason, $leave_trace) {
429429 $dbr =& wfGetDB( DB_MASTER );
430 -
 430+
431431 $new_articleNamespace = $title->getNamespace();
432432 $new_articleTitle = $title->getDBkey();
433 -
 433+
434434 foreach($this->replies as $r) {
435435 $res = $dbr->update( 'thread',
436436 /* SET */array(
@@ -439,21 +439,21 @@
440440 /* WHERE */ array( 'thread_id' => $r->id(), ),
441441 __METHOD__);
442442 }
443 -
 443+
444444 $this->articleNamespace = $new_articleNamespace;
445445 $this->articleTitle = $new_articleTitle;
446446 $this->revisionNumber += 1;
447447 $this->commitRevision(Threads::CHANGE_MOVED_TALKPAGE, null, $reason);
448 -
 448+
449449 if($leave_trace) {
450450 $this->leaveTrace($reason);
451451 }
452452 }
453 -
 453+
454454 function leaveTrace($reason) {
455455 /* Adapted from Title::moveToNewTitle. But now the new title exists on the old talkpage. */
456456 $dbw =& wfGetDB( DB_MASTER );
457 -
 457+
458458 $mwRedir = MagicWord::get( 'redirect' );
459459 $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $this->title()->getPrefixedText() . "]]\n";
460460 $redirectArticle = new Article( LqtView::incrementedTitle( $this->subjectWithoutIncrement(),
@@ -488,12 +488,12 @@
489489 # The new title, and links to the new title, are purged in Article::onArticleCreate()
490490 # $this-->purgeSquid();
491491 }
492 -
493 -
494492
 493+
 494+
495495 function __construct($line, $children) {
496496 /* SCHEMA changes must be reflected here. */
497 -
 497+
498498 $this->id = $line->thread_id;
499499 $this->rootId = $line->thread_root;
500500 $this->articleNamespace = $line->thread_article_namespace;
@@ -517,18 +517,18 @@
518518 $this->root->loadPageData($line);
519519 $this->rootRevision = $this->root->mLatest;
520520 }
521 -
 521+
522522 function initWithReplies( $children ) {
523 -
 523+
524524 $this->replies = $children;
525 -
 525+
526526 $this->double = clone $this;
527527 }
528 -
 528+
529529 function __clone() {
530530 // Cloning does not normally create a new array (but the clone keyword doesn't
531531 // work on arrays -- go figure).
532 -
 532+
533533 // Update: this doesn't work for some reason, but why do we update the replies array
534534 // in the first place after creating a new reply?
535535 $new_array = array();
@@ -564,7 +564,7 @@
565565 function replies() {
566566 return $this->replies;
567567 }
568 -
 568+
569569 function setSuperthread($thread) {
570570 $this->parentId = $thread->id();
571571 $this->ancestorId = $thread->ancestorId();
@@ -592,7 +592,7 @@
593593 else
594594 return Threads::withId( $this->ancestorId );
595595 }
596 -
 596+
597597 function setArticle($a) {
598598 $this->articleId = $a->getID();
599599 $this->articleNamespace = $a->getTitle()->getNamespace();
@@ -616,18 +616,18 @@
617617 function id() {
618618 return $this->id;
619619 }
620 -
 620+
621621 function ancestorId() {
622622 return $this->ancestorId;
623623 }
624 -
 624+
625625 function root() {
626626 if ( !$this->rootId ) return null;
627627 if ( !$this->root ) $this->root = new Post( Title::newFromID( $this->rootId ),
628628 $this->rootRevision() );
629629 return $this->root;
630630 }
631 -
 631+
632632 function setRootRevision($rr) {
633633 if( (is_object($rr)) ) {
634634 $this->rootRevision = $rr->getId();
@@ -635,30 +635,30 @@
636636 $this->rootRevision = $rr;
637637 }
638638 }
639 -
 639+
640640 function rootRevision() {
641641 return $this->rootRevision;
642642 }
643 -
 643+
644644 function editedness() {
645645 return $this->editedness;
646646 }
647 -
 647+
648648 function summary() {
649649 if ( !$this->summaryId ) return null;
650650 if ( !$this->summary ) $this->summary = new Post( Title::newFromID( $this->summaryId ) );
651651 return $this->summary;
652652 }
653 -
 653+
654654 function hasSummary() {
655655 return $this->summaryId != null;
656656 }
657 -
 657+
658658 function setSummary( $post ) {
659659 $this->summary = null;
660660 $this->summaryId = $post->getID();
661661 }
662 -
 662+
663663 function title() {
664664 return $this->root()->getTitle();
665665 }
@@ -670,15 +670,15 @@
671671 else
672672 return $matches;
673673 }
674 -
 674+
675675 function wikilink() {
676676 return $this->root()->getTitle()->getPrefixedText();
677677 }
678 -
 678+
679679 function subject() {
680680 return $this->root()->getTitle()->getText();
681681 }
682 -
 682+
683683 function wikilinkWithoutIncrement() {
684684 $tmp = $this->splitIncrementFromSubject($this->wikilink()); return $tmp[1];
685685 }
@@ -686,11 +686,11 @@
687687 function subjectWithoutIncrement() {
688688 $tmp = $this->splitIncrementFromSubject($this->subject()); return $tmp[1];
689689 }
690 -
 690+
691691 function increment() {
692692 $tmp = $this->splitIncrementFromSubject($this->subject()); return $tmp[2];
693693 }
694 -
 694+
695695 function hasDistinctSubject() {
696696 if( $this->hasSuperthread() ) {
697697 return $this->superthread()->subjectWithoutIncrement()
@@ -699,7 +699,7 @@
700700 return true;
701701 }
702702 }
703 -
 703+
704704 function hasSubthreads() {
705705 return count($this->replies) != 0;
706706 }
@@ -711,19 +711,19 @@
712712 function modified() {
713713 return $this->modified;
714714 }
715 -
 715+
716716 function created() {
717717 return $this->created;
718718 }
719 -
 719+
720720 function type() {
721721 return $this->type;
722722 }
723 -
 723+
724724 function changeType() {
725725 return $this->changeType;
726726 }
727 -
 727+
728728 private function replyWithId($id) {
729729 if( $this->id == $id ) return $this;
730730 foreach ( $this->replies as $r ) {
@@ -738,7 +738,7 @@
739739 function changeObject() {
740740 return $this->replyWithId( $this->changeObject );
741741 }
742 -
 742+
743743 function setChangeType($t) {
744744 if (in_array($t, Threads::$VALID_CHANGE_TYPES)) {
745745 $this->changeType = $t;
@@ -746,7 +746,7 @@
747747 throw new MWException( __METHOD__ . ": invalid changeType $t." );
748748 }
749749 }
750 -
 750+
751751 function setChangeObject($o) {
752752 # we assume $o to be a Thread.
753753 if($o === null) {
@@ -755,7 +755,7 @@
756756 $this->changeObject = $o->id();
757757 }
758758 }
759 -
 759+
760760 function changeUser() {
761761 if( $this->changeUser == 0 ) {
762762 return User::newFromName($this->changeUserText, false);
@@ -763,11 +763,11 @@
764764 return User::newFromId($this->changeUser);
765765 }
766766 }
767 -
 767+
768768 function changeComment() {
769769 return $this->changeComment;
770770 }
771 -
 771+
772772 function redirectThread() {
773773 $rev = Revision::newFromId($this->root()->getLatest());
774774 $rtitle = Title::newFromRedirect($rev->getRawText());
@@ -775,7 +775,7 @@
776776 $rthread = Threads::withRoot(new Article($rtitle));
777777 return $rthread;
778778 }
779 -
 779+
780780 // Called from hook in Title::isProtected.
781781 static function getRestrictionsForTitle($title, $action, &$result) {
782782 $thread = Threads::withRoot(new Post($title));
@@ -784,7 +784,7 @@
785785 else
786786 return true; // not a thread; do normal protection check.
787787 }
788 -
 788+
789789 // This only makes sense when called from the hook, because it uses the hook's
790790 // default behavior to check whether this thread itself is protected, so you'll
791791 // get false negatives if you use it from some other context.
@@ -794,7 +794,7 @@
795795 } else {
796796 $parent_restrictions = $this->article()->getTitle()->getTalkPage()->getRestrictions($action);
797797 }
798 -
 798+
799799 // TODO this may not be the same as asking "are the parent restrictions more restrictive than
800800 // our own restrictions?", which is what we really want.
801801 if( count($parent_restrictions) == 0 ) {
@@ -803,7 +803,7 @@
804804 $result = $parent_restrictions;
805805 return false;
806806 }
807 -
 807+
808808 }
809809 }
810810
@@ -815,7 +815,7 @@
816816 const TYPE_MOVED = 1;
817817 const TYPE_DELETED = 2;
818818 static $VALID_TYPES = array(self::TYPE_NORMAL, self::TYPE_MOVED, self::TYPE_DELETED);
819 -
 819+
820820 const CHANGE_NEW_THREAD = 0;
821821 const CHANGE_REPLY_CREATED = 1;
822822 const CHANGE_EDITED_ROOT = 2;
@@ -826,7 +826,7 @@
827827 static $VALID_CHANGE_TYPES = array(self::CHANGE_EDITED_SUMMARY, self::CHANGE_EDITED_ROOT,
828828 self::CHANGE_REPLY_CREATED, self::CHANGE_NEW_THREAD, self::CHANGE_DELETED, self::CHANGE_UNDELETED,
829829 self::CHANGE_MOVED_TALKPAGE);
830 -
 830+
831831 // Possible values of Thread->editedness.
832832 const EDITED_NEVER = 0;
833833 const EDITED_HAS_REPLY = 1;
@@ -835,25 +835,25 @@
836836
837837 static $cache_by_root = array();
838838 static $cache_by_id = array();
839 -
 839+
840840 static function newThread( $root, $article, $superthread = null, $type = self::TYPE_NORMAL ) {
841841 // SCHEMA changes must be reflected here.
842842 // TODO: It's dumb that the commitRevision code isn't used here.
843843
844844 $dbr =& wfGetDB( DB_MASTER );
845 -
 845+
846846 if ( !in_array($type, self::$VALID_TYPES) ) {
847847 throw new MWException(__METHOD__ . ": invalid type $type.");
848848 }
849 -
 849+
850850 if ($superthread) {
851851 $change_type = self::CHANGE_REPLY_CREATED;
852852 } else {
853853 $change_type = self::CHANGE_NEW_THREAD;
854854 }
855 -
 855+
856856 global $wgUser; // TODO global.
857 -
 857+
858858 $timestamp = wfTimestampNow();
859859
860860 $res = $dbr->insert('thread',
@@ -870,9 +870,9 @@
871871 'thread_type' => $type,
872872 'thread_editedness' => self::EDITED_NEVER),
873873 __METHOD__);
874 -
 874+
875875 $newid = $dbr->insertId();
876 -
 876+
877877 if( $superthread ) {
878878 $ancestor = $superthread->ancestorId();
879879 $change_object_clause = 'thread_change_object = ' . $newid;
@@ -885,17 +885,17 @@
886886 $change_object_clause ),
887887 /* WHERE */ array( 'thread_id' => $newid, ),
888888 __METHOD__);
889 -
 889+
890890 // TODO we could avoid a query here.
891891 $newthread = Threads::withId($newid);
892892 if($superthread) {
893893 $superthread->addReply( $newthread );
894894 }
895 -
 895+
896896 self::createTalkpageIfNeeded($article);
897 -
 897+
898898 NewMessages::writeMessageStateForUpdatedThread($newthread);
899 -
 899+
900900 return $newthread;
901901 }
902902
@@ -909,23 +909,23 @@
910910 if( ! $talkpage->exists() ) {
911911 try {
912912 $talkpage->doEdit( "", wfMsg('lqt_talkpage_autocreate_summary'), EDIT_NEW | EDIT_SUPPRESS_RC );
913 -
 913+
914914 } catch( DBQueryError $e ) {
915915 // The article already existed by now. No need to do anything.
916916 wfDebug(__METHOD__ . ": Article already existed by the time we tried to create it.");
917917 }
918918 }
919919 }
920 -
 920+
921921 static function where( $where, $options = array(), $extra_tables = array(), $joins = "" ) {
922922 global $wgDBprefix;
923923 $dbr = wfGetDB( DB_SLAVE );
924924 if ( is_array($where) ) $where = $dbr->makeList( $where, LIST_AND );
925925 if ( is_array($options) ) $options = implode(',', $options);
926 -
 926+
927927 if( is_array($extra_tables) && count($extra_tables) != 0 ) {
928928 if(!empty($wgDBprefix)) {
929 - foreach($extra_tables as $tablekey=>$extra_table)
 929+ foreach($extra_tables as $tablekey=>$extra_table)
930930 $extra_tables[$tablekey]=$wgDBprefix.$extra_table;
931931 }
932932 $tables = implode(',', $extra_tables) . ', ';
@@ -934,7 +934,7 @@
935935 } else {
936936 $tables = "";
937937 }
938 -
 938+
939939 /* Select the client's threads, AND all their children.
940940 The ones the client actually asked for are marked with root_test.
941941 In theory we could also grab the page and revision data, to avoid having
@@ -952,7 +952,7 @@
953953 $options
954954 SQL;
955955
956 - $res = $dbr->query($sql);
 956+ $res = $dbr->query($sql);
957957
958958 $threads = array();
959959 $top_level_threads = array();
@@ -970,7 +970,7 @@
971971 $thread_children[$line->thread_parent][] = $new_thread;
972972 }
973973 }
974 -
 974+
975975 /*
976976 The two clauses of the above loop used to be orthogonal, instead of exclusive. The reason
977977 they are exclusive is not that 'is_root' indicates a top-level thread -- 'is_root' indicates
@@ -986,7 +986,7 @@
987987 } else {
988988 $thread->initWithReplies( array() );
989989 }
990 -
 990+
991991 self::$cache_by_root[$thread->root()->getID()] = $thread;
992992 self::$cache_by_id[$thread->id()] = $thread;
993993 }
@@ -998,7 +998,7 @@
999999 echo("Corrupt liquidthreads database: $msg");
10001000 die();
10011001 }
1002 -
 1002+
10031003 private static function assertSingularity( $threads, $attribute, $value ) {
10041004 if( count($threads) == 0 ) { return null; }
10051005 if( count($threads) == 1 ) { return $threads[0]; }
@@ -1028,12 +1028,12 @@
10291029 $ts = Threads::where( array('thread.thread_id' => $id ) );
10301030 return self::assertSingularity($ts, 'thread_id', $id);
10311031 }
1032 -
 1032+
10331033 static function withSummary( $article ) {
10341034 $ts = Threads::where( array('thread.thread_summary_page' => $article->getId()));
10351035 return self::assertSingularity($ts, 'thread_summary_page', $article->getId());
10361036 }
1037 -
 1037+
10381038 /**
10391039 * Horrible, horrible!
10401040 * List of months in which there are >0 threads, suitable for threadsOfArticleInMonth. */
@@ -1048,7 +1048,7 @@
10491049 }
10501050 return $months;
10511051 }
1052 -
 1052+
10531053 static function articleClause($article) {
10541054 $dbr = wfGetDB(DB_SLAVE);
10551055 $q_article= $dbr->addQuotes($article->getTitle()->getDBkey());
@@ -1057,7 +1057,7 @@
10581058 AND thread.thread_article_namespace = {$article->getTitle()->getNamespace()})
10591059 SQL;
10601060 }
1061 -
 1061+
10621062 static function topLevelClause() {
10631063 return 'thread.thread_parent is null';
10641064 }
@@ -1067,15 +1067,15 @@
10681068
10691069 class QueryGroup {
10701070 protected $queries;
1071 -
 1071+
10721072 function __construct() {
10731073 $this->queries = array();
10741074 }
1075 -
 1075+
10761076 function addQuery( $name, $where, $options = array(), $extra_tables = array() ) {
10771077 $this->queries[$name] = array($where, $options, $extra_tables);
10781078 }
1079 -
 1079+
10801080 function extendQuery( $original, $newname, $where, $options = array(), $extra_tables=array() ) {
10811081 if (!array_key_exists($original,$this->queries)) return;
10821082 $q = $this->queries[$original];
@@ -1083,11 +1083,11 @@
10841084 array_merge($q[1], $options),
10851085 array_merge($q[2], $extra_tables) );
10861086 }
1087 -
 1087+
10881088 function deleteQuery( $name ) {
10891089 unset ($this->queries[$name]);
10901090 }
1091 -
 1091+
10921092 function query($name) {
10931093 if ( !array_key_exists($name,$this->queries) ) return array();
10941094 list($where, $options, $extra_tables) = $this->queries[$name];
@@ -1097,27 +1097,27 @@
10981098
10991099
11001100 class NewMessages {
1101 -
 1101+
11021102 static function markThreadAsUnreadByUser($thread, $user) {
11031103 self::writeUserMessageState($thread, $user, null);
11041104 }
1105 -
 1105+
11061106 static function markThreadAsReadByUser($thread, $user) {
1107 - self::writeUserMessageState($thread, $user, wfTimestampNow());
 1107+ self::writeUserMessageState($thread, $user, wfTimestampNow());
11081108 }
1109 -
 1109+
11101110 private static function writeUserMessageState($thread, $user, $timestamp) {
11111111 global $wgDBprefix;
11121112 if( is_object($thread) ) $thread_id = $thread->id();
11131113 else if( is_integer($thread) ) $thread_id = $thread;
11141114 else throw new MWException("writeUserMessageState expected Thread or integer but got $thread");
1115 -
 1115+
11161116 if( is_object($user) ) $user_id = $user->getID();
11171117 else if( is_integer($user) ) $user_id = $user;
11181118 else throw new MWException("writeUserMessageState expected User or integer but got $user");
1119 -
 1119+
11201120 if ( $timestamp === null ) $timestamp = "NULL";
1121 -
 1121+
11221122 // use query() directly to pass in 'true' for don't-die-on-errors.
11231123 $dbr =& wfGetDB( DB_MASTER );
11241124 $success = $dbr->query("insert into {$wgDBprefix}user_message_state values ($user_id, $thread_id, $timestamp)",
@@ -1131,7 +1131,7 @@
11321132 }
11331133 }
11341134
1135 - /**
 1135+ /**
11361136 * Write a user_message_state for each user who is watching the thread.
11371137 * If the thread is on a user's talkpage, set that user's newtalk.
11381138 */
@@ -1147,15 +1147,15 @@
11481148 $user->setNewtalk(true);
11491149 }
11501150 }
1151 -
 1151+
11521152 $dbw =& wfGetDB( DB_MASTER );
1153 -
 1153+
11541154 $talkpage_t = $t->article()->getTitle();
11551155 $root_t = $t->root()->getTitle();
1156 -
 1156+
11571157 $q_talkpage_t = $dbw->addQuotes($talkpage_t->getDBkey());
11581158 $q_root_t = $dbw->addQuotes($root_t->getDBkey());
1159 -
 1159+
11601160 // Select any applicable watchlist entries for the thread.
11611161 $where_clause = <<<SQL
11621162 (
@@ -1163,14 +1163,14 @@
11641164 or (wl_namespace = {$root_t->getNamespace()} and wl_title = $q_root_t )
11651165 )
11661166 SQL;
1167 -
 1167+
11681168 // it sucks to not have 'on duplicate key update'. first update users who already have a ums for this thread
11691169 // and who have already read it, by setting their state to unread.
11701170 $dbw->query("update {$wgDBprefix}user_message_state, {$wgDBprefix}watchlist set ums_read_timestamp = null where ums_user = wl_user and ums_thread = {$t->id()} and $where_clause");
1171 -
 1171+
11721172 $dbw->query("insert ignore into {$wgDBprefix}user_message_state (ums_user, ums_thread) select user_id, {$t->id()} from {$wgDBprefix}user, {$wgDBprefix}watchlist where user_id = wl_user and $where_clause;");
11731173 }
1174 -
 1174+
11751175 static function newUserMessages($user) {
11761176 global $wgDBprefix;
11771177 return Threads::where( array('ums_read_timestamp is null',
@@ -1187,5 +1187,3 @@
11881188 }
11891189
11901190 }
1191 -
1192 -?>
Index: trunk/extensions/LiquidThreads/lqt.css
@@ -196,7 +196,7 @@
197197 .lqt_archive_listing th {
198198 text-align: left;
199199 vertical-align: baseline;
200 - font-weight: bold;
 200+ font-weight: bold;
201201 border-bottom: 1px solid #ddd;
202202 }
203203
@@ -330,7 +330,7 @@
331331 padding-left: 0.6em;
332332 }
333333
334 -#lqt_subject_field {
 334+#lqt_subject_field {
335335 margin-top: 0.7em;
336336 margin-bottom: 0.5em;
337337 width: 80%;
@@ -449,4 +449,4 @@
450450 }
451451 .lqt_remember_sort {
452452 font-size:85%;
453 -}
\ No newline at end of file
 453+}
Index: trunk/extensions/LiquidThreads/lqt.js
@@ -1,20 +1,20 @@
22 // http://onlinetools.org/articles/unobtrusivejavascript/chapter4.html
3 -function lqt_add_event(obj, evType, fn){
4 - if (obj.addEventListener){
5 - obj.addEventListener(evType, fn, false);
6 - return true;
7 - } else if (obj.attachEvent){
8 - var r = obj.attachEvent("on"+evType, fn);
9 - return r;
10 - } else {
11 - return false;
12 - }
 3+function lqt_add_event(obj, evType, fn){
 4+ if (obj.addEventListener){
 5+ obj.addEventListener(evType, fn, false);
 6+ return true;
 7+ } else if (obj.attachEvent){
 8+ var r = obj.attachEvent("on"+evType, fn);
 9+ return r;
 10+ } else {
 11+ return false;
 12+ }
1313 }
1414
1515 var LqtDateRangeRectifier = function( startsel, endsel ) {
1616 this.startsel = startsel;
1717 this.endsel = endsel;
18 -
 18+
1919 this.oldstart = this.startsel.selectedIndex;
2020 this.oldend = this.endsel.selectedIndex;
2121
@@ -60,8 +60,8 @@
6161 if ( !filter.checked ) {
6262 start.selectedIndex = end.selectedIndex = 0;
6363 }
64 -
 64+
6565 }
6666 }
6767
68 -addOnloadHook(lqt_on_load);
\ No newline at end of file
 68+addOnloadHook(lqt_on_load);
Index: trunk/extensions/LiquidThreads/LqtBaseView.php
@@ -70,7 +70,7 @@
7171 // We are given a talkpage article and title. Find the associated
7272 // non-talk article and pass that to the view.
7373 $article = new Article($title->getSubjectPage());
74 -
 74+
7575 if( $title->getSubjectPage()->getNamespace() == NS_LQT_THREAD ) {
7676 // Threads don't have talk pages; redirect to the thread page.
7777 $output->redirect($title->getSubjectPage()->getFullUrl());
@@ -98,7 +98,7 @@
9999 }
100100
101101 static function threadPermalinkMain(&$output, &$article, &$title, &$user, &$request) {
102 -
 102+
103103 $action = $request->getVal('action');
104104 $lqt_method = $request->getVal('lqt_method');
105105
@@ -128,13 +128,13 @@
129129 $view = new $viewname( $output, $article, $title, $user, $request );
130130 return $view->show();
131131 }
132 -
 132+
133133 static function threadSummaryMain(&$output, &$article, &$title, &$user, &$request) {
134134 $viewname = self::$views['SummaryPageView'];
135135 $view = new $viewname( $output, $article, $title, $user, $request );
136136 return $view->show();
137137 }
138 -
 138+
139139 /**
140140 * If the page we recieve is a Liquid Threads page of any kind, process it
141141 * as needed and return True. If it's a normal, non-liquid page, return false.
@@ -149,28 +149,28 @@
150150 }
151151 return true;
152152 }
153 -
 153+
154154 static function onPageMove( $movepage, $ot, $nt ) {
155155 // We are being invoked on the subject page, not the talk page.
156 -
 156+
157157 $threads = Threads::where( array( Threads::articleClause(new Article($ot)),
158158 Threads::topLevelClause() ));
159 -
 159+
160160 foreach ($threads as $t) {
161161 $t->moveToSubjectPage( $nt, false );
162162 }
163 -
 163+
164164 return true;
165165 }
166 -
 166+
167167 static function makeLinkObj( &$returnValue, &$linker, $nt, $text, $query, $trail, $prefix ) {
168168 if( ! $nt->isTalkPage() )
169169 return true;
170 -
 170+
171171 // Talkpages with headers.
172172 if( $nt->getArticleID() != 0 )
173173 return true;
174 -
 174+
175175 // Talkpages without headers -- check existance of threads.
176176 $article = new Article($nt->getSubjectPage());
177177 $threads = Threads::where(Threads::articleClause($article), "LIMIT 1");
@@ -183,14 +183,14 @@
184184 $text = htmlspecialchars( $nt->getPrefixedText() );
185185 $style = $linker->getInternalLinkAttributesObj( $nt, $text, "yes" );
186186 list( $inside, $trail ) = Linker::splitTrail( $trail );
187 - $returnValue = "<a href=\"{$url}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
 187+ $returnValue = "<a href=\"{$url}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
188188 }
189189 else {
190190 $returnValue = $linker->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
191191 }
192192 return false;
193193 }
194 -
 194+
195195 // One major place that doesn't use makeLinkObj is the tabs. So override known/unknown there too.
196196 static function tabAction(&$skintemplate, $title, $message, $selected, $checkEdit,
197197 &$classes, &$query, &$text, &$result) {
@@ -199,7 +199,7 @@
200200 if( $title->getArticleID() != 0 ) {
201201 $query = "";
202202 return true;
203 - }
 203+ }
204204 // It's a talkpage without a header. Get rid of action=edit always,
205205 // color as apropriate.
206206 $query = "";
@@ -212,7 +212,7 @@
213213 }
214214 return true;
215215 }
216 -
 216+
217217 static function changesListArticleLink(&$changeslist, &$articlelink, &$s, &$rc, $unpatrolled, $watched) {
218218 $thread = null;
219219 if( $rc->getTitle()->getNamespace() == NS_LQT_THREAD ) {
@@ -234,7 +234,7 @@
235235 }
236236 return true;
237237 }
238 -
 238+
239239 static function setNewtalkHTML($skintemplate, $tpl) {
240240 global $wgUser, $wgTitle, $wgOut;
241241 $newmsg_t = SpecialPage::getPage('Newmessages')->getTitle();
@@ -256,29 +256,29 @@
257257 }
258258 }
259259
260 -
 260+
261261 class LqtView {
262262 protected $article;
263263 protected $output;
264264 protected $user;
265265 protected $title;
266266 protected $request;
267 -
 267+
268268 protected $headerLevel = 2; /* h1, h2, h3, etc. */
269269 protected $maxIndentationLevel = 4;
270270 protected $lastUnindentedSuperthread;
271 -
 271+
272272 protected $user_colors;
273273 protected $user_color_index;
274274 const number_of_user_colors = 6;
275275
276276 protected $queries;
277 -
 277+
278278 public $archive_start_days = 14;
279279 public $archive_recent_days = 5;
280280
281281 protected $sort_order=LQT_NEWEST_CHANGES;
282 -
 282+
283283 function __construct(&$output, &$article, &$title, &$user, &$request) {
284284 $this->article = $article;
285285 $this->output = $output;
@@ -289,11 +289,11 @@
290290 $this->user_color_index = 1;
291291 $this->queries = $this->initializeQueries();
292292 }
293 -
 293+
294294 function setHeaderLevel($int) {
295295 $this->headerLevel = $int;
296296 }
297 -
 297+
298298 function initializeQueries() {
299299
300300 if( $this->methodApplies('talkpage_sort_order') ) {
@@ -335,7 +335,7 @@
336336 array($article_clause,
337337 'thread.thread_parent is null',
338338 '(thread.thread_modified >= ' . $startdate->text() .
339 - ' OR (thread.thread_summary_page is NULL' .
 339+ ' OR (thread.thread_summary_page is NULL' .
340340 ' AND thread.thread_type='.Threads::TYPE_NORMAL.'))'),
341341 array($sort_clause));
342342 $g->addQuery('archived',
@@ -355,12 +355,12 @@
356356 }
357357
358358 static protected $occupied_titles = array();
359 -
 359+
360360 /*************************
361361 * (1) linking to liquidthreads pages and
362362 * (2) figuring out what page you're on and what you need to do.
363363 *************************/
364 -
 364+
365365 static function queryStringFromArray( $vars ) {
366366 $q = '';
367367 if ( $vars && count( $vars ) != 0 ) {
@@ -390,7 +390,7 @@
391391 if ( is_array($query) ) $query = self::queryStringFromArray($query);
392392 return $thread->root()->getTitle()->getFullUrl($query);
393393 }
394 -
 394+
395395 static function permalinkUrlWithDiff( $thread ) {
396396 $changed_thread = $thread->changeObject();
397397 $curr_rev_id = $changed_thread->rootRevision();
@@ -410,8 +410,8 @@
411411 }
412412 return $title->getFullURL( $query ) . ($operand && $includeFragment ? "#lqt_thread_{$operand->id()}" : "");
413413 }
414 -
415 -
 414+
 415+
416416 /**
417417 * Return a URL for the current page, including Title and query vars,
418418 * with the given replacements made.
@@ -480,7 +480,7 @@
481481 $this->showEditingFormInGeneral( null, 'summarize', $thread );
482482 }
483483
484 - private function showEditingFormInGeneral( $thread, $edit_type, $edit_applies_to ) {
 484+ private function showEditingFormInGeneral( $thread, $edit_type, $edit_applies_to ) {
485485 /*
486486 EditPage needs an Article. If there isn't a real one, as for new posts,
487487 replies, and new summaries, we need to generate a title. Auto-generated
@@ -504,14 +504,14 @@
505505 } else {
506506 $article = $thread->root();
507507 }
508 -
 508+
509509 $e = new EditPage($article);
510 -
 510+
511511 $e->suppressIntro = true;
512512 $e->editFormTextBeforeContent .=
513513 $this->perpetuate('lqt_method', 'hidden') .
514514 $this->perpetuate('lqt_operand', 'hidden');
515 -
 515+
516516 if ( $edit_type=='new' || ($thread && !$thread->hasSuperthread()) ) {
517517 // This is a top-level post; show the subject line.
518518 $db_subject = $thread ? $thread->subjectWithoutIncrement() : '';
@@ -526,7 +526,7 @@
527527 $e->edit();
528528
529529 // Override what happens in EditPage::showEditForm, called from $e->edit():
530 -// $wgOut->setArticleRelated( false );
 530+// $wgOut->setArticleRelated( false );
531531 $this->output->setArticleFlag( false );
532532
533533 // For replies and new posts, insert the associated thread object into the DB.
@@ -538,12 +538,12 @@
539539 $thread = Threads::newThread( $article, $this->article, null, $e->summary );
540540 }
541541 }
542 -
 542+
543543 if ($edit_type == 'summarize' && $e->didSave) {
544544 $edit_applies_to->setSummary( $article );
545545 $edit_applies_to->commitRevision(Threads::CHANGE_EDITED_SUMMARY, $edit_applies_to, $e->summary);
546546 }
547 -
 547+
548548 // Move the thread and replies if subject changed.
549549 if( $edit_type == 'editExisting' && $e->didSave ) {
550550 $subject = $this->request->getVal('lqt_subject_field', '');
@@ -555,7 +555,7 @@
556556 $thread->setRootRevision( Revision::newFromTitle($thread->root()->getTitle()) );
557557 $thread->commitRevision( Threads::CHANGE_EDITED_ROOT, $thread, $e->summary );
558558 }
559 -
 559+
560560 // A redirect without $e->didSave will happen if the new text is blank (EditPage::attemptSave).
561561 // This results in a new Thread object not being created for replies and new discussions,
562562 // so $thread is null. In that case, just allow editpage to redirect back to the talk page.
@@ -566,7 +566,7 @@
567567 $this->output->redirect( $edit_applies_to->title()->getFullURL() . '#' . 'lqt_thread_' . $edit_applies_to->id() );
568568 }
569569 }
570 -
 570+
571571 function renameThread($t,$s,$reason) {
572572 $this->simplePageMove($t->root()->getTitle(),$s, $reason);
573573 // TODO here create a redirect from old page to new.
@@ -574,7 +574,7 @@
575575 $this->renameThread($st, $s, $reason);
576576 }
577577 }
578 -
 578+
579579 function scratchTitle() {
580580 $token = md5(uniqid(rand(), true));
581581 return Title::newFromText( "Thread:$token" );
@@ -644,7 +644,7 @@
645645 */
646646 function threadFooterCommands($thread) {
647647 $commands = array();
648 -
 648+
649649 $user_can_edit = $thread->root()->getTitle()->quickUserCan( 'edit' );
650650
651651 $commands[] = array( 'label' => $user_can_edit ? wfMsg('edit') : wfMsg('viewsource'),
@@ -654,7 +654,7 @@
655655 $commands[] = array( 'label' => wfMsg('history_short'),
656656 'href' => $this->permalinkUrlWithQuery($thread, 'action=history'),
657657 'enabled' => true );
658 -
 658+
659659 $commands[] = array( 'label' => wfMsg('lqt_permalink'),
660660 'href' => $this->permalinkUrl( $thread ),
661661 'enabled' => true );
@@ -666,21 +666,21 @@
667667 'href' => $delete_url,
668668 'enabled' => true );
669669 }
670 -
 670+
671671 $commands[] = array( 'label' => '<b class="lqt_reply_link">' . wfMsg('lqt_reply') . '</b>',
672672 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ),
673673 'enabled' => $user_can_edit );
674674
675675 return $commands;
676676 }
677 -
 677+
678678 function topLevelThreadCommands($thread) {
679679 $commands = array();
680 -
 680+
681681 $commands[] = array( 'label' => wfMsg('history_short'),
682682 'href' => $this->permalinkUrl($thread, 'thread_history'),
683683 'enabled' => true );
684 -
 684+
685685 if( in_array('move', $this->user->getRights()) ) {
686686 $move_href = SpecialPage::getPage('Movethread')->getTitle()->getFullURL()
687687 . '/' . $thread->title()->getPrefixedURL();
@@ -697,14 +697,14 @@
698698 'href' => $this->permalinkUrlWithQuery($thread, 'action=unwatch'),
699699 'enabled' => true );
700700 }
701 -
 701+
702702 return $commands;
703703 }
704704
705705 /*************************
706706 * Output methods *
707707 *************************/
708 -
 708+
709709 static function addJSandCSS() {
710710 // Changed this to be static so that we can call it from
711711 // wfLqtBeforeWatchlistHook.
@@ -769,7 +769,7 @@
770770
771771 function showThreadFooter( $thread ) {
772772 global $wgLang; // TODO global.
773 -
 773+
774774 $author = $thread->root()->originalAuthor();
775775 $color_number = $this->selectNewUserColor($author);
776776
@@ -777,14 +777,14 @@
778778 $this->user->getSkin()->userToolLinks( $author->getID(), $author->getName() );
779779
780780 $timestamp = $wgLang->timeanddate($thread->created());
781 -
 781+
782782 $this->output->addHTML(<<<HTML
783783 <ul class="lqt_footer">
784784 <span class="lqt_footer_sig">
785785 <li class="lqt_author_sig lqt_post_color_{$color_number}">$sig</li>
786786 HTML
787787 );
788 -
 788+
789789 if( $thread->editedness() == Threads::EDITED_BY_AUTHOR ||
790790 $thread->editedness() == Threads::EDITED_BY_OTHERS ) {
791791 $editedness_url = $this->permalinkUrlWithQuery($thread, 'action=history');
@@ -792,9 +792,9 @@
793793 $color_number : ($color_number == self::number_of_user_colors ? 1 : $color_number + 1);
794794 $this->output->addHTML("<li class=\"lqt_edited_notice lqt_post_color_{$editedness_color_number}\">".'<a href="'.$editedness_url.'">'.wfMsg('lqt_edited_notice').'</a>'.'</li>');
795795 }
796 -
 796+
797797 $this->output->addHTML("</span><li>$timestamp</li>");
798 -
 798+
799799 $this->output->addHTML('<span class="lqt_footer_commands">' .
800800 $this->listItemsForCommands($this->threadFooterCommands($thread)) .
801801 '</span>');
@@ -808,7 +808,7 @@
809809 $label = $command['label'];
810810 $href = $command['href'];
811811 $enabled = $command['enabled'];
812 -
 812+
813813 if( $enabled ) {
814814 $result[] = "<li><a href=\"$href\">$label</a></li>";
815815 } else {
@@ -817,10 +817,10 @@
818818 }
819819 return join("", $result);
820820 }
821 -
 821+
822822 function selectNewUserColor( $user ) {
823823 $userkey = $user->isAnon() ? "anon:" . $user->getName() : "user:" . $user->getId();
824 -
 824+
825825 if( !array_key_exists( $userkey, $this->user_colors ) ) {
826826 $this->user_colors[$userkey] = $this->user_color_index;
827827 $this->user_color_index += 1;
@@ -836,7 +836,7 @@
837837 $previous_editsection = $popts->getEditSection();
838838 $popts->setEditSection(false);
839839 $this->output->parserOptions($popts);
840 -
 840+
841841 $post = $thread->root();
842842
843843 // This is a bit of a hack to have individual histories work.
@@ -850,24 +850,24 @@
851851 } else {
852852 $oldid = $thread->isHistorical() ? $thread->rootRevision() : null;
853853 }
854 -
 854+
855855 $this->openDiv( $this->postDivClass($thread) );
856 -
 856+
857857 if( $this->methodAppliesToThread( 'edit', $thread ) ) {
858858 $this->showPostEditingForm( $thread );
859859 } else{
860860 $this->showPostBody( $post, $oldid );
861861 $this->showThreadFooter( $thread );
862862 }
863 -
 863+
864864 $this->closeDiv();
865 -
 865+
866866 if( $this->methodAppliesToThread( 'reply', $thread ) ) {
867867 $this->indent($thread);
868868 $this->showReplyForm( $thread );
869869 $this->unindent($thread);
870870 }
871 -
 871+
872872 $popts->setEditSection($previous_editsection);
873873 $this->output->parserOptions($popts);
874874 }
@@ -880,7 +880,7 @@
881881 $lis = $this->listItemsForCommands($this->topLevelThreadCommands($thread));
882882 $commands_html = "<ul class=\"lqt_threadlevel_commands\">$lis</ul>";
883883 }
884 -
 884+
885885 $html = $thread->subjectWithoutIncrement() .
886886 ' <span class="lqt_subject_increment">(' .
887887 $thread->increment() . ')</span>';
@@ -888,11 +888,11 @@
889889 <span class=\"mw-headline\">" . $html . "</span></h{$this->headerLevel}>$commands_html" );
890890 }
891891 }
892 -
 892+
893893 function postDivClass( $thread ) {
894894 return 'lqt_post';
895895 }
896 -
 896+
897897 function anchorName($thread) {
898898 return "lqt_thread_{$thread->id()}";
899899 }
@@ -907,10 +907,10 @@
908908 $tmp->root()->originalAuthor()->getName());
909909 $this->output->addHTML('<span class="lqt_nonindent_message">&larr;'.$msg.'</span>');
910910 }
911 -
912 -
 911+
 912+
913913 $this->showThreadHeading( $thread );
914 -
 914+
915915 $this->output->addHTML( "<a name=\"{$this->anchorName($thread)}\" ></a>" );
916916
917917 if ($thread->type() == Threads::TYPE_MOVED) {
@@ -924,13 +924,13 @@
925925 '<a href="'.$target->getFullURL().'">'.$target->getText().'</a>',
926926 $sig,
927927 $wgLang->timeanddate($thread->modified())
928 - ));
 928+ ));
929929 return;
930930 }
931931
932932 if ( $thread->type() == Threads::TYPE_DELETED ) {
933933 if ( in_array('deletedhistory', $this->user->getRights()) ) {
934 - $this->output->addHTML('<p>'. wfMsg('lqt_thread_deleted_for_sysops',
 934+ $this->output->addHTML('<p>'. wfMsg('lqt_thread_deleted_for_sysops',
935935 '<b>'.wfMsg('lqt_thread_deleted_for_sysops_deleted').'</b>') .'</p>');
936936 }
937937 else {
@@ -951,19 +951,19 @@
952952 }
953953
954954
955 -
 955+
956956 $this->openDiv('lqt_thread', "lqt_thread_id_{$thread->id()}");
957 -
 957+
958958 $this->showRootPost( $thread );
959 -
 959+
960960 if( $thread->hasSubthreads() ) $this->indent($thread);
961961 foreach( $thread->subthreads() as $st ) {
962962 $this->showThread($st);
963963 }
964964 if( $thread->hasSubthreads() ) $this->unindent($thread);
965 -
 965+
966966 $this->closeDiv();
967 -
 967+
968968 }
969969
970970 function indent($thread) {
@@ -993,7 +993,7 @@
994994 function closeDiv() {
995995 $this->output->addHTML( wfCloseElement( 'div' ) );
996996 }
997 -
 997+
998998 function showSummary($t) {
999999 if ( !$t->summary() ) return;
10001000 $label = wfMsg('lqt_summary_label');
@@ -1016,5 +1016,3 @@
10171017 }
10181018
10191019 }
1020 -
1021 -?>
Index: trunk/extensions/LiquidThreads/lqt.sql
@@ -47,6 +47,6 @@
4848 ums_user int unsigned NOT NULL,
4949 ums_thread int(8) unsigned NOT NULL,
5050 ums_read_timestamp varbinary(14),
51 -
 51+
5252 PRIMARY KEY (ums_user, ums_thread)
5353 ) TYPE=InnoDB;

Status & tagging log