Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -16,6 +16,7 @@ |
17 | 17 | }, |
18 | 18 | //returns a rObj by title |
19 | 19 | addByTitle:function( title , callback){ |
| 20 | + js_log("AddByTitle::" + title); |
20 | 21 | var _this = this; |
21 | 22 | var reqObj = { |
22 | 23 | 'action':'query', |
— | — | @@ -28,7 +29,7 @@ |
29 | 30 | do_api_req( { |
30 | 31 | 'data':reqObj, |
31 | 32 | 'url':this.cp.api_url |
32 | | - }, function(data){ |
| 33 | + }, function(data){ |
33 | 34 | callback( _this.addSingleResult(data) ); |
34 | 35 | } |
35 | 36 | ); |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -443,7 +443,7 @@ |
444 | 444 | var _this = this; |
445 | 445 | //add the parent target_container if not provided or missing |
446 | 446 | if(!_this.target_container || $j(_this.target_container).length==0){ |
447 | | - $j('body').append('<div id="rsd_modal_target" style="position:absolute;top:30px;left:0px;bottom:45px;right:0px;" title="' + gM('mwe-add_media_wizard') + '" ></div>'); |
| 447 | + $j('body').append('<div id="rsd_modal_target" style="position:absolute;top:30px;left:0px;bottom:33px;right:0px;" title="' + gM('mwe-add_media_wizard') + '" ></div>'); |
448 | 448 | _this.target_container = '#rsd_modal_target'; |
449 | 449 | //js_log('appended: #rsd_modal_target' + $j(_this.target_container).attr('id')); |
450 | 450 | //js_log('added target id:' + $j(_this.target_container).attr('id')); |
— | — | @@ -636,11 +636,11 @@ |
637 | 637 | //deal with the api form upload form directly: |
638 | 638 | $j('#upload_form').simpleUploadForm({ |
639 | 639 | "api_target" : _this.upload_api_target , |
640 | | - "ondone_cb" : function( resultData ){ |
641 | | - var wTitle = resultData['wpDestFile']; |
| 640 | + "ondone_cb" : function( resultData ){ |
| 641 | + var wTitle = resultData['filename']; |
642 | 642 | //add a loading div |
643 | 643 | _this.addResourceEditLoader(); |
644 | | - |
| 644 | + //@@note: we have most of what we need in resultData imageinfo |
645 | 645 | cp.sObj.addByTitle( wTitle, function( rObj ){ |
646 | 646 | //redraw (with added result if new) |
647 | 647 | _this.drawOutputResults(); |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/simpleUploadForm.js |
— | — | @@ -58,11 +58,17 @@ |
59 | 59 | '<input id="wpUploadFile" type="file" style="display: inline;" name="wpUploadFile" size="15"/><br>' + |
60 | 60 | |
61 | 61 | '<label for="wpDestFile">' +gM('mwe-destfilename') + '</label><br>'+ |
62 | | - '<input type="text" id="wpDestFile" name="wpDestFile" size="30" /><br>'+ |
| 62 | + '<input id="wpDestFile" type="text" id="wpDestFile" name="wpDestFile" size="30" /><br>'+ |
63 | 63 | |
64 | 64 | '<label for="wpUploadDescription">' + gM('mwe-summary') + ':</label><br>' + |
65 | | - '<textarea cols="30" rows="3" name="wpUploadDescription" tabindex="3"/><br>'+ |
66 | | - |
| 65 | + '<textarea id="wpUploadDescription" cols="30" rows="3" name="wpUploadDescription" tabindex="3"/><br>'+ |
| 66 | + |
| 67 | + '<input type="checkbox" value="true" id="wpWatchthis" name="watch" tabindex="7"/>'+ |
| 68 | + '<label for="wpWatchthis">Watch this file</label>'+ |
| 69 | + |
| 70 | + '<input type="checkbox" value="true" id="wpIgnoreWarning" name="ignorewarnings" tabindex="8"/>'+ |
| 71 | + '<label for="wpIgnoreWarning">Ignore any warnings</label></br>'+ |
| 72 | + |
67 | 73 | '<div id="wpDestFile-warning"></div>' + |
68 | 74 | '<div style="clear:both;"></div>' + |
69 | 75 | |
— | — | @@ -89,7 +95,7 @@ |
90 | 96 | }); |
91 | 97 | //do destination fill: |
92 | 98 | //@@should integrate with doDestinationFill on upload page |
93 | | - $j("#suf-upload [name='wpUploadFile']").change(function(){ |
| 99 | + $j("#wpUploadFile").change(function(){ |
94 | 100 | var path = $j(this).val(); |
95 | 101 | // Find trailing part |
96 | 102 | var slash = path.lastIndexOf('/'); |
— | — | @@ -104,17 +110,17 @@ |
105 | 111 | } |
106 | 112 | fname = fname.charAt(0).toUpperCase().concat(fname.substring(1,10000)).replace(/ /g, '_'); |
107 | 113 | // Output result |
108 | | - $j("#suf-upload [name='wpDestFile']").val( fname ); |
| 114 | + $j("#wpDestFile").val( fname ); |
109 | 115 | //do destination check |
110 | | - $j("#suf-upload [name='wpDestFile']").doDestCheck({ |
| 116 | + $j("#wpDestFile").doDestCheck({ |
111 | 117 | 'warn_target':'#wpDestFile-warning' |
112 | 118 | }); |
113 | 119 | }); |
114 | 120 | |
115 | 121 | |
116 | 122 | //do destination check: |
117 | | - $j("[name='wpDestFile']").change(function(){ |
118 | | - $j(this).doDestCheck({ |
| 123 | + $j("#wpDestFile").change(function(){ |
| 124 | + $j("#wpDestFile").doDestCheck({ |
119 | 125 | 'warn_target':'#wpDestFile-warning' |
120 | 126 | }); |
121 | 127 | }); |
— | — | @@ -130,7 +136,7 @@ |
131 | 137 | 'form_rewrite': true, |
132 | 138 | 'target_edit_from' : '#suf-upload', |
133 | 139 | 'new_source_cb' : function( orgFilename, oggName ){ |
134 | | - $j("#suf-upload [name='wpDestFile']").val( oggName ).doDestCheck({ |
| 140 | + $j("#wpDestFile").val( oggName ).doDestCheck({ |
135 | 141 | warn_target: "#wpDestFile-warning" |
136 | 142 | }); |
137 | 143 | }, |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js |
— | — | @@ -236,13 +236,13 @@ |
237 | 237 | //reset the done with action flag: |
238 | 238 | _this.action_done = false; |
239 | 239 | |
240 | | - js_log('run editForm submit()'); |
241 | | - var tmpAryData = $j('#mw-upload-form' ).serializeArray(); |
| 240 | + /*js_log('run editForm submit()'); |
| 241 | + var tmpAryData = $j(_this.editForm).serializeArray(); |
242 | 242 | for(var i=0; i < tmpAryData.length; i++){ |
243 | 243 | if( tmpAryData[i]['name'] ) |
244 | 244 | js_log('name: ' + tmpAryData[i]['name'] + ' = ' + tmpAryData[i]['value']); |
245 | | - } |
246 | | - $j('#mw-upload-form').submit(); |
| 245 | + }*/ |
| 246 | + $j(_this.editForm).submit(); |
247 | 247 | |
248 | 248 | return false; |
249 | 249 | }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){ |
— | — | @@ -568,7 +568,7 @@ |
569 | 569 | js_log('ignorewarning req:') |
570 | 570 | //re-inciate the upload proccess |
571 | 571 | $j('#wpIgnoreWarning').attr('checked', true); |
572 | | - $j( '#mw-upload-form' ).submit(); |
| 572 | + $j( _this.editForm ).submit(); |
573 | 573 | }; |
574 | 574 | bObj[ gM('mwe-return-to-form') ] = function(){ |
575 | 575 | $j(this).dialog('close'); |
— | — | @@ -608,7 +608,8 @@ |
609 | 609 | //close up shop: |
610 | 610 | $j('#upProgressDialog').dialog('close'); |
611 | 611 | //call the callback: |
612 | | - _this.done_upload_cb( url ); |
| 612 | + _this.done_upload_cb( apiRes.upload ); |
| 613 | + return false; |
613 | 614 | }else{ |
614 | 615 | var bObj = {}; |
615 | 616 | bObj[ gM('mwe-return-to-form')] = function(){ |
— | — | @@ -621,8 +622,8 @@ |
622 | 623 | _this.action_done = true; |
623 | 624 | _this.updateProgressWin( gM('mwe-successfulupload'), gM( 'mwe-upload_done', url), bObj); |
624 | 625 | js_log('apiRes.upload.imageinfo::'+url); |
| 626 | + return true; |
625 | 627 | } |
626 | | - return ; |
627 | 628 | } |
628 | 629 | } |
629 | 630 | }, |