http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76193
Revision: 76193 Author: catrope Date: 2010-11-06 15:13:48 +0000 (Sat, 06 Nov 2010) Log Message: ----------- Fix ResourceLoader support in UploadWizard, which was broken by r76182, possibly earlier. * Fix for r76189: don't check $wgUploadWizardDisableResourceLoader in UploadWizard.php , check it in the hook instead. Otherwise, there's no opportunity to change it * Move jQuery UI files to scripts. Having them in dependencies broke RL because it expects module names there, not file names. Also means UploadWizardDependencyLoader no longer merges dependencies into scripts * Declare messages so RL exports them * Have mw.Language.js check mw.msg() too. This is a dirty hack to accommodate for the fact that we're working with two competing i18n implementations, which should be unified at some point. Modified Paths: -------------- trunk/extensions/UploadWizard/UploadWizard.php trunk/extensions/UploadWizard/UploadWizardDependencyLoader.php trunk/extensions/UploadWizard/UploadWizardHooks.php trunk/extensions/UploadWizard/UploadWizardMessages.php trunk/extensions/UploadWizard/resources/combined.js trunk/extensions/UploadWizard/resources/combined.min.js trunk/extensions/UploadWizard/resources/language/mw.Language.js Modified: trunk/extensions/UploadWizard/UploadWizard.php =================================================================== --- trunk/extensions/UploadWizard/UploadWizard.php 2010-11-06 15:11:26 UTC (rev 76192) +++ trunk/extensions/UploadWizard/UploadWizard.php 2010-11-06 15:13:48 UTC (rev 76193) @@ -58,6 +58,4 @@ $wgUploadWizardDisableResourceLoader = true; // for ResourceLoader -if ( !$wgUploadWizardDisableResourceLoader && class_exists( 'ResourceLoader' ) ) { - $wgHooks['ResourceLoaderRegisterModules'][] = 'UploadWizardHooks::resourceLoaderRegisterModules'; -} +$wgHooks['ResourceLoaderRegisterModules'][] = 'UploadWizardHooks::resourceLoaderRegisterModules'; Modified: trunk/extensions/UploadWizard/UploadWizardDependencyLoader.php =================================================================== --- trunk/extensions/UploadWizard/UploadWizardDependencyLoader.php 2010-11-06 15:11:26 UTC (rev 76192) +++ trunk/extensions/UploadWizard/UploadWizardDependencyLoader.php 2010-11-06 15:13:48 UTC (rev 76193) @@ -36,7 +36,7 @@ public function __construct( $langCode = null ) { $module = UploadWizardHooks::$modules['ext.uploadWizard']; - $this->scripts = array_merge( $module['dependencies'], $module['scripts'] ); + $this->scripts = $module['scripts']; $this->inlineScripts = array(); if ( $langCode !== null ) { Modified: trunk/extensions/UploadWizard/UploadWizardHooks.php =================================================================== --- trunk/extensions/UploadWizard/UploadWizardHooks.php 2010-11-06 15:11:26 UTC (rev 76192) +++ trunk/extensions/UploadWizard/UploadWizardHooks.php 2010-11-06 15:13:48 UTC (rev 76193) @@ -14,6 +14,11 @@ public static $modules = array( 'ext.uploadWizard' => array( 'scripts' => array( + // jquery ui + // FIXME: These can be replaced with dependencies when pre-RL compat is dropped + 'resources/jquery.ui/ui/ui.core.js', + 'resources/jquery.ui/ui/ui.datepicker.js', + 'resources/jquery.ui/ui/ui.progressbar.js', // jquery interface helpers 'resources/jquery/jquery.tipsy.js', @@ -116,14 +121,140 @@ 'resources/jquery.ui/themes/redmond/jquery-ui-1.7.1.custom.css' ), 'messages' => array( - // see UploadWizard.i18n.php + 'linktest', + 'pluraltest', + 'magictest', + 'namespacedtest', + 'extremelycomplextest', + 'internallinktest', + 'uploadwizard', + 'uploadwizard-desc', + 'mwe-upwiz-js-off', + 'mwe-loading-upwiz', + 'mwe-upwiz-code-unknown', + 'mwe-upwiz-step-tutorial', + 'mwe-upwiz-step-file', + 'mwe-upwiz-step-deeds', + 'mwe-upwiz-step-details', + 'mwe-upwiz-step-thanks', + 'mwe-upwiz-api-error-code', + 'mwe-upwiz-tutorial-error', + 'mwe-upwiz-intro', + 'mwe-upwiz-add-file-n', + 'mwe-upwiz-add-file-0', + 'mwe-upwiz-browse', + 'mwe-upwiz-transported', + 'mwe-upwiz-click-here', + 'mwe-upwiz-uploading', + 'mwe-upwiz-editing', + 'mwe-upwiz-remove-upload', + 'mwe-upwiz-remove-description', + 'mwe-upwiz-upload', + 'mwe-upwiz-upload-count', + 'mwe-upwiz-progressbar-uploading', + 'mwe-upwiz-finished', + 'mwe-upwiz-secs-remaining', + 'mwe-upwiz-mins-secs-remaining', + 'mwe-upwiz-hrs-mins-secs-remaining', + 'mwe-upwiz-deeds-intro', + 'mwe-upwiz-deeds-macro-prompt', + 'mwe-upwiz-deeds-custom-prompt', + 'mwe-upwiz-details-intro', + 'mwe-upwiz-source-ownwork', + 'mwe-upwiz-source-ownwork-assert', + 'mwe-upwiz-source-ownwork-assert-custom', + 'mwe-upwiz-source-ownwork-assert-note', + 'mwe-upwiz-source-permission', + 'mwe-upwiz-source-thirdparty', + 'mwe-upwiz-source-thirdparty-intro', + 'mwe-upwiz-source-thirdparty-custom-multiple-intro', + 'mwe-upwiz-source-thirdparty-license', + 'mwe-upwiz-source-thirdparty-accept', + 'mwe-upwiz-source-custom', + 'mwe-upwiz-more-options', + 'mwe-upwiz-fewer-options', + 'mwe-upwiz-desc', + 'mwe-upwiz-desc-add-n', + 'mwe-upwiz-desc-add-0', + 'mwe-upwiz-title', + 'mwe-upwiz-categories-intro', + 'mwe-upwiz-categories-another', + 'mwe-upwiz-previously-uploaded', + 'mwe-upwiz-about-this-work', + 'mwe-upwiz-media-type', + 'mwe-upwiz-date-created', + 'mwe-upwiz-location', + 'mwe-upwiz-copyright-info', + 'mwe-upwiz-author', + 'mwe-upwiz-license', + 'mwe-upwiz-about-format', + 'mwe-upwiz-autoconverted', + 'mwe-upwiz-filename-tag', + 'mwe-upwiz-other', + 'mwe-upwiz-other-prefill', + 'mwe-upwiz-showall', + 'mwe-upwiz-source', + 'mwe-upwiz-macro-edit-intro', + 'mwe-upwiz-macro-edit', + 'mwe-upwiz-thanks-intro', + 'mwe-upwiz-thanks-explain', + 'mwe-upwiz-thanks-link', + 'mwe-upwiz-thanks-wikitext', + 'mwe-upwiz-thanks-url', + 'mwe-upwiz-upload-error-bad-filename-extension', + 'mwe-upwiz-upload-error-duplicate', + 'mwe-upwiz-upload-error-stashed-anyway', + 'mwe-upwiz-ok', + 'mwe-upwiz-cancel', + 'mwe-upwiz-change', + 'mwe-upwiz-fileexists-replace', + 'mwe-upwiz-fileexists', + 'mwe-upwiz-thumbnail-more', + 'mwe-upwiz-overwrite', + 'mwe-copyright-macro', + 'mwe-copyright-custom', + 'mwe-upwiz-next', + 'mwe-upwiz-next-file', + 'mwe-upwiz-next-deeds', + 'mwe-upwiz-next-details', + 'mwe-upwiz-home', + 'mwe-upwiz-upload-another', + 'mwe-prevent-close', + 'mwe-upwiz-files-complete', + 'mwe-upwiz-tooltip-author', + 'mwe-upwiz-tooltip-source', + 'mwe-upwiz-tooltip-sign', + 'mwe-upwiz-tooltip-title', + 'mwe-upwiz-tooltip-description', + 'mwe-upwiz-tooltip-other', + 'mwe-upwiz-tooltip-more-info', + 'mwe-upwiz-file-need-file', + 'mwe-upwiz-file-need-start', + 'mwe-upwiz-file-need-complete', + 'mwe-upwiz-deeds-need-deed', + 'mwe-upwiz-deeds-need-license', + 'mwe-upwiz-license-incompatible-pd', + 'mwe-upwiz-license-incompatible-cc', + 'mwe-upwiz-license-show-all', + 'mwe-upwiz-license-show-recommended', + 'mwe-upwiz-error-signature-blank', + 'mwe-upwiz-error-signature-too-long', + 'mwe-upwiz-error-signature-too-short', + 'mwe-upwiz-error-signature-bad-chars', + 'mwe-upwiz-error-blank', + 'mwe-upwiz-error-too-long', + 'mwe-upwiz-error-too-short', + 'mwe-upwiz-error-bad-chars', + 'mwe-upwiz-error-date', + 'mwe-upwiz-license-cc-by-sa-3.0', + 'mwe-upwiz-license-cc-by-3.0', + 'mwe-upwiz-license-cc-zero', + 'mwe-upwiz-license-gfdl', + 'mwe-upwiz-license-pd-us', + 'mwe-upwiz-categories', + 'mwe-upwiz-categories-add', + 'mwe-upwiz-category-remove', ), - // in ResourceLoader, these will probably have names rather than explicit script paths, or be automatically loaded - 'dependencies' => array( - 'resources/jquery.ui/ui/ui.core.js', - 'resources/jquery.ui/ui/ui.datepicker.js', - 'resources/jquery.ui/ui/ui.progressbar.js' - ), 'group' => 'ext.uploadWizard' ), 'ext.uploadWizard.tests' => array( @@ -139,7 +270,11 @@ * Adds modules to ResourceLoader */ public static function resourceLoaderRegisterModules( &$resourceLoader ) { - global $wgExtensionAssetsPath; + global $wgExtensionAssetsPath, $wgUploadWizardDisableResourceLoader; + if ( $wgUploadWizardDisableResourceLoader ) { + return true; + } + $localpath = dirname( __FILE__ ); $remotepath = "$wgExtensionAssetsPath/UploadWizard"; foreach ( self::$modules as $name => $resources ) { Modified: trunk/extensions/UploadWizard/UploadWizardMessages.php =================================================================== --- trunk/extensions/UploadWizard/UploadWizardMessages.php 2010-11-06 15:11:26 UTC (rev 76192) +++ trunk/extensions/UploadWizard/UploadWizardMessages.php 2010-11-06 15:13:48 UTC (rev 76193) @@ -19,8 +19,6 @@ * @param String $langCode Name of scriptText module ( that hosts messages ) * @return string */ - - public static function getMessagesJs( $moduleName, $language ) { global $wgOut; Modified: trunk/extensions/UploadWizard/resources/combined.js =================================================================== --- trunk/extensions/UploadWizard/resources/combined.js 2010-11-06 15:11:26 UTC (rev 76192) +++ trunk/extensions/UploadWizard/resources/combined.js 2010-11-06 15:13:48 UTC (rev 76193) @@ -5531,7 +5531,7 @@ /** * mw.addMessages function - * Loads a set of json messages into the messegeCache object. + * Loads a set of json messages into the messageCache object. * * @param {JSON} msgSet The set of msgs to be loaded */ @@ -5558,8 +5558,14 @@ mw.getMsg = function( messageKey , args ) { // Check for missing message key - if ( ! messageCache[ messageKey ] ){ - return '[' + messageKey + ']'; + if ( ! messageCache[ messageKey ] ) { + // Try the ResourceLoader's message store + // FIXME: The two message stores should be unified in the future + var rlMsg = mediaWiki.msg( messageKey ); + if ( rlMsg == ( '<' + messageKey + '>' ) ) { + return '[' + messageKey + ']'; + } + messageCache[ messageKey ] = rlMsg; } // Check if we need to do args replacements: if( typeof args != 'undefined' ) { Modified: trunk/extensions/UploadWizard/resources/combined.min.js =================================================================== --- trunk/extensions/UploadWizard/resources/combined.min.js 2010-11-06 15:11:26 UTC (rev 76192) +++ trunk/extensions/UploadWizard/resources/combined.min.js 2010-11-06 15:13:48 UTC (rev 76193) @@ -5559,8 +5559,14 @@ if(!messageCache[messageKey]){ + + +var rlMsg=mediaWiki.msg(messageKey); +if(rlMsg==('<'+messageKey+'>')){ return'['+messageKey+']'; } +messageCache[messageKey]=rlMsg; +} if(typeof args!='undefined'){ Modified: trunk/extensions/UploadWizard/resources/language/mw.Language.js =================================================================== --- trunk/extensions/UploadWizard/resources/language/mw.Language.js 2010-11-06 15:11:26 UTC (rev 76192) +++ trunk/extensions/UploadWizard/resources/language/mw.Language.js 2010-11-06 15:13:48 UTC (rev 76193) @@ -25,7 +25,7 @@ /** * mw.addMessages function - * Loads a set of json messages into the messegeCache object. + * Loads a set of json messages into the messageCache object. * * @param {JSON} msgSet The set of msgs to be loaded */ @@ -52,8 +52,14 @@ mw.getMsg = function( messageKey , args ) { // Check for missing message key - if ( ! messageCache[ messageKey ] ){ - return '[' + messageKey + ']'; + if ( ! messageCache[ messageKey ] ) { + // Try the ResourceLoader's message store + // FIXME: The two message stores should be unified in the future + var rlMsg = mediaWiki.msg( messageKey ); + if ( rlMsg == ( '<' + messageKey + '>' ) ) { + return '[' + messageKey + ']'; + } + messageCache[ messageKey ] = rlMsg; } // Check if we need to do args replacements: if( typeof args != 'undefined' ) { _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs