r50044 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50043‎ | r50044 | r50045 >
Date:15:23, 29 April 2009
Author:dale
Status:deferred
Tags:
Comment:
stubs for progress on http uploads
fixes bug 18264 Cannot use "upload by URL" feature with javascript disabled
Modified paths:
  • /branches/new-upload/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/new-upload/phase3/includes/Skin.php (modified) (history)
  • /branches/new-upload/phase3/includes/UploadBase.php (modified) (history)
  • /branches/new-upload/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /branches/new-upload/phase3/skins/common/upload.js (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/skins/common/upload.js
@@ -11,7 +11,17 @@
1212 wgUploadLicenseObj.fetchPreview( selection );
1313 }
1414
15 -function licenseSelectorFixup() {
 15+function wgUploadSetup() {
 16+ //disable source type if not checked:
 17+ var e = document.getElementById('wpSourceTypeURL');
 18+ if(e){
 19+ if(!e.checked){
 20+ var ein = document.getElementById('wpUploadFileURL');
 21+ if(ein)
 22+ ein.setAttribute('disabled', 'disabled');
 23+ }
 24+ }
 25+
1626 // for MSIE/Mac; non-breaking spaces cause the <option> not to render
1727 // but, for some reason, setting the text to itself works
1828 var selector = document.getElementById("wpLicense");
@@ -103,7 +113,6 @@
104114 ackElt.value = '1';
105115 }
106116 },
107 -
108117 'setInnerHTML' : function (element, text) {
109118 // Check for no change to avoid flicker in IE 7
110119 if (element.innerHTML != text) {
@@ -144,7 +153,7 @@
145154 if( fname.lastIndexOf('.')!=-1 ){
146155 var ext = fname.substr( fname.lastIndexOf('.')+1 );
147156 for(var i=0; i < wgFileExtensions.length; i++){
148 - if( wgFileExtensions[i] == ext )
 157+ if( strtolower( wgFileExtensions[i] ) == strtolower( ext ) )
149158 found = true;
150159 }
151160 }
@@ -222,4 +231,4 @@
223232
224233 }
225234
226 -addOnloadHook( licenseSelectorFixup );
\ No newline at end of file
 235+addOnloadHook( wgUploadSetup );
\ No newline at end of file
Index: branches/new-upload/phase3/includes/DefaultSettings.php
@@ -3425,6 +3425,11 @@
34263426 $wgAjaxUploadDestCheck = true;
34273427
34283428 /**
 3429+ * Enable AJAX upload interface (need for large http uploads & to display progress on uploads for browsers that support it)
 3430+ */
 3431+$wgAjaxUploadInterface = true;
 3432+
 3433+/**
34293434 * Enable previewing licences via AJAX
34303435 */
34313436 $wgAjaxLicensePreview = true;
Index: branches/new-upload/phase3/includes/specials/SpecialUpload.php
@@ -723,7 +723,7 @@
724724 "onfocus='" .
725725 "toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");" .
726726 "toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")' " .
727 - "onchange='fillDestFilename(\"wpUploadFileURL\")' size='60' disabled='disabled' />" .
 727+ "onchange='fillDestFilename(\"wpUploadFileURL\")' size='60' />" .
728728 wfMsgHtml( 'upload_source_url' ) ;
729729 } else {
730730 $filename_form =
Index: branches/new-upload/phase3/includes/Skin.php
@@ -384,10 +384,11 @@
385385 'wgDigitTransformTable' => $compactDigitTransTable,
386386 );
387387
388 - //if on upload page output the extension list:
 388+ //if on upload page output the extension list & js_upload
389389 if( SpecialPage::resolveAlias( $wgTitle->getDBkey() ) == "Upload" ){
390 - global $wgFileExtensions;
391 - $vars['wgFileExtensions'] = $wgFileExtensions;
 390+ global $wgFileExtensions, $wgAjaxUploadInterface;
 391+ $vars['wgFileExtensions'] = $wgFileExtensions;
 392+ $vars['wgAjaxUploadInterface'] = $wgAjaxUploadInterface;
392393 }
393394
394395 if( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false )){
Index: branches/new-upload/phase3/includes/UploadBase.php
@@ -479,8 +479,7 @@
480480 * @return success
481481 */
482482 function unsaveUploadedFile() {
483 - $repo = RepoGroup::singleton()->getLocalRepo();
484 - print "free temp: {$this->mTempPath}\n";
 483+ $repo = RepoGroup::singleton()->getLocalRepo();
485484 $success = $repo->freeTemp( $this->mTempPath );
486485 return $success;
487486 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r56524* ( bug 18264 ) upload-by-url form was still disabled in non-js2 form outputdale15:25, 17 September 2009

Status & tagging log