From: Brion Vibber Date: Fri, 14 Mar 2008 23:38:08 +0000 (+0000) Subject: * (bug 3131) Manually-specified upload destination filename is no longer X-Git-Tag: 1.31.0-rc.0~49092 X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=1edef23d71ae40ecb5a146032637e41fad5d452a;p=lhc%2Fweb%2Fwiklou.git * (bug 3131) Manually-specified upload destination filename is no longer overwritten by browsing for a file after you wrote it. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c5929d35f1..dcae5068a5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -90,6 +90,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Email subject in content language instead of sending user's UI language * (bug 13251) Allow maintenance rebuild scripts to work with Postgres * (bug 2084) Fixed incorrect regex to match redirects +* (bug 3131) Manually-specified upload destination filename is no longer + overwritten by browsing for a file after you wrote it. + === API changes in 1.13 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1cb8346231..423e2f9400 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1326,7 +1326,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '122'; +$wgStyleVersion = '123'; # Server-side caching: diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 1e3f57cc8f..64ed215776 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -921,10 +921,12 @@ class UploadForm { $adc = wfBoolToStr( $useAjaxDestCheck ); $alp = wfBoolToStr( $useAjaxLicensePreview ); + $autofill = wfBoolToStr( $this->mDesiredDestName == '' ); $wgOut->addScript( " " ); @@ -1032,7 +1034,7 @@ wgAjaxLicensePreview = {$alp}; "onfocus='" . "toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");" . "toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" . - ($this->mDesiredDestName?"":"onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='60' />" . + "onchange='fillDestFilename(\"wpUploadFile\")' size='60' />" . wfMsgHTML( 'upload_source_file' ) . "
" . "" . @@ -1040,7 +1042,7 @@ wgAjaxLicensePreview = {$alp}; "onfocus='" . "toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");" . "toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")'" . - ($this->mDesiredDestName?"":"onchange='fillDestFilename(\"wpUploadFileURL\")' ") . "size='60' disabled='disabled' />" . + "onchange='fillDestFilename(\"wpUploadFileURL\")' size='60' disabled='disabled' />" . wfMsgHtml( 'upload_source_url' ) ; } else { $filename_form = @@ -1075,7 +1077,7 @@ wgAjaxLicensePreview = {$alp}; + value="$encDestName" onchange='toggleFilenameFiller()' $destOnkeyup /> diff --git a/skins/common/upload.js b/skins/common/upload.js index 7cbfc9aae7..e46c3ecba1 100644 --- a/skins/common/upload.js +++ b/skins/common/upload.js @@ -112,6 +112,9 @@ var wgUploadWarningObj = { } function fillDestFilename(id) { + if (!wgUploadAutoFill) { + return; + } if (!document.getElementById) { return; } @@ -139,6 +142,17 @@ function fillDestFilename(id) { } } +function toggleFilenameFiller() { + if(!document.getElementById) return; + var upfield = document.getElementById('wpUploadFile'); + var destName = document.getElementById('wpDestFile').value; + if (destName=='' || destName==' ') { + wgUploadAutoFill = true; + } else { + wgUploadAutoFill = false; + } +} + var wgUploadLicenseObj = { 'responseCache' : { '' : '' },