r75904 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75903‎ | r75904 | r75905 >
Date:03:04, 3 November 2010
Author:neilk
Status:deferred (Comments)
Tags:
Comment:
got UploadWizard back to a pre-ResourceLoader state, but possible to switch back easily
Modified paths:
  • /branches/uploadwizard/extensions/UploadWizard/SpecialUploadWizard.php (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/UploadWizardHooks.php (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/UploadWizardMessages.php (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.js (modified) (history)

Diff [purge]

Index: branches/uploadwizard/extensions/UploadWizard/UploadWizardHooks.php
@@ -1,40 +1,65 @@
22 <?php
33
 4+/**
 5+ * Contains list of related resources and hooks which anticipate the use of Resource Loader, whenever that is released
 6+ */
47 class UploadWizardHooks {
58
6 - /* Protected Static Members */
7 -
8 - protected static $modules = array(
 9+ /* We define scripts here for Resource Loader, but in the meantime we are going to load these the old-fashioned way
 10+ (see SpecialUploadWizard.php).
 11+
 12+ So this list of scripts has to be topologically-sorted by hand. That is, the depended-upon stuff comes first.
 13+ There can be no circular dependencies. */
 14+
 15+ public static $modules = array(
916 'ext.uploadWizard' => array(
1017 'scripts' => array(
 18+
 19+ // jquery interface helpers
1120 'extensions/UploadWizard/resources/jquery/jquery.tipsy.js',
1221 'extensions/UploadWizard/resources/jquery/jquery.tipsyPlus.js',
1322 'extensions/UploadWizard/resources/jquery/jquery.morphCrossfade.js',
1423 'extensions/UploadWizard/resources/jquery/jquery.validate.js',
1524 'extensions/UploadWizard/resources/jquery/jquery.arrowSteps.js',
16 - 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.js',
1725 'extensions/UploadWizard/resources/jquery/jquery.autocomplete.js',
1826 'extensions/UploadWizard/resources/jquery/jquery.spinner.js',
19 - 'extensions/UploadWizard/resources/mw.js',
 27+
 28+ // mediawiki-specific interface helper (relies on mediawiki globals)
 29+ 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.js',
 30+
 31+ // common utilities
 32+ 'extensions/UploadWizard/resources/mw.js', // <-- obsolete?
2033 'extensions/UploadWizard/resources/mw.Log.js',
2134 'extensions/UploadWizard/resources/mw.Utilities.js',
2235 'extensions/UploadWizard/resources/mw.UtilitiesTime.js',
2336 'extensions/UploadWizard/resources/mw.Uri.js',
2437 'extensions/UploadWizard/resources/mw.Api.js',
2538 'extensions/UploadWizard/resources/mw.Api.edit.js',
 39+ 'extensions/UploadWizard/resources/mw.Title.js',
 40+
 41+ // message parsing
2642 'extensions/UploadWizard/resources/language/mw.Language.js',
2743 'extensions/UploadWizard/resources/language/mw.Parser.js',
2844 'extensions/UploadWizard/resources/mw.LanguageUpWiz.js',
 45+
 46+ // workhorse libraries
2947 'extensions/UploadWizard/resources/mw.IframeTransport.js',
3048 'extensions/UploadWizard/resources/mw.ApiUploadHandler.js',
3149 'extensions/UploadWizard/resources/mw.DestinationChecker.js',
 50+ 'extensions/UploadWizard/resources/mw.UploadWizardUtil.js',
 51+
 52+ // interface libraries
3253 'extensions/UploadWizard/resources/mw.GroupProgressBar.js',
33 - 'extensions/UploadWizard/resources/mw.Title.js',
34 - 'extensions/UploadWizard/resources/mw.UploadWizard.js',
 54+
 55+ // UploadWizard specific abstractions
3556 'extensions/UploadWizard/resources/mw.UploadWizardDeed.js',
3657 'extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js',
37 - 'extensions/UploadWizard/resources/mw.UploadWizardUtil.js',
38 - 'extensions/UploadWizard/UploadWizardPage.js',
 58+
 59+ // main library
 60+ 'extensions/UploadWizard/resources/mw.UploadWizard.js',
 61+
 62+ // launcher
 63+ 'extensions/UploadWizard/UploadWizardPage.js'
3964 ),
4065 'languageScripts' => array(
4166 'am' => 'extensions/UploadWizard/resources/languages/classes/LanguageAm.js',
@@ -81,154 +106,26 @@
82107 'ti' => 'extensions/UploadWizard/resources/languages/classes/LanguageTi.js',
83108 'tl' => 'extensions/UploadWizard/resources/languages/classes/LanguageTl.js',
84109 'uk' => 'extensions/UploadWizard/resources/languages/classes/LanguageUk.js',
85 - 'wa' => 'extensions/UploadWizard/resources/languages/classes/LanguageWa.js',
 110+ 'wa' => 'extensions/UploadWizard/resources/languages/classes/LanguageWa.js'
86111 ),
87112 'styles' => array(
88113 'extensions/UploadWizard/resources/jquery/jquery.tipsy.css',
89114 'extensions/UploadWizard/resources/uploadWizard.css',
90115 'extensions/UploadWizard/resources/jquery/jquery.arrowSteps.css',
91 - 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.css',
 116+ 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.css'
92117 ),
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',
 118+ 'messages' => array(
 119+ // see UploadWizard.i18n.php
223120 ),
224121 'dependencies' => array(
225 - 'jquery.ui.datepicker',
226 - 'jquery.ui.progressbar',
 122+ // see SpecialUploadWizard.php
 123+ // see SpecialUploadWizard.php
227124 ),
228 - 'group' => 'ext.uploadWizard',
 125+ 'group' => 'ext.uploadWizard'
229126 ),
230127 'ext.uploadWizard.tests' => array(
231128 'scripts' => array(
232 - 'extensions/UploadWizard/resources/mw.MockUploadHandler.js',
 129+ 'extensions/UploadWizard/resources/mw.MockUploadHandler.js'
233130 ),
234131 ),
235132 );
Index: branches/uploadwizard/extensions/UploadWizard/UploadWizardMessages.php
@@ -8,17 +8,8 @@
99 * @ingroup Upload
1010 */
1111
12 -/* This class is temporary.
13 -
14 - With the rejection of JS2 and reassignment of Michael Dale, there seems to be no currently supported
15 - resource loader (July 2010), but UploadWizard already relies on things like
16 - pluralization in messages which were only available in JS2. Also we have problems with how JS2 loads
17 - things in IE6; there are bugs which neither I nor Trevor Parscal can figure out. So, we are temporarily
18 - falling back to a simpler method of loading messages, which will hopefully
19 - be superseded by the new loader Roan Kattouw & Trevor Parscal are writing.
 12+/* This class is temporary, until Resource Loader is available. */
2013
21 -*/
22 -
2314 class UploadWizardMessages {
2415
2516 /**
Index: branches/uploadwizard/extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.js
@@ -1,3 +1,8 @@
 2+/**
 3+ * Simple predictive typing category adder for Mediawiki.
 4+ * Relies on globals: wgScriptPath, wgNamespaceIds, wgFormattedNamespaces
 5+ * Add to the page and then use getWikiText() to get wiki text representing the categories.
 6+ */
27 ( function ( $j ) { $j.fn.mwCoolCats = function( options ) {
38
49 var defaults = {
Index: branches/uploadwizard/extensions/UploadWizard/SpecialUploadWizard.php
@@ -57,7 +57,40 @@
5858
5959
6060 $this->addJsVars( $subPage );
61 - $wgOut->addModules( 'ext.uploadWizard' );
 61+ if ( $wgResourceLoader ) {
 62+ $wgOut->addModules( 'ext.uploadWizard' );
 63+ } else {
 64+ /* Doing resource loading the old-fashioned way for now until Resource Loader or something becomes the standard.
 65+ We anticipate that Resource Loader will be available sometime in late 2010 or early 2011,
 66+ so we define scripts in the hooks that Resource Loader will expect, over in UploadWizardHooks.php.
 67+ */
 68+ $module = UploadWizardHooks::$modules['ext.uploadWizard'];
 69+
 70+ // in ResourceLoader, these will probably have names rather than explicit script paths, or be automatically loaded
 71+ $dependencies = array(
 72+ "extensions/UploadWizard/resources/jquery.ui/ui/ui.core.js",
 73+ 'extensions/UploadWizard/resources/jquery.ui/ui/ui.datepicker.js',
 74+ 'extensions/UploadWizard/resources/jquery.ui/ui/ui.progressbar.js'
 75+ );
 76+
 77+ $scripts = array_merge( $dependencies, $module['scripts'] );
 78+ if ( $wgLanguageCode !== 'en' && isset( $module['languageScripts'][$wgLanguageCode] ) ) {
 79+ $scripts[] = $module['languageScripts'][$wgLanguageCode];
 80+ }
 81+ wfDebug( print_r( $scripts, 1 ) );
 82+ foreach ( $scripts as $script ) {
 83+ $wgOut->addScriptFile( $wgScriptPath . "/" . $script );
 84+ }
 85+
 86+ // after scripts, get the i18n.php stuff
 87+ $wgOut->addInlineScript( UploadWizardMessages::getMessagesJs( 'UploadWizard', $wgLang ) );
 88+
 89+ // TODO RTL
 90+ foreach ( $module['styles'] as $style ) {
 91+ $wgOut->addStyle( "/" . $style, '', '', 'ltr' );
 92+ }
 93+
 94+ }
6295
6396 // where the uploadwizard will go
6497 // TODO import more from UploadWizard's createInterface call.

Comments

#Comment by Catrope (talk | contribs)   12:24, 4 November 2010
+			wfDebug( print_r( $scripts, 1 ) );

Debug statement left in.

Also, all this stuff needs to be combined&minified with a Makefile, I'll poke at that.

#Comment by NeilK (talk | contribs)   00:16, 16 November 2010

debug statement removed in r76182.

Also added combination and minification program in r76182.

Status & tagging log