r74980 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74979‎ | r74980 | r74981 >
Date:23:42, 18 October 2010
Author:tparscal
Status:ok (Comments)
Tags:
Comment:
Basic ResourceLoader conversion. Messages seem broken.
Modified paths:
  • /branches/uploadwizard/extensions/UploadWizard/SpecialUploadWizard.php (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/UploadWizard.php (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/UploadWizardHooks.php (added) (history)
  • /branches/uploadwizard/extensions/UploadWizard/UploadWizardPage.js (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/resources/mw.UploadWizardDeed.js (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js (modified) (history)

Diff [purge]

Index: branches/uploadwizard/extensions/UploadWizard/UploadWizardHooks.php
@@ -0,0 +1,247 @@
 2+<?php
 3+
 4+class UploadWizardHooks {
 5+
 6+ /* Protected Static Members */
 7+
 8+ protected static $modules = array(
 9+ 'ext.uploadWizard' => array(
 10+ 'scripts' => array(
 11+ 'extensions/UploadWizard/resources/jquery/jquery.tipsy.js',
 12+ 'extensions/UploadWizard/resources/jquery/jquery.tipsyPlus.js',
 13+ 'extensions/UploadWizard/resources/jquery/jquery.morphCrossfade.js',
 14+ 'extensions/UploadWizard/resources/jquery/jquery.validate.js',
 15+ 'extensions/UploadWizard/resources/jquery/jquery.arrowSteps.js',
 16+ 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.js',
 17+ 'extensions/UploadWizard/resources/jquery/jquery.autocomplete.js',
 18+ 'extensions/UploadWizard/resources/jquery/jquery.spinner.js',
 19+ 'extensions/UploadWizard/resources/mw.js',
 20+ 'extensions/UploadWizard/resources/mw.Log.js',
 21+ 'extensions/UploadWizard/resources/mw.Utilities.js',
 22+ 'extensions/UploadWizard/resources/mw.UtilitiesTime.js',
 23+ 'extensions/UploadWizard/resources/mw.Uri.js',
 24+ 'extensions/UploadWizard/resources/mw.Api.js',
 25+ 'extensions/UploadWizard/resources/mw.Api.edit.js',
 26+ 'extensions/UploadWizard/resources/language/mw.Language.js',
 27+ 'extensions/UploadWizard/resources/language/mw.Parser.js',
 28+ 'extensions/UploadWizard/resources/mw.LanguageUpWiz.js',
 29+ 'extensions/UploadWizard/resources/mw.IframeTransport.js',
 30+ 'extensions/UploadWizard/resources/mw.ApiUploadHandler.js',
 31+ 'extensions/UploadWizard/resources/mw.DestinationChecker.js',
 32+ 'extensions/UploadWizard/resources/mw.GroupProgressBar.js',
 33+ 'extensions/UploadWizard/resources/mw.Title.js',
 34+ 'extensions/UploadWizard/resources/mw.UploadWizard.js',
 35+ 'extensions/UploadWizard/resources/mw.UploadWizardDeed.js',
 36+ 'extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js',
 37+ 'extensions/UploadWizard/resources/mw.UploadWizardUtil.js',
 38+ 'extensions/UploadWizard/UploadWizardPage.js',
 39+ ),
 40+ 'languageScripts' => array(
 41+ 'am' => 'extensions/UploadWizard/resources/languages/classes/LanguageAm.js',
 42+ 'ar' => 'extensions/UploadWizard/resources/languages/classes/LanguageAr.js',
 43+ 'bat-smg' => 'extensions/UploadWizard/resources/languages/classes/LanguageBat_smg.js',
 44+ 'be' => 'extensions/UploadWizard/resources/languages/classes/LanguageBe.js',
 45+ 'be-tarask' => 'extensions/UploadWizard/resources/languages/classes/LanguageBe_tarask.js',
 46+ 'bh' => 'extensions/UploadWizard/resources/languages/classes/LanguageBh.js',
 47+ 'bs' => 'extensions/UploadWizard/resources/languages/classes/LanguageBs.js',
 48+ 'cs' => 'extensions/UploadWizard/resources/languages/classes/LanguageCs.js',
 49+ 'cu' => 'extensions/UploadWizard/resources/languages/classes/LanguageCu.js',
 50+ 'cy' => 'extensions/UploadWizard/resources/languages/classes/LanguageCy.js',
 51+ 'dsb' => 'extensions/UploadWizard/resources/languages/classes/LanguageDsb.js',
 52+ 'fr' => 'extensions/UploadWizard/resources/languages/classes/LanguageFr.js',
 53+ 'ga' => 'extensions/UploadWizard/resources/languages/classes/LanguageGa.js',
 54+ 'gd' => 'extensions/UploadWizard/resources/languages/classes/LanguageGd.js',
 55+ 'gv' => 'extensions/UploadWizard/resources/languages/classes/LanguageGv.js',
 56+ 'he' => 'extensions/UploadWizard/resources/languages/classes/LanguageHe.js',
 57+ 'hi' => 'extensions/UploadWizard/resources/languages/classes/LanguageHi.js',
 58+ 'hr' => 'extensions/UploadWizard/resources/languages/classes/LanguageHr.js',
 59+ 'hsb' => 'extensions/UploadWizard/resources/languages/classes/LanguageHsb.js',
 60+ 'hy' => 'extensions/UploadWizard/resources/languages/classes/LanguageHy.js',
 61+ 'ksh' => 'extensions/UploadWizard/resources/languages/classes/LanguageKsh.js',
 62+ 'ln' => 'extensions/UploadWizard/resources/languages/classes/LanguageLn.js',
 63+ 'lt' => 'extensions/UploadWizard/resources/languages/classes/LanguageLt.js',
 64+ 'lv' => 'extensions/UploadWizard/resources/languages/classes/LanguageLv.js',
 65+ 'mg' => 'extensions/UploadWizard/resources/languages/classes/LanguageMg.js',
 66+ 'mk' => 'extensions/UploadWizard/resources/languages/classes/LanguageMk.js',
 67+ 'mo' => 'extensions/UploadWizard/resources/languages/classes/LanguageMo.js',
 68+ 'mt' => 'extensions/UploadWizard/resources/languages/classes/LanguageMt.js',
 69+ 'nso' => 'extensions/UploadWizard/resources/languages/classes/LanguageNso.js',
 70+ 'pl' => 'extensions/UploadWizard/resources/languages/classes/LanguagePl.js',
 71+ 'pt-br' => 'extensions/UploadWizard/resources/languages/classes/LanguagePt_br.js',
 72+ 'ro' => 'extensions/UploadWizard/resources/languages/classes/LanguageRo.js',
 73+ 'ru' => 'extensions/UploadWizard/resources/languages/classes/LanguageRu.js',
 74+ 'se' => 'extensions/UploadWizard/resources/languages/classes/LanguageSe.js',
 75+ 'sh' => 'extensions/UploadWizard/resources/languages/classes/LanguageSh.js',
 76+ 'sk' => 'extensions/UploadWizard/resources/languages/classes/LanguageSk.js',
 77+ 'sl' => 'extensions/UploadWizard/resources/languages/classes/LanguageSl.js',
 78+ 'sma' => 'extensions/UploadWizard/resources/languages/classes/LanguageSma.js',
 79+ 'sr' => 'extensions/UploadWizard/resources/languages/classes/LanguageSr.js',
 80+ 'sr-ec' => 'extensions/UploadWizard/resources/languages/classes/LanguageSr_ec.js',
 81+ 'sr-el' => 'extensions/UploadWizard/resources/languages/classes/LanguageSr_el.js',
 82+ 'ti' => 'extensions/UploadWizard/resources/languages/classes/LanguageTi.js',
 83+ 'tl' => 'extensions/UploadWizard/resources/languages/classes/LanguageTl.js',
 84+ 'uk' => 'extensions/UploadWizard/resources/languages/classes/LanguageUk.js',
 85+ 'wa' => 'extensions/UploadWizard/resources/languages/classes/LanguageWa.js',
 86+ ),
 87+ 'styles' => array(
 88+ 'extensions/UploadWizard/resources/jquery/jquery.tipsy.css',
 89+ 'extensions/UploadWizard/resources/uploadWizard.css',
 90+ 'extensions/UploadWizard/resources/jquery/jquery.arrowSteps.css',
 91+ 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.css',
 92+ ),
 93+ 'messages' => array(
 94+ 'linktest',
 95+ 'pluraltest',
 96+ 'magictest',
 97+ 'namespacedtest',
 98+ 'extremelycomplextest',
 99+ 'internallinktest',
 100+ 'uploadwizard',
 101+ 'uploadwizard-desc',
 102+ 'mwe-loading-upwiz',
 103+ 'mwe-upwiz-code-unknown',
 104+ 'mwe-upwiz-step-file',
 105+ 'mwe-upwiz-step-deeds',
 106+ 'mwe-upwiz-step-details',
 107+ 'mwe-upwiz-step-thanks',
 108+ 'mwe-upwiz-intro',
 109+ 'mwe-upwiz-add-file-n',
 110+ 'mwe-upwiz-add-file-0',
 111+ 'mwe-upwiz-browse',
 112+ 'mwe-upwiz-transported',
 113+ 'mwe-upwiz-click-here',
 114+ 'mwe-upwiz-uploading',
 115+ 'mwe-upwiz-editing',
 116+ 'mwe-upwiz-remove-upload',
 117+ 'mwe-upwiz-remove-description',
 118+ 'mwe-upwiz-upload',
 119+ 'mwe-upwiz-upload-count',
 120+ 'mwe-upwiz-progressbar-uploading',
 121+ 'mwe-upwiz-finished',
 122+ 'mwe-upwiz-secs-remaining',
 123+ 'mwe-upwiz-mins-secs-remaining',
 124+ 'mwe-upwiz-hrs-mins-secs-remaining',
 125+ 'mwe-upwiz-deeds-intro',
 126+ 'mwe-upwiz-deeds-macro-prompt',
 127+ 'mwe-upwiz-deeds-custom-prompt',
 128+ 'mwe-upwiz-details-intro',
 129+ 'mwe-upwiz-source-ownwork',
 130+ 'mwe-upwiz-source-ownwork-assert',
 131+ 'mwe-upwiz-source-ownwork-assert-custom',
 132+ 'mwe-upwiz-source-ownwork-assert-note',
 133+ 'mwe-upwiz-source-permission',
 134+ 'mwe-upwiz-source-thirdparty',
 135+ 'mwe-upwiz-source-thirdparty-intro',
 136+ 'mwe-upwiz-source-thirdparty-custom-multiple-intro',
 137+ 'mwe-upwiz-source-thirdparty-license',
 138+ 'mwe-upwiz-source-thirdparty-accept',
 139+ 'mwe-upwiz-source-custom',
 140+ 'mwe-upwiz-more-options',
 141+ 'mwe-upwiz-fewer-options',
 142+ 'mwe-upwiz-desc',
 143+ 'mwe-upwiz-desc-add-n',
 144+ 'mwe-upwiz-desc-add-0',
 145+ 'mwe-upwiz-title',
 146+ 'mwe-upwiz-categories-intro',
 147+ 'mwe-upwiz-categories-another',
 148+ 'mwe-upwiz-previously-uploaded',
 149+ 'mwe-upwiz-about-this-work',
 150+ 'mwe-upwiz-media-type',
 151+ 'mwe-upwiz-date-created',
 152+ 'mwe-upwiz-location',
 153+ 'mwe-upwiz-copyright-info',
 154+ 'mwe-upwiz-author',
 155+ 'mwe-upwiz-license',
 156+ 'mwe-upwiz-about-format',
 157+ 'mwe-upwiz-autoconverted',
 158+ 'mwe-upwiz-filename-tag',
 159+ 'mwe-upwiz-other',
 160+ 'mwe-upwiz-other-prefill',
 161+ 'mwe-upwiz-showall',
 162+ 'mwe-upwiz-source',
 163+ 'mwe-upwiz-macro-edit-intro',
 164+ 'mwe-upwiz-macro-edit',
 165+ 'mwe-upwiz-thanks-intro',
 166+ 'mwe-upwiz-thanks-explain',
 167+ 'mwe-upwiz-thanks-link',
 168+ 'mwe-upwiz-thanks-wikitext',
 169+ 'mwe-upwiz-thanks-url',
 170+ 'mwe-upwiz-upload-error-bad-filename-extension',
 171+ 'mwe-upwiz-upload-error-duplicate',
 172+ 'mwe-upwiz-upload-error-stashed-anyway',
 173+ 'mwe-upwiz-ok',
 174+ 'mwe-upwiz-cancel',
 175+ 'mwe-upwiz-change',
 176+ 'mwe-upwiz-fileexists-replace',
 177+ 'mwe-upwiz-fileexists',
 178+ 'mwe-upwiz-thumbnail-more',
 179+ 'mwe-upwiz-overwrite',
 180+ 'mwe-copyright-macro',
 181+ 'mwe-copyright-custom',
 182+ 'mwe-upwiz-next',
 183+ 'mwe-upwiz-next-file',
 184+ 'mwe-upwiz-next-deeds',
 185+ 'mwe-upwiz-next-details',
 186+ 'mwe-upwiz-home',
 187+ 'mwe-upwiz-upload-another',
 188+ 'mwe-prevent-close',
 189+ 'mwe-upwiz-files-complete',
 190+ 'mwe-upwiz-tooltip-author',
 191+ 'mwe-upwiz-tooltip-source',
 192+ 'mwe-upwiz-tooltip-sign',
 193+ 'mwe-upwiz-tooltip-title',
 194+ 'mwe-upwiz-tooltip-description',
 195+ 'mwe-upwiz-tooltip-other',
 196+ 'mwe-upwiz-tooltip-more-info',
 197+ 'mwe-upwiz-file-need-file',
 198+ 'mwe-upwiz-file-need-start',
 199+ 'mwe-upwiz-file-need-complete',
 200+ 'mwe-upwiz-deeds-need-deed',
 201+ 'mwe-upwiz-deeds-need-license',
 202+ 'mwe-upwiz-license-incompatible-pd',
 203+ 'mwe-upwiz-license-incompatible-cc',
 204+ 'mwe-upwiz-license-show-all',
 205+ 'mwe-upwiz-license-show-recommended',
 206+ 'mwe-upwiz-error-signature-blank',
 207+ 'mwe-upwiz-error-signature-too-long',
 208+ 'mwe-upwiz-error-signature-too-short',
 209+ 'mwe-upwiz-error-signature-bad-chars',
 210+ 'mwe-upwiz-error-blank',
 211+ 'mwe-upwiz-error-too-long',
 212+ 'mwe-upwiz-error-too-short',
 213+ 'mwe-upwiz-error-bad-chars',
 214+ 'mwe-upwiz-error-date',
 215+ 'mwe-upwiz-license-cc-by-sa-3.0',
 216+ 'mwe-upwiz-license-cc-by-3.0',
 217+ 'mwe-upwiz-license-cc-zero',
 218+ 'mwe-upwiz-license-gfdl',
 219+ 'mwe-upwiz-license-pd-us',
 220+ 'mwe-upwiz-categories',
 221+ 'mwe-upwiz-categories-add',
 222+ 'mwe-upwiz-category-remove',
 223+ ),
 224+ 'dependencies' => array(
 225+ 'jquery.ui.datepicker',
 226+ 'jquery.ui.progressbar',
 227+ ),
 228+ 'group' => 'ext.uploadWizard',
 229+ ),
 230+ 'ext.uploadWizard.tests' => array(
 231+ 'scripts' => array(
 232+ 'extensions/UploadWizard/resources/mw.MockUploadHandler.js',
 233+ ),
 234+ ),
 235+ );
 236+
 237+ /*
 238+ * ResourceLoaderRegisterModules hook
 239+ *
 240+ * Adds modules to ResourceLoader
 241+ */
 242+ public static function resourceLoaderRegisterModules( &$resourceLoader ) {
 243+ foreach ( self::$modules as $name => $resources ) {
 244+ $resourceLoader->register( $name, new ResourceLoaderFileModule( $resources ) );
 245+ }
 246+ return true;
 247+ }
 248+}
Property changes on: branches/uploadwizard/extensions/UploadWizard/UploadWizardHooks.php
___________________________________________________________________
Added: svn:eol-style
1249 + native
Index: branches/uploadwizard/extensions/UploadWizard/resources/mw.UploadWizardDeed.js
@@ -1,6 +1,8 @@
22 /**
33 * Sort of an abstract class for deeds
44 */
 5+( function( $j ) {
 6+
57 mw.UploadWizardDeed = function() {
68 var _this = this;
79 // prevent from instantiating directly?
@@ -456,5 +458,4 @@
457459
458460 };
459461
460 -
461 -
 462+} )( jQuery );
Index: branches/uploadwizard/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js
@@ -3,6 +3,8 @@
44 * @param div
55 * @param values (optional) array of license key names to activate by default
66 */
 7+
 8+( function( $j ) {
79 mw.UploadWizardLicenseInput = function( selector, values ) {
810 var _this = this;
911
@@ -121,4 +123,4 @@
122124
123125 };
124126
125 -
 127+} )( jQuery );
Index: branches/uploadwizard/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -9,6 +9,8 @@
1010 * 'new' 'transporting' 'transported' 'details' 'submitting-details' 'complete' 'failed'
1111 * should fork this into two -- local and remote, e.g. filename
1212 */
 13+( function( $j ) {
 14+
1315 mw.UploadWizardUpload = function( api, filesDiv ) {
1416 this.api = api;
1517 this.state = 'new';
@@ -2107,9 +2109,6 @@
21082110 _this.upload.setThumbnail( thumbnailDiv, mw.UploadWizard.config[ 'smallThumbnailWidth' ] );
21092111 }
21102112 };
2111 -
2112 -( function( $j ) {
2113 -
21142113 /**
21152114 * Create 'remove' control, an X which highlights in some standardized way.
21162115 */
Index: branches/uploadwizard/extensions/UploadWizard/UploadWizard.php
@@ -38,7 +38,8 @@
3939 # Require modules, includeing the special page
4040 foreach ( array( 'SpecialUploadWizard',
4141 'UploadWizardMessages',
42 - 'ApiQueryStashImageInfo' ) as $module ) {
 42+ 'ApiQueryStashImageInfo',
 43+ 'UploadWizardHooks' ) as $module ) {
4344 $wgAutoloadLocalClasses[$module] = $dir . "/" . $module . ".php";
4445 }
4546 $wgAPIPropModules['stashimageinfo'] = 'ApiQueryStashImageInfo';
@@ -53,5 +54,4 @@
5455 // Set up the javascript path for the loader and localization file.
5556 $wgExtensionJavascriptModules[ 'UploadWizard' ] = 'extensions/UploadWizard';
5657
57 -
58 -
 58+$wgHooks['ResourceLoaderRegisterModules'][] = 'UploadWizardHooks::resourceLoaderRegisterModules';
Index: branches/uploadwizard/extensions/UploadWizard/SpecialUploadWizard.php
@@ -49,96 +49,10 @@
5050 $this->setHeaders();
5151 $this->outputHeader();
5252
53 - /* Doing resource loading the old-fashioned way for now until there's some kind of script-loading
54 - strategy that everyone agrees on, or is available generally
55 - Essentially this list of scripts has to be topologically-sorted by hand, that is, the depended-upon stuff
56 - comes first. There can be no circular dependencies.
57 - */
58 - $scripts = array(
59 - // jquery is already loaded by vector.
60 - // "resources/jquery-1.4.2.js",
61 -
62 - // jquery standard stuff
63 - "resources/jquery.ui/ui/ui.core.js",
64 - "resources/jquery.ui/ui/ui.progressbar.js",
65 - "resources/jquery.ui/ui/ui.datepicker.js",
66 -
67 - // interface helping stuff
68 - "resources/jquery/jquery.tipsy.js",
69 - "resources/jquery/jquery.tipsyPlus.js",
70 - "resources/jquery/jquery.morphCrossfade.js",
71 - "resources/jquery/jquery.validate.js",
72 - "resources/jquery/jquery.arrowSteps.js",
73 - "resources/jquery/jquery.mwCoolCats.js",
74 - "resources/jquery/jquery.autocomplete.js",
75 - "resources/jquery/jquery.spinner.js",
76 -
77 - // our application...
78 -
79 - // miscellaneous utilities
80 - "resources/mw.js",
81 - "resources/mw.Log.js",
82 - "resources/mw.Utilities.js",
83 - "resources/mw.UtilitiesTime.js",
84 - "resources/mw.Uri.js",
85 - "resources/mw.Api.js",
86 - "resources/mw.Api.edit.js",
87 - // "resources/mw.MockUploadHandler.js",
88 -
89 - // message parsing and such
90 - "resources/language/mw.Language.js",
91 - "resources/language/mw.Parser.js",
92 - "resources/mw.LanguageUpWiz.js",
93 -
94 - // workhorse libraries
95 - // "resources/mw.UploadApiProcessor.js",
96 - "resources/mw.IframeTransport.js",
97 - "resources/mw.ApiUploadHandler.js",
98 - "resources/mw.DestinationChecker.js",
99 -
100 - // interface libraries
101 - "resources/mw.GroupProgressBar.js",
102 -
103 - // upload concepts
104 - "resources/mw.Title.js",
105 - "resources/mw.UploadWizardDeed.js",
106 - "resources/mw.UploadWizardLicenseInput.js",
107 - "resources/mw.UploadWizardUtil.js",
108 -
109 - // the thing that does most of it
110 - "resources/mw.UploadWizard.js",
111 -
112 - // finally the thing that launches it all
113 - "UploadWizardPage.js"
114 - );
115 -
116 - if ($langCode !== 'en' ) {
117 - $scripts[] = "js/language/classes/Language" . ucfirst( $langCode ) . ".js";
118 - }
119 -
120 - $extensionPath = $wgScriptPath . "/extensions/UploadWizard";
121 -
122 - foreach ( $scripts as $script ) {
123 - $wgOut->addScriptFile( $extensionPath . "/" . $script );
124 - }
125 - // after scripts, get the i18n.php stuff
126 - $wgOut->addInlineScript( UploadWizardMessages::getMessagesJs( 'UploadWizard', $wgLang ) );
127 -
128 - $styles = array(
129 - "resources/jquery/jquery.tipsy.css",
130 - "resources/uploadWizard.css",
131 - "resources/jquery/jquery.arrowSteps.css",
132 - "resources/jquery/jquery.mwCoolCats.css"
133 - );
134 -
135 - // TODO RTL
136 - foreach ( $styles as $style ) {
137 - $wgOut->addStyle( $extensionPath . "/" . $style, '', '', 'ltr' );
138 - }
139 -
14053 $this->addJsVars( $subPage );
14154
142 -
 55+ $wgOut->addModules( 'ext.uploadWizard' );
 56+
14357 // where the uploadwizard will go
14458 // TODO import more from UploadWizard itself.
14559 // "createInterface" call?
Index: branches/uploadwizard/extensions/UploadWizard/UploadWizardPage.js
@@ -82,7 +82,7 @@
8383
8484 }
8585
86 -$j( document ).ready( function() {
 86+jQuery( document ).ready( function() {
8787 // sets up plural and so on. Seems like a bad design to have to do this, though.
8888 mw.Language.magicSetup();
8989

Comments

#Comment by Catrope (talk | contribs)   15:54, 20 October 2010
+			'languageScripts' => array(
+				'am' => 'extensions/UploadWizard/resources/languages/classes/LanguageAm.js',

Note that in the future, we want to support forcontent messages in RL, which means PLURAL expansion has to be done in the content language for those messages. Once that feature is there and is being used, we'd need to load the content language's JS as well.

Status & tagging log