Index: branches/uploadwizard/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | 'internallinktest' => '[[Special:SpecialPages|{{int:specialpages}}]]', |
25 | 25 | 'uploadwizard' => 'Upload wizard', |
26 | 26 | 'uploadwizard-desc' => 'Upload wizard, developed for the Multimedia Usability grant', |
| 27 | + 'mwe-upwiz-js-off' => 'UploadWizard uses Javascript for an improved interface. Your browser either does not support Javascript or has Javascript turned off, so we are showing you a simple upload form.', |
27 | 28 | 'mwe-loading-upwiz' => 'Loading upload wizard', |
28 | 29 | 'mwe-upwiz-code-unknown' => 'Unknown language', |
29 | 30 | 'mwe-upwiz-step-file' => 'Upload', |
Index: branches/uploadwizard/extensions/UploadWizard/SpecialUploadWizard.php |
— | — | @@ -15,12 +15,7 @@ |
16 | 16 | // $request is the request (usually wgRequest) |
17 | 17 | // $par is everything in the URL after Special:UploadWizard. Not sure what we can use it for |
18 | 18 | public function __construct( $request=null, $par=null ) { |
19 | | - global $wgEnableAPI, $wgRequest; |
20 | | - |
21 | | - if (! $wgEnableAPI) { |
22 | | - // XXX complain |
23 | | - } |
24 | | - |
| 19 | + global $wgRequest; |
25 | 20 | // here we would configure ourselves based on stuff in $request and $wgRequest, but so far, we |
26 | 21 | // don't have such things |
27 | 22 | |
— | — | @@ -44,29 +39,26 @@ |
45 | 40 | return; |
46 | 41 | } |
47 | 42 | |
48 | | - $langCode = $wgLang->getCode(); |
49 | | - |
50 | 43 | $this->setHeaders(); |
51 | 44 | $this->outputHeader(); |
| 45 | + |
52 | 46 | |
| 47 | + // fallback for non-JS |
| 48 | + $wgOut->addHTML('<noscript>'); |
| 49 | + $wgOut->addHTML( '<p class="errorbox">' . wfMsg( 'mwe-upwiz-js-off' ) . '</p>' ); |
| 50 | + $this->simpleForm->show(); |
| 51 | + $wgOut->addHTML('</noscript>'); |
| 52 | + |
| 53 | + |
53 | 54 | $this->addJsVars( $subPage ); |
54 | | - |
55 | 55 | $wgOut->addModules( 'ext.uploadWizard' ); |
56 | 56 | |
57 | 57 | // where the uploadwizard will go |
58 | | - // TODO import more from UploadWizard itself. |
59 | | - // "createInterface" call? |
| 58 | + // TODO import more from UploadWizard's createInterface call. |
60 | 59 | $wgOut->addHTML( |
61 | | - '<div id="upload-licensing" class="upload-section" style="display: none;">Licensing tutorial</div>' |
62 | | - . '<div id="upload-wizard" class="upload-section"><div class="loadingSpinner"></div></div>' |
| 60 | + '<div id="upload-wizard" class="upload-section"><div class="loadingSpinner"></div></div>' |
63 | 61 | ); |
64 | | - |
65 | 62 | |
66 | | - // fallback for non-JS |
67 | | - $wgOut->addHTML('<noscript>'); |
68 | | - $this->simpleForm->show(); |
69 | | - $wgOut->addHTML('</noscript>'); |
70 | | - |
71 | 63 | } |
72 | 64 | |
73 | 65 | /** |
— | — | @@ -80,7 +72,7 @@ |
81 | 73 | global $wgUploadWizardDebug; |
82 | 74 | |
83 | 75 | $wgOut->addScript( Skin::makeVariablesScript( array( |
84 | | - 'wgUploadWizardDebug' => !!$wgUploadWizardDebug, |
| 76 | + 'wgUploadWizardDebug' => (bool)$wgUploadWizardDebug, |
85 | 77 | |
86 | 78 | // uncertain if this is relevant. Can we do license preview with API? |
87 | 79 | 'wgAjaxLicensePreview' => $wgUseAjax && $wgAjaxLicensePreview, |
— | — | @@ -105,7 +97,7 @@ |
106 | 98 | * @return boolean -- true if can upload |
107 | 99 | */ |
108 | 100 | private function isUploadAllowed() { |
109 | | - global $wgOut; |
| 101 | + global $wgOut, $wgEnableAPI; |
110 | 102 | |
111 | 103 | // Check uploading enabled |
112 | 104 | if( !UploadBase::isEnabled() ) { |
— | — | @@ -113,6 +105,8 @@ |
114 | 106 | return false; |
115 | 107 | } |
116 | 108 | |
| 109 | + // XXX does wgEnableAPI affect all uploads too? |
| 110 | + |
117 | 111 | // Check whether we actually want to allow changing stuff |
118 | 112 | if( wfReadOnly() ) { |
119 | 113 | $wgOut->readOnlyPage(); |