r93192 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93191‎ | r93192 | r93193 >
Date:15:11, 26 July 2011
Author:flohack
Status:deferred (Comments)
Tags:
Comment:
Migrated js loading to ResourceLoader; Changed NULL to null
Modified paths:
  • /trunk/extensions/CollabWatchlist/CollabWatchlist.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/CategoryTreeManip.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/CollabWatchlistChangesList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CollabWatchlist/CollabWatchlist.php
@@ -29,6 +29,16 @@
3030 $wgAutoloadClasses['CategoryTreeManip'] = $wgCollabWatchlistIncludes . 'CategoryTreeManip.php';
3131 $wgAutoloadClasses['CollabWatchlistEditor'] = $wgCollabWatchlistIncludes . 'CollabWatchlistEditor.php';
3232
 33+$wgResourceModules['ext.CollabWatchlist'] = array(
 34+ 'scripts' => array( 'js/CollabWatchlist.js' ),
 35+
 36+ // ResourceLoader needs to know where your files are; specify your
 37+ // subdir relative to "/extensions" (or $wgExtensionAssetsPath)
 38+ 'localBasePath' => dirname( __FILE__ ),
 39+ 'remoteExtPath' => 'CollabWatchlist',
 40+ 'position' => 'top',
 41+);
 42+
3343 $wgSpecialPages['Collabwatchlist'] = 'SpecialCollabWatchlist'; # Let MediaWiki know about your new special page.
3444 $wgSpecialPageGroups['Collabwatchlist'] = 'other';
3545
Index: trunk/extensions/CollabWatchlist/includes/CategoryTreeManip.php
@@ -22,7 +22,7 @@
2323 /**
2424 * Constructor
2525 */
26 - function __construct( $id = NULL, $name = NULL, $root = NULL, $parents = array() ) {
 26+ function __construct( $id = null, $name = null, $root = null, $parents = array() ) {
2727 $this->id = $id;
2828 $this->name = $name;
2929 if ( !is_null( $root ) ) {
Index: trunk/extensions/CollabWatchlist/includes/CollabWatchlistChangesList.php
@@ -106,7 +106,7 @@
107107 */
108108 public static function newFromUser( &$user ) {
109109 $sk = $user->getSkin();
110 - $list = NULL;
 110+ $list = null;
111111 if ( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
112112 return new CollabWatchlistChangesList( $sk, $user );
113113 } else {
@@ -130,7 +130,7 @@
131131 * (non-PHPdoc)
132132 * @see includes/EnhancedChangesList#insertHistLink($s, $rc, $title, $params, $sep)
133133 */
134 - protected function insertHistLink( &$s, &$rc, $title, $params = array(), $sep = NULL ) {
 134+ protected function insertHistLink( &$s, &$rc, $title, $params = array(), $sep = null ) {
135135 // No history
136136 }
137137
@@ -218,7 +218,7 @@
219219 /**
220220 * Build a drop-down box for selecting a collaborative watchlist
221221 * This method optionally adds javascript for changing a tag selector
222 - * depending on the selected review list
 222+ * depending on the selected review list.
223223 *
224224 * @param $glWlIdAndName Mixed: The result from getCollabWatchlistIdAndName()
225225 * @param $selected Mixed: Reviewlist which should be pre-selected
@@ -230,18 +230,9 @@
231231 * @return string
232232 */
233233 public static function collabWatchlistSelector( $glWlIdAndName, $selected = '', $all = null, $element_name = 'collabwatchlist', $label = null, $element_id = 'collabwatchlist', $tagElementIdBase = null ) {
234 - global $wgScriptPath, $wgJsMimeType;
 234+ global $wgOut;
 235+ $wgOut->addModules( 'ext.CollabWatchlist' );
235236 $ret = '';
236 - if ( isset( $tagElementIdBase ) ) {
237 - $jsPath = "$wgScriptPath/extensions/CollabWatchlist/js";
238 - $ret .= Xml::element( 'script',
239 - array(
240 - 'type' => $wgJsMimeType,
241 - 'src' => "$jsPath/CollabWatchlist.js",
242 - ),
243 - '', false
244 - );
245 - }
246237 $options = array();
247238
248239 // Godawful hack... we'll be frequently passed selected namespaces

Comments

#Comment by Reedy (talk | contribs)   15:14, 26 July 2011

You've got mixed tabs/spaces in CollabWatchlist.php

#Comment by Jack Phoenix (talk | contribs)   16:14, 26 July 2011
+	'position' => 'top',

Does this work? From what I understood, the top load queue is a part of ResourceLoader version 2 (see ResourceLoader/Version 2 Design Specification#Top load queue) and hasn't yet been implemented.

#Comment by Reedy (talk | contribs)   16:27, 26 July 2011

I'm pretty sure you're right...

#Comment by Catrope (talk | contribs)   16:57, 26 July 2011

Nope, you're wrong, see r85616.

Status & tagging log