Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -934,7 +934,7 @@ |
935 | 935 | //js_log('getResourceFromId:' + rid ); |
936 | 936 | //strip out /res/ if preset: |
937 | 937 | rid = rid.replace(/res_/, ''); |
938 | | - js_log("looking at: " + rid); |
| 938 | + //js_log("looking at: " + rid); |
939 | 939 | p = rid.split('_'); |
940 | 940 | var cp_id = p[0]; |
941 | 941 | var rid = p[1]; |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/simpleUploadForm.js |
— | — | @@ -86,7 +86,38 @@ |
87 | 87 | $j('#wpUploadBtn').attr('disabled', 'disabled'); |
88 | 88 | } |
89 | 89 | }); |
90 | | - |
| 90 | + //do destination fill: |
| 91 | + //@@should integrate with doDestinationFill on upload page |
| 92 | + $j("[name='wpUploadFile']").change(function(){ |
| 93 | + var path = $j(this).val(); |
| 94 | + // Find trailing part |
| 95 | + var slash = path.lastIndexOf('/'); |
| 96 | + var backslash = path.lastIndexOf('\\'); |
| 97 | + var fname; |
| 98 | + if (slash == -1 && backslash == -1) { |
| 99 | + fname = path; |
| 100 | + } else if (slash > backslash) { |
| 101 | + fname = path.substring(slash+1, 10000); |
| 102 | + } else { |
| 103 | + fname = path.substring(backslash+1, 10000); |
| 104 | + } |
| 105 | + fname = fname.charAt(0).toUpperCase().concat(fname.substring(1,10000)).replace(/ /g, '_'); |
| 106 | + // Output result |
| 107 | + $j("[name='wpDestFile']").val( fname ); |
| 108 | + //do destination check |
| 109 | + $j("[name='wpDestFile']").doDestCheck({ |
| 110 | + 'warn_target':'#wpDestFile-warning' |
| 111 | + }); |
| 112 | + }); |
| 113 | + |
| 114 | + |
| 115 | + //do destination check: |
| 116 | + $j("[name='wpDestFile']").change(function(){ |
| 117 | + $j(this).doDestCheck({ |
| 118 | + 'warn_target':'#wpDestFile-warning' |
| 119 | + }); |
| 120 | + }); |
| 121 | + |
91 | 122 | if(typeof opt.ondone_cb == 'undefined') |
92 | 123 | opt.ondone_cb = false; |
93 | 124 | |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js |
— | — | @@ -198,12 +198,12 @@ |
199 | 199 | $j(_this.editForm).append('<input type="hidden" name="format" value="jsonfm">'); |
200 | 200 | |
201 | 201 | //map the form vars to api vars: |
202 | | - $j(_this.editForm).find('#wpUploadFile').attr('name', 'file'); |
203 | | - $j(_this.editForm).find('#wpDestFile').attr('name', 'filename'); |
204 | | - $j(_this.editForm).find('#wpUploadDescription').attr('name', 'comment'); |
205 | | - $j(_this.editForm).find('#wpEditToken').attr('name', 'token'); |
206 | | - $j(_this.editForm).find('#wpIgnoreWarning').attr('name', 'ignorewarnings'); |
207 | | - $j(_this.editForm).find('#wpWatchthis').attr('name', 'watch'); |
| 202 | + $j(_this.editForm).find("[name='wpUploadFile']").attr('name', 'file'); |
| 203 | + $j(_this.editForm).find("[name='wpDestFile']").attr('name', 'filename'); |
| 204 | + $j(_this.editForm).find("[name='wpUploadDescription']").attr('name', 'comment'); |
| 205 | + $j(_this.editForm).find("[name='wpEditToken']").attr('name', 'token'); |
| 206 | + $j(_this.editForm).find("[name='wpIgnoreWarning']").attr('name', 'ignorewarnings'); |
| 207 | + $j(_this.editForm).find("[name='wpWatchthis']").attr('name', 'watch'); |
208 | 208 | |
209 | 209 | //update the status to 100% progress bar (no status in iframe submit) |
210 | 210 | $j('#up-progressbar' ).progressbar('value', parseInt( 100 ) ); |