r75115 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75114‎ | r75115 | r75116 >
Date:21:50, 20 October 2010
Author:neilk
Status:deferred
Tags:
Comment:
layout fixes, non-JS fallback
Modified paths:
  • /branches/uploadwizard/extensions/UploadWizard/SpecialUploadWizard.php (modified) (history)
  • /branches/uploadwizard/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)

Diff [purge]

Index: branches/uploadwizard/extensions/UploadWizard/UploadWizard.i18n.php
@@ -23,6 +23,7 @@
2424 'internallinktest' => '[[Special:SpecialPages|{{int:specialpages}}]]',
2525 'uploadwizard' => 'Upload wizard',
2626 '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.',
2728 'mwe-loading-upwiz' => 'Loading upload wizard',
2829 'mwe-upwiz-code-unknown' => 'Unknown language',
2930 'mwe-upwiz-step-file' => 'Upload',
Index: branches/uploadwizard/extensions/UploadWizard/SpecialUploadWizard.php
@@ -15,12 +15,7 @@
1616 // $request is the request (usually wgRequest)
1717 // $par is everything in the URL after Special:UploadWizard. Not sure what we can use it for
1818 public function __construct( $request=null, $par=null ) {
19 - global $wgEnableAPI, $wgRequest;
20 -
21 - if (! $wgEnableAPI) {
22 - // XXX complain
23 - }
24 -
 19+ global $wgRequest;
2520 // here we would configure ourselves based on stuff in $request and $wgRequest, but so far, we
2621 // don't have such things
2722
@@ -44,29 +39,26 @@
4540 return;
4641 }
4742
48 - $langCode = $wgLang->getCode();
49 -
5043 $this->setHeaders();
5144 $this->outputHeader();
 45+
5246
 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+
5354 $this->addJsVars( $subPage );
54 -
5555 $wgOut->addModules( 'ext.uploadWizard' );
5656
5757 // where the uploadwizard will go
58 - // TODO import more from UploadWizard itself.
59 - // "createInterface" call?
 58+ // TODO import more from UploadWizard's createInterface call.
6059 $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>'
6361 );
64 -
6562
66 - // fallback for non-JS
67 - $wgOut->addHTML('<noscript>');
68 - $this->simpleForm->show();
69 - $wgOut->addHTML('</noscript>');
70 -
7163 }
7264
7365 /**
@@ -80,7 +72,7 @@
8173 global $wgUploadWizardDebug;
8274
8375 $wgOut->addScript( Skin::makeVariablesScript( array(
84 - 'wgUploadWizardDebug' => !!$wgUploadWizardDebug,
 76+ 'wgUploadWizardDebug' => (bool)$wgUploadWizardDebug,
8577
8678 // uncertain if this is relevant. Can we do license preview with API?
8779 'wgAjaxLicensePreview' => $wgUseAjax && $wgAjaxLicensePreview,
@@ -105,7 +97,7 @@
10698 * @return boolean -- true if can upload
10799 */
108100 private function isUploadAllowed() {
109 - global $wgOut;
 101+ global $wgOut, $wgEnableAPI;
110102
111103 // Check uploading enabled
112104 if( !UploadBase::isEnabled() ) {
@@ -113,6 +105,8 @@
114106 return false;
115107 }
116108
 109+ // XXX does wgEnableAPI affect all uploads too?
 110+
117111 // Check whether we actually want to allow changing stuff
118112 if( wfReadOnly() ) {
119113 $wgOut->readOnlyPage();

Status & tagging log