Index: branches/uploadwizard/extensions/UploadWizard/UploadWizardHooks.php |
— | — | @@ -1,40 +1,65 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +/** |
| 5 | + * Contains list of related resources and hooks which anticipate the use of Resource Loader, whenever that is released |
| 6 | + */ |
4 | 7 | class UploadWizardHooks { |
5 | 8 | |
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( |
9 | 16 | 'ext.uploadWizard' => array( |
10 | 17 | 'scripts' => array( |
| 18 | + |
| 19 | + // jquery interface helpers |
11 | 20 | 'extensions/UploadWizard/resources/jquery/jquery.tipsy.js', |
12 | 21 | 'extensions/UploadWizard/resources/jquery/jquery.tipsyPlus.js', |
13 | 22 | 'extensions/UploadWizard/resources/jquery/jquery.morphCrossfade.js', |
14 | 23 | 'extensions/UploadWizard/resources/jquery/jquery.validate.js', |
15 | 24 | 'extensions/UploadWizard/resources/jquery/jquery.arrowSteps.js', |
16 | | - 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.js', |
17 | 25 | 'extensions/UploadWizard/resources/jquery/jquery.autocomplete.js', |
18 | 26 | '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? |
20 | 33 | 'extensions/UploadWizard/resources/mw.Log.js', |
21 | 34 | 'extensions/UploadWizard/resources/mw.Utilities.js', |
22 | 35 | 'extensions/UploadWizard/resources/mw.UtilitiesTime.js', |
23 | 36 | 'extensions/UploadWizard/resources/mw.Uri.js', |
24 | 37 | 'extensions/UploadWizard/resources/mw.Api.js', |
25 | 38 | 'extensions/UploadWizard/resources/mw.Api.edit.js', |
| 39 | + 'extensions/UploadWizard/resources/mw.Title.js', |
| 40 | + |
| 41 | + // message parsing |
26 | 42 | 'extensions/UploadWizard/resources/language/mw.Language.js', |
27 | 43 | 'extensions/UploadWizard/resources/language/mw.Parser.js', |
28 | 44 | 'extensions/UploadWizard/resources/mw.LanguageUpWiz.js', |
| 45 | + |
| 46 | + // workhorse libraries |
29 | 47 | 'extensions/UploadWizard/resources/mw.IframeTransport.js', |
30 | 48 | 'extensions/UploadWizard/resources/mw.ApiUploadHandler.js', |
31 | 49 | 'extensions/UploadWizard/resources/mw.DestinationChecker.js', |
| 50 | + 'extensions/UploadWizard/resources/mw.UploadWizardUtil.js', |
| 51 | + |
| 52 | + // interface libraries |
32 | 53 | '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 |
35 | 56 | 'extensions/UploadWizard/resources/mw.UploadWizardDeed.js', |
36 | 57 | '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' |
39 | 64 | ), |
40 | 65 | 'languageScripts' => array( |
41 | 66 | 'am' => 'extensions/UploadWizard/resources/languages/classes/LanguageAm.js', |
— | — | @@ -81,154 +106,26 @@ |
82 | 107 | 'ti' => 'extensions/UploadWizard/resources/languages/classes/LanguageTi.js', |
83 | 108 | 'tl' => 'extensions/UploadWizard/resources/languages/classes/LanguageTl.js', |
84 | 109 | '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' |
86 | 111 | ), |
87 | 112 | 'styles' => array( |
88 | 113 | 'extensions/UploadWizard/resources/jquery/jquery.tipsy.css', |
89 | 114 | 'extensions/UploadWizard/resources/uploadWizard.css', |
90 | 115 | 'extensions/UploadWizard/resources/jquery/jquery.arrowSteps.css', |
91 | | - 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.css', |
| 116 | + 'extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.css' |
92 | 117 | ), |
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 |
223 | 120 | ), |
224 | 121 | 'dependencies' => array( |
225 | | - 'jquery.ui.datepicker', |
226 | | - 'jquery.ui.progressbar', |
| 122 | + // see SpecialUploadWizard.php |
| 123 | + // see SpecialUploadWizard.php |
227 | 124 | ), |
228 | | - 'group' => 'ext.uploadWizard', |
| 125 | + 'group' => 'ext.uploadWizard' |
229 | 126 | ), |
230 | 127 | 'ext.uploadWizard.tests' => array( |
231 | 128 | 'scripts' => array( |
232 | | - 'extensions/UploadWizard/resources/mw.MockUploadHandler.js', |
| 129 | + 'extensions/UploadWizard/resources/mw.MockUploadHandler.js' |
233 | 130 | ), |
234 | 131 | ), |
235 | 132 | ); |
Index: branches/uploadwizard/extensions/UploadWizard/UploadWizardMessages.php |
— | — | @@ -8,17 +8,8 @@ |
9 | 9 | * @ingroup Upload |
10 | 10 | */ |
11 | 11 | |
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. */ |
20 | 13 | |
21 | | -*/ |
22 | | - |
23 | 14 | class UploadWizardMessages { |
24 | 15 | |
25 | 16 | /** |
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 | + */ |
2 | 7 | ( function ( $j ) { $j.fn.mwCoolCats = function( options ) { |
3 | 8 | |
4 | 9 | var defaults = { |
Index: branches/uploadwizard/extensions/UploadWizard/SpecialUploadWizard.php |
— | — | @@ -57,7 +57,40 @@ |
58 | 58 | |
59 | 59 | |
60 | 60 | $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 | + } |
62 | 95 | |
63 | 96 | // where the uploadwizard will go |
64 | 97 | // TODO import more from UploadWizard's createInterface call. |