* non firefogg add media wizard upload updates (only works once bug noted)
authorMichael Dale <dale@users.mediawiki.org>
Thu, 20 Aug 2009 14:06:16 +0000 (14:06 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Thu, 20 Aug 2009 14:06:16 +0000 (14:06 +0000)
js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/simpleUploadForm.js

index 2393b23..41319ab 100644 (file)
@@ -198,12 +198,12 @@ mvBaseUploadInterface.prototype = {
                                $j(_this.editForm).append('<input type="hidden" name="format" value="jsonfm">');
 
                        //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 ) );
index 33fc1ef..a20681e 100644 (file)
@@ -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];         
index f80a548..978e252 100644 (file)
@@ -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;