r15877 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r15876‎ | r15877 | r15878 >
Date:11:39, 29 July 2006
Author:david
Status:old
Tags:
Comment:
folding basically works; not yet pretty
Modified paths:
  • /branches/liquidthreads/extensions/ThreadView.php (modified) (history)
  • /branches/liquidthreads/skins/monobook/main.css (modified) (history)

Diff [purge]

Index: branches/liquidthreads/skins/monobook/main.css
@@ -26,6 +26,10 @@
2727 margin-bottom: .1em;
2828 }*/
2929
 30+.lqt_thread {
 31+ display: none;
 32+}
 33+
3034 .lqt_archive_browser {
3135 margin-top: 1em;
3236 margin-bottom: 1em;
Index: branches/liquidthreads/extensions/ThreadView.php
@@ -6,6 +6,7 @@
77 protected static $callbackpost;
88 protected static $callbackeditpage;
99
 10+ protected static $stuffDoneOnceDone;
1011
1112 /**
1213 * @param $thread Thread object we're looking at.
@@ -33,23 +34,52 @@
3435 $this->showNext = false;
3536 }
3637
 38+ function doStuffOnce() {
 39+ global $wgOut, $wgJsMimeType, $wgStylePath;
 40+
 41+ if (ThreadView::$stuffDoneOnceDone) return;
 42+ ThreadView::$stuffDoneOnceDone = true;
 43+
 44+ $s = "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/lqt.js\"><!-- lqt js --></script>\n";
 45+ $wgOut->addScript($s);
 46+
 47+ $h = $wgOut->getOnloadHandler();
 48+ if ( $h != '' ) {
 49+ $h .= '; ';
 50+ }
 51+ $h .= 'lqt_on_load();';
 52+ $wgOut->setOnloadHandler($h);
 53+ }
 54+
3755 function render() {
3856 global $wgOut;
3957
 58+ $this->doStuffOnce();
 59+
4060 // Instruct Parser not to include section edit links.
4161 $wgOut->mParserOptions->setEditSection(false);
4262
 63+ $thread_id_attrib = 'lqt_thread_' . $this->mThread->getID();
 64+
 65+ $wgOut->addHTML("\n\n\n");
 66+
4367 // Subject header:
4468 if ( $this->mIsTopLevel ) {
4569 if ( $this->mThread->mSubject )
46 - $wgOut->addWikiText( '=='.$this->mThread->mSubject.'==' );
 70+ $wgOut->addHTML( wfElement('h2', array('class'=>'lqt_thread_subject_header',
 71+ 'onclick'=>"lqt_hide_show('$thread_id_attrib')"),
 72+ $this->mThread->mSubject) );
4773 else
4874 $wgOut->addWikiText( '----' );
4975 }
5076
 77+ $wgOut->addHTML('<div class="lqt_thread" id="'.$thread_id_attrib.'">');
5178 if( $this->mFirstPost ) {
5279 $this->renderStartingFrom( $this->mFirstPost );
5380 }
 81+ $wgOut->addHTML('</div>');
 82+
 83+ $wgOut->addHTML("\n\n\n");
5484 }
5585
5686