r75624 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75623‎ | r75624 | r75625 >
Date:19:57, 28 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added method that allows SMW extensions to also load resource modules
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/SMW_Settings.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/skins/SMW_sorttable.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php
@@ -34,6 +34,17 @@
3535 protected static $resourceModules = array();
3636
3737 /**
 38+ * Adds a resource module to the parser output.
 39+ *
 40+ * @since 1.5.3
 41+ *
 42+ * @param string $moduleName
 43+ */
 44+ public static function requireResource( $moduleName ) {
 45+ self::$resourceModules[$moduleName] = $moduleName;
 46+ }
 47+
 48+ /**
3849 * Adds rousource loader modules or other head items.
3950 * Falls back on requireHeadItemOld if the Resource Loader (MW >1.17) is not available.
4051 *
@@ -53,13 +64,13 @@
5465
5566 switch ( $id ) {
5667 case SMW_HEADER_TOOLTIP:
57 - self::$resourceModules['smw_tt'] = 'ext.smw.tooltips';
 68+ self::requireResource( 'ext.smw.tooltips' );
5869 break;
5970 case SMW_HEADER_SORTTABLE:
60 - self::$resourceModules['smw_st'] = 'ext.smw.sorttable';
 71+ self::requireResource( 'ext.smw.sorttable' );
6172 break;
6273 case SMW_HEADER_STYLE:
63 - self::$resourceModules['smw_css'] = 'ext.smw.style';
 74+ self::requireResource( 'ext.smw.style' );
6475 break;
6576 }
6677 }
@@ -175,7 +186,7 @@
176187
177188 // Check if the resource loader can be used or not.
178189 if ( method_exists( 'OutputPage', 'addModules' ) ) {
179 - $parserOutput->addModules( self::$resourceModules );
 190+ $parserOutput->addModules( array_values( self::$resourceModules ) );
180191 }
181192
182193 self::$resourceModules = array();
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_sorttable.js
@@ -2,7 +2,6 @@
33 // from http://www.kryogenix.org/code/browser/sorttable/
44 // Modified for SMW (in fact, we might rewrite the code since we
55 // usually have very special tables to sort)
6 -
76 addOnloadHook( smw_sortables_init );
87
98 var SORT_COLUMN_INDEX;
Index: trunk/extensions/SemanticMediaWiki/SMW_Settings.php
@@ -24,7 +24,7 @@
2525 # of your wiki). No final slash.
2626 ##
2727 $smwgScriptPath = (
28 - ( version_compare( $wgVersion, '1.16', '>=' ) && isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath )
 28+ ( /*version_compare( $wgVersion, '1.16', '>=' ) && */isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath )
2929 ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions'
3030 ) . '/SemanticMediaWiki';
3131 ##

Follow-up revisions

RevisionCommit summaryAuthorDate
r75625Follow up to r75624 - removed debug stuffjeroendedauw19:58, 28 October 2010

Status & tagging log