r61968 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61967‎ | r61968 | r61969 >
Date:03:19, 4 February 2010
Author:werdna
Status:ok
Tags:
Comment:
Revert r61966 for now, still needs some work on post/reply.
Modified paths:
  • /trunk/extensions/LiquidThreads/LiquidThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtFunctions.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/ParserFunctions.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/LqtFunctions.php
@@ -56,12 +56,6 @@
5757 'lqtpagelimit',
5858 array( 'LqtParserFunctions', 'lqtPageLimit' )
5959 );
60 -
61 - global $wgLiquidThreadsAllowEmbedding;
62 -
63 - if ($wgLiquidThreadsAllowEmbedding) {
64 - $parser->setHook( 'talkpage', array( 'LqtParserFunctions', 'lqtTalkPage' ) );
65 - }
6660
6761 return true;
6862 }
Index: trunk/extensions/LiquidThreads/LiquidThreads.php
@@ -212,6 +212,3 @@
213213
214214 /** Whether or not to allow users to activate/deactivate LiquidThreads per-page */
215215 $wgLiquidThreadsAllowUserControl = true;
216 -
217 -/** Allow embedding */
218 -$wgLiquidThreadsAllowEmbedding = true;
Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -843,50 +843,25 @@
844844 return;
845845 }
846846
847 - global $wgOut;
848 -
849 - $info = self::getScriptsAndStyles();
850 -
851 - foreach( $info['inlineScripts'] as $script ) {
852 - $wgOut->addInlineScript( $script );
853 - }
854 -
855 - foreach( $info['scripts'] as $script ) {
856 - $wgOut->addScriptFile( $script );
857 - }
858 -
859 - foreach( $info['styles'] as $style ) {
860 - $wgOut->addExtensionStyle( $style );
861 - }
 847+ global $wgOut, $wgStylePath;
 848+ global $wgScriptPath, $wgStyleVersion;
 849+ global $wgEnableJS2system;
 850+ global $wgLiquidThreadsExtensionName;
862851
 852+ $wgOut->addInlineScript( 'var wgLqtMessages = ' . self::exportJSLocalisation() . ';' );
 853+
 854+ $basePath = "$wgScriptPath/extensions/$wgLiquidThreadsExtensionName";
 855+
 856+ $wgOut->addScriptFile( "$basePath/jquery/js2.combined.js" );
 857+ $wgOut->addExtensionStyle( "$basePath/jquery/jquery-ui-1.7.2.css" );
 858+
 859+ $wgOut->addScriptFile( "$basePath/jquery/jquery.autogrow.js" );
 860+
 861+ $wgOut->addScriptFile( "$basePath/lqt.js" );
 862+ $wgOut->addExtensionStyle( "$basePath/lqt.css?{$wgStyleVersion}" );
 863+
863864 self::$stylesAndScriptsDone = true;
864865 }
865 -
866 - static function getScriptsAndStyles() {
867 - global $wgLiquidThreadsExtensionName, $wgStylePath, $wgScriptPath, $wgStyleVersion;
868 - $basePath = "$wgScriptPath/extensions/$wgLiquidThreadsExtensionName";
869 -
870 - $inlineScripts = array(
871 - 'var wgLqtMessages = ' . self::exportJSLocalisation() . ';',
872 - );
873 -
874 - $scripts = array(
875 - "$basePath/jquery/js2.combined.js",
876 - "$basePath/jquery/jquery.autogrow.js",
877 - "$basePath/lqt.js",
878 - );
879 -
880 - $styles = array(
881 - "$basePath/jquery/jquery-ui-1.7.2.css",
882 - "$basePath/lqt.css?{$wgStyleVersion}",
883 - );
884 -
885 - return array(
886 - 'inlineScripts' => $inlineScripts,
887 - 'scripts' => $scripts,
888 - 'styles' => $styles,
889 - );
890 - }
891866
892867 static function exportJSLocalisation() {
893868 wfLoadExtensionMessages( 'LiquidThreads' );
Index: trunk/extensions/LiquidThreads/classes/ParserFunctions.php
@@ -20,52 +20,4 @@
2121 $parser->mOutput->setProperty( 'lqt-page-limit', $param );
2222 }
2323 }
24 -
25 - static function lqtTalkPage( $parser, $args, $parser, $frame ) {
26 - global $wgStyleVersion;
27 -
28 - // Grab article.
29 - $title = null;
30 - if ( $args['talkpage'] ) {
31 - $title = Title::newFromText( $args['talkpage'] );
32 - }
33 - if ( is_null($title) ) {
34 - $title = $parser->getTitle();
35 - }
36 -
37 - $article = new Article( $title );
38 - $out = new OutputPage;
39 -
40 - global $wgUser, $wgRequest;
41 - $view = new TalkpageView( $out, $article, $title, $wgUser, $wgRequest );
42 -
43 - // Handle show/hide preferences. Header gone by default.
44 - $view->hideItems( 'header' );
45 -
46 - if ( array_key_exists( 'show', $args ) ) {
47 - $show = explode( ' ', $args['show'] );
48 - $view->setShownItems( $show );
49 - }
50 -
51 - $view->show();
52 -
53 - $scriptsStyles = LqtView::getScriptsAndStyles();
54 - $headItems = '';
55 -
56 - foreach( $scriptsStyles['inlineScripts'] as $iscript ) {
57 - $headItems .= Html::inlineScript( "\n$iscript\n" );
58 - }
59 -
60 - foreach( $scriptsStyles['scripts'] as $script ) {
61 - $headItems .= Html::linkedScript( "$script?$wgStyleVersion" );
62 - }
63 -
64 - foreach( $scriptsStyles['styles'] as $style ) {
65 - $headItems .= Html::linkedStyle( $style, 'all' );
66 - }
67 -
68 - $parser->getOutput()->addHeadItem( $headItems, 'lqt-talk-page' );
69 -
70 - return $out->getHTML();
71 - }
7224 }
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php
@@ -3,8 +3,6 @@
44 if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class TalkpageView extends LqtView {
7 - protected $mShowItems = array( 'toc', 'options', 'header' );
8 -
97 /* Added to SkinTemplateTabs hook in TalkpageView::show(). */
108 static function customizeTalkpageTabs( $skintemplate, &$content_actions, $view ) {
119 // The arguments are passed in by reference.
@@ -243,9 +241,7 @@
244242
245243 }
246244
247 - if ( $this->shouldShow('header') ) {
248 - $this->showHeader();
249 - }
 245+ $this->showHeader();
250246
251247 $html = '';
252248
@@ -270,9 +266,7 @@
271267 $talkpageHeader = Xml::tags( 'div', array( 'class' => 'lqt-talkpage-header' ),
272268 $talkpageHeader );
273269
274 - if ( $this->shouldShow('options') ) {
275 - $this->output->addHTML( $talkpageHeader );
276 - }
 270+ $this->output->addHTML( $talkpageHeader );
277271
278272 global $wgRequest;
279273 if ( $this->methodApplies( 'talkpage_new_thread' ) ) {
@@ -289,9 +283,9 @@
290284
291285 $threads = $this->getPageThreads( $pager );
292286
293 - if ( count( $threads ) > 0 && $this->shouldShow('toc') ) {
 287+ if ( count( $threads ) > 0 ) {
294288 $html .= $this->getTOC( $threads );
295 - } elseif ( count($threads) == 0 ) {
 289+ } else {
296290 $html .= Xml::tags( 'div', array( 'class' => 'lqt-no-threads' ),
297291 wfMsgExt( 'lqt-no-threads', 'parseinline' ) );
298292 }
@@ -359,28 +353,6 @@
360354 // Default
361355 return LQT_NEWEST_CHANGES;
362356 }
363 -
364 - // Hide a number of items from the view
365 - // Valid values: toc, options, header
366 - function hideItems( $items ) {
367 - $this->mShowItems = array_diff( $this->mShowItems, (array)$items );
368 - }
369 -
370 - // Show a number of items in the view
371 - // Valid values: toc, options, header
372 - function showItems( $items ) {
373 - $this->mShowItems = array_merge( $this->mShowItems, (array)$items );
374 - }
375 -
376 - // Whether or not to show an item
377 - function shouldShow( $item ) {
378 - return in_array( $item, $this->mShowItems );
379 - }
380 -
381 - // Set the items shown
382 - function setShownItems( $items ) {
383 - $this->mShowItems = $items;
384 - }
385357 }
386358
387359 class LqtDiscussionPager extends IndexPager {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61966LiquidThreads: Implement simple embedding of LiquidThreads discussion pages i...werdna00:52, 4 February 2010

Status & tagging log