From: Michael Dale Date: Thu, 20 Aug 2009 14:06:16 +0000 (+0000) Subject: * non firefogg add media wizard upload updates (only works once bug noted) X-Git-Tag: 1.31.0-rc.0~40177 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=52c64d9a7b0f48608849153a6837b1c0fe7fedd8;p=lhc%2Fweb%2Fwiklou.git * non firefogg add media wizard upload updates (only works once bug noted) --- diff --git a/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js b/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js index 2393b23508..41319abc20 100644 --- a/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js +++ b/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js @@ -198,12 +198,12 @@ mvBaseUploadInterface.prototype = { $j(_this.editForm).append(''); //map the form vars to api vars: - $j(_this.editForm).find('#wpUploadFile').attr('name', 'file'); - $j(_this.editForm).find('#wpDestFile').attr('name', 'filename'); - $j(_this.editForm).find('#wpUploadDescription').attr('name', 'comment'); - $j(_this.editForm).find('#wpEditToken').attr('name', 'token'); - $j(_this.editForm).find('#wpIgnoreWarning').attr('name', 'ignorewarnings'); - $j(_this.editForm).find('#wpWatchthis').attr('name', 'watch'); + $j(_this.editForm).find("[name='wpUploadFile']").attr('name', 'file'); + $j(_this.editForm).find("[name='wpDestFile']").attr('name', 'filename'); + $j(_this.editForm).find("[name='wpUploadDescription']").attr('name', 'comment'); + $j(_this.editForm).find("[name='wpEditToken']").attr('name', 'token'); + $j(_this.editForm).find("[name='wpIgnoreWarning']").attr('name', 'ignorewarnings'); + $j(_this.editForm).find("[name='wpWatchthis']").attr('name', 'watch'); //update the status to 100% progress bar (no status in iframe submit) $j('#up-progressbar' ).progressbar('value', parseInt( 100 ) ); diff --git a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js index 33fc1ef463..a20681e9fa 100644 --- a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js +++ b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js @@ -934,7 +934,7 @@ remoteSearchDriver.prototype = { //js_log('getResourceFromId:' + rid ); //strip out /res/ if preset: rid = rid.replace(/res_/, ''); - js_log("looking at: " + rid); + //js_log("looking at: " + rid); p = rid.split('_'); var cp_id = p[0]; var rid = p[1]; diff --git a/js2/mwEmbed/libAddMedia/simpleUploadForm.js b/js2/mwEmbed/libAddMedia/simpleUploadForm.js index f80a548d9f..978e2520be 100644 --- a/js2/mwEmbed/libAddMedia/simpleUploadForm.js +++ b/js2/mwEmbed/libAddMedia/simpleUploadForm.js @@ -86,7 +86,38 @@ var default_form_options = { $j('#wpUploadBtn').attr('disabled', 'disabled'); } }); - + //do destination fill: + //@@should integrate with doDestinationFill on upload page + $j("[name='wpUploadFile']").change(function(){ + var path = $j(this).val(); + // Find trailing part + var slash = path.lastIndexOf('/'); + var backslash = path.lastIndexOf('\\'); + var fname; + if (slash == -1 && backslash == -1) { + fname = path; + } else if (slash > backslash) { + fname = path.substring(slash+1, 10000); + } else { + fname = path.substring(backslash+1, 10000); + } + fname = fname.charAt(0).toUpperCase().concat(fname.substring(1,10000)).replace(/ /g, '_'); + // Output result + $j("[name='wpDestFile']").val( fname ); + //do destination check + $j("[name='wpDestFile']").doDestCheck({ + 'warn_target':'#wpDestFile-warning' + }); + }); + + + //do destination check: + $j("[name='wpDestFile']").change(function(){ + $j(this).doDestCheck({ + 'warn_target':'#wpDestFile-warning' + }); + }); + if(typeof opt.ondone_cb == 'undefined') opt.ondone_cb = false;