r77772 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77771‎ | r77772 | r77773 >
Date:05:43, 5 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added some preliminary RL support
Modified paths:
  • /trunk/extensions/SemanticResultFormats/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SemanticResultFormats/SemanticResultFormats.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/SemanticResultFormats.php
@@ -121,6 +121,10 @@
122122 foreach ( $srfgFormats as $format ) {
123123 if ( array_key_exists( $format, $formatClasses ) ) {
124124 $smwgResultFormats[$format] = $formatClasses[$format];
 125+
 126+ if ( method_exists( $formatClasses[$format], 'registerResourceModules' ) ) {
 127+ call_user_func( array( $formatClasses[$format], 'registerResourceModules' ) );
 128+ }
125129 }
126130 else {
127131 wfDebug( "There is not result format class associated with the format '$format'." );
Index: trunk/extensions/SemanticResultFormats/RELEASE-NOTES
@@ -1,6 +1,11 @@
22 For a documentation of all features, see
33 http://semantic-mediawiki.org/wiki/Semantic_Result_Formats
44
 5+
 6+== SRF 1.5.2 ==
 7+
 8+
 9+
510 == SRF 1.5.1 ==
611
712 Released on August 26 2010.
Index: trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php
@@ -57,12 +57,30 @@
5858 }
5959
6060 protected function getResultText( $res, $outputmode ) {
61 - global $smwgIQRunningNumber, $wgScriptPath;
 61+ global $smwgIQRunningNumber, $srfgScriptPath;
6262
6363 SMWOutputs::requireHeadItem( SMW_HEADER_STYLE );
64 - SMWOutputs::requireHeadItem( 'smw_tlhelper', '<script type="text/javascript" src="' . $wgScriptPath . '/extensions/SemanticResultFormats/Timeline/SRF_timeline.js"></script>' );
65 - SMWOutputs::requireHeadItem( 'smw_tl', '<script type="text/javascript" src="' . $wgScriptPath . '/extensions/SemanticResultFormats/Timeline/SimileTimeline/timeline-api.js"></script>' );
 64+
 65+ // MediaWiki 1.17 introduces the Resource Loader.
 66+ if ( method_exists( 'OutputPage', 'addModules' ) && method_exists( 'SMWOutputs', 'requireResource' ) ) {
 67+ SMWOutputs::requireResource( 'ext.srf.timeline' );
 68+ SMWOutputs::requireResource( 'ext.srf.timeline.api' );
 69+ }
 70+ else {
 71+ SMWOutputs::requireHeadItem(
 72+ 'smw_tlhelper',
 73+ '<script type="text/javascript" src="' . $srfgScriptPath .
 74+ '/Timeline/SRF_timeline.js"></script>'
 75+ );
 76+ SMWOutputs::requireHeadItem(
 77+ 'smw_tl',
 78+ '<script type="text/javascript" src="' . $srfgScriptPath .
 79+ '/Timeline/SimileTimeline/timeline-api.js"></script>'
 80+ );
 81+ }
 82+
6683
 84+
6785 $eventline = ( 'eventline' == $this->mFormat );
6886
6987 if ( !$eventline && ( $this->m_tlstart == '' ) ) { // seek defaults
@@ -256,4 +274,22 @@
257275 return $params;
258276 }
259277
 278+ public function registerResourceModules() {
 279+ global $wgResourceModules, $srfgScriptPath;
 280+
 281+ $moduleTemplate = array(
 282+ 'localBasePath' => dirname( __FILE__ ),
 283+ 'remoteBasePath' => $srfgScriptPath . '/Timeline',
 284+ 'group' => 'ext.srf'
 285+ );
 286+
 287+ $wgResourceModules['ext.srf.timeline'] = $moduleTemplate + array(
 288+ 'styles' => 'SRF_timeline.js'
 289+ );
 290+
 291+ $wgResourceModules['ext.srf.timeline.api'] = $moduleTemplate + array(
 292+ 'styles' => 'SimileTimeline/timeline-api.js'
 293+ );
 294+ }
 295+
260296 }

Status & tagging log