Index: branches/js2-work/phase3/js/mwEmbed/tests/testApiProxy.html |
— | — | @@ -79,27 +79,41 @@ |
80 | 80 | |
81 | 81 | function doFileUpload(){ |
82 | 82 | $j('#file-upload-container').fadeIn( 'slow' ); |
83 | | - $j('#browseTarget').html( mw.loading_spinner() ); |
| 83 | + $j('#browseTarget').loadingSpinner(); |
| 84 | + |
| 85 | + mw.load('AddMedia.firefogg', function(){ |
| 86 | + mw.load( 'ApiProxy', function(){ |
| 87 | + var browserFrame = mw.ApiProxy.browseFile( { |
| 88 | + //Target div to put the iframe browser button: |
| 89 | + 'target' : '#browseTarget', |
84 | 90 | |
85 | | - mw.load( 'ApiProxy', function(){ |
86 | | - var browserFrame = mw.ApiProxy.browseFile( { |
87 | | - 'target' : '#browseTarget', |
88 | | - 'api_url' : remote_api_url, |
89 | | - // File Destination Name change callback: |
90 | | - 'destinationCB' : function( fname ){ |
91 | | - // Update our local target: |
92 | | - $j('#target-fname').val( fname ); |
93 | | - // Run a destination file name check on the remote target |
| 91 | + // Api url to upload to |
| 92 | + 'api_url' : remote_api_url, |
| 93 | + |
| 94 | + // File Destination Name change callback: |
| 95 | + 'selectFileCb' : function( fname ){ |
| 96 | + // Update our local target: |
| 97 | + $j('#target-fname').val( fname ); |
| 98 | + // Run a destination file name check on the remote target |
| 99 | + $j('#target-fname').doDestCheck( { |
| 100 | + 'api_url' : remote_api_url, |
| 101 | + 'warn_target': '#file-warning' |
| 102 | + } ); |
| 103 | + } |
| 104 | + } ); |
| 105 | + |
| 106 | + // Setup doDestCheck on change |
| 107 | + $j('#target-fname').change(function(){ |
94 | 108 | $j('#target-fname').doDestCheck( { |
95 | 109 | 'api_url' : remote_api_url, |
96 | 110 | 'warn_target': '#file-warning' |
97 | | - } ); |
| 111 | + } ); |
| 112 | + }); |
98 | 113 | |
99 | | - } |
100 | | - } ); |
| 114 | + }) |
101 | 115 | }); |
102 | | - |
103 | | -} |
| 116 | +}; |
| 117 | + |
104 | 118 | </script> |
105 | 119 | |
106 | 120 | </head> |
Index: branches/js2-work/phase3/js/mwEmbed/skins/common/images/magnify-clip.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/js2-work/phase3/js/mwEmbed/skins/common/images/magnify-clip.png |
___________________________________________________________________ |
Name: svn:mime-type |
107 | 121 | + application/octet-stream |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js |
— | — | @@ -28,8 +28,9 @@ |
29 | 29 | "mwe-ignorewarning" : "Ignore warning and save file anyway", |
30 | 30 | "mwe-file-thumbnail-no" : "The filename begins with <b><tt>$1<\/tt><\/b>", |
31 | 31 | "mwe-go-to-resource" : "Go to resource page", |
32 | | - "mwe-upload-misc-error" : "Unknown upload error", |
33 | | - "mwe-wgfogg_warning_bad_extension" : "You have selected a file with an unsuported extension (<a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Firefogg#Supported_File_Types\">more information<\/a>)." |
| 32 | + "mwe-upload-misc-error" : "Unknown upload error", |
| 33 | + "mwe-wgfogg_warning_bad_extension" : "You have selected a file with an unsuported extension (<a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Firefogg#Supported_File_Types\">more information<\/a>).", |
| 34 | + "thumbnail-more" : "Enlarge" |
34 | 35 | }); |
35 | 36 | |
36 | 37 | var default_bui_options = { |
— | — | @@ -129,7 +130,7 @@ |
130 | 131 | this.api_url = mw.getLocalApiUrl(); |
131 | 132 | } |
132 | 133 | // Setup the UploadInterface handler |
133 | | - this.interface = mw.UploadInterface.factory( this.interface_type ); |
| 134 | + this.interface = mw.UploadInterface.factory( this.interface_type ); |
134 | 135 | |
135 | 136 | mw.log( "init mvUploadHandler:: " + this.api_url + ' interface: ' + this.interface ); |
136 | 137 | }, |
— | — | @@ -979,8 +980,8 @@ |
980 | 981 | options.api_url = mw.getLocalApiUrl(); |
981 | 982 | } |
982 | 983 | |
983 | | - // Add the wpDestFile-warning row |
984 | | - if ( $j( '#wpDestFile-warning' ).length == 0 ) { |
| 984 | + // Add the wpDestFile-warning row ( if in mediaWiki upload page ) |
| 985 | + if ( $j( options.warn_target ).length == 0 ) { |
985 | 986 | $j( '#mw-htmlform-options tr:last' ) |
986 | 987 | .after( |
987 | 988 | $j('<tr />' ) |
— | — | @@ -995,11 +996,11 @@ |
996 | 997 | |
997 | 998 | // Show the AJAX spinner |
998 | 999 | $j( _this.selector ).after( |
999 | | - $j('<img />') |
| 1000 | + $j('<div />') |
1000 | 1001 | .attr({ |
1001 | | - 'id' : "mw-spinner-wpDestFile", |
1002 | | - 'src' : stylepath + '/common/images/spinner.gif' |
| 1002 | + 'id' : "mw-spinner-wpDestFile", |
1003 | 1003 | }) |
| 1004 | + .loadingSpinner() |
1004 | 1005 | ); |
1005 | 1006 | // Setup the request |
1006 | 1007 | var request = { |
— | — | @@ -1013,7 +1014,7 @@ |
1014 | 1015 | mw.getJSON( options.api_url, request, function( data ) { |
1015 | 1016 | // Remove spinner |
1016 | 1017 | $j( '#mw-spinner-wpDestFile' ).remove(); |
1017 | | - |
| 1018 | + |
1018 | 1019 | if ( !data || !data.query || !data.query.pages ) { |
1019 | 1020 | // Ignore a null result |
1020 | 1021 | return; |
— | — | @@ -1035,7 +1036,7 @@ |
1036 | 1037 | var ntitle = data.query.pages[ page_id ].title |
1037 | 1038 | } |
1038 | 1039 | var img = data.query.pages[ page_id ].imageinfo[0]; |
1039 | | - $j( '#wpDestFile-warning' ).html( |
| 1040 | + $j( options.warn_target ).html( |
1040 | 1041 | gM( 'mwe-fileexists', ntitle ) + |
1041 | 1042 | '<div class="thumb tright">' + |
1042 | 1043 | '<div ' + |
— | — | @@ -1057,8 +1058,8 @@ |
1058 | 1059 | '<div class="magnify">' + |
1059 | 1060 | '<a title="' + gM('thumbnail-more') + '" class="internal" ' + |
1060 | 1061 | 'href="' + img.descriptionurl +'">' + |
1061 | | - '<img width="15" height="11" alt="" ' + |
1062 | | - 'src="' + stylepath + "/common/images/magnify-clip.png\" />" + |
| 1062 | + '<img border="0" width="15" height="11" alt="" ' + |
| 1063 | + 'src="' + mw.getConfig( 'images_path' ) + 'magnify-clip.png" />' + |
1063 | 1064 | '</a>' + |
1064 | 1065 | '</div>' + |
1065 | 1066 | gM( 'mwe-fileexists-thumb' ) + |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js |
— | — | @@ -1,4 +1,5 @@ |
2 | | -/* Firefogg support. |
| 2 | +/** |
| 3 | + * Firefogg support. |
3 | 4 | * autodetects: new upload api or old http POST. |
4 | 5 | */ |
5 | 6 | |
— | — | @@ -45,7 +46,7 @@ |
46 | 47 | 'only_firefogg': false, |
47 | 48 | |
48 | 49 | // Callback which is called when the source name changes |
49 | | - 'new_source_cb': false, |
| 50 | + 'selectFileCb': false, |
50 | 51 | |
51 | 52 | // jQuery selector identifying the target control container or form (can't be left null) |
52 | 53 | 'selector': '', |
— | — | @@ -160,7 +161,7 @@ |
161 | 162 | // Prefix conflicting members with parent_ |
162 | 163 | for ( var i in myBUI ) { |
163 | 164 | if ( this[i] ) { |
164 | | - this['parent_'+ i] = myBUI[i]; |
| 165 | + this[ 'parent_'+ i ] = myBUI[i]; |
165 | 166 | } else { |
166 | 167 | this[i] = myBUI[i]; |
167 | 168 | } |
— | — | @@ -621,8 +622,8 @@ |
622 | 623 | .show(); |
623 | 624 | |
624 | 625 | |
625 | | - // Notify callback new_source_cb |
626 | | - if ( _this.new_source_cb ) { |
| 626 | + // Notify callback selectFileCb |
| 627 | + if ( _this.selectFileCb ) { |
627 | 628 | if ( settings['passthrough'] ) { |
628 | 629 | var fName = _this.fogg.sourceFilename; |
629 | 630 | } else { |
— | — | @@ -633,7 +634,7 @@ |
634 | 635 | _this.fogg.sourceFilename.lastIndexOf( '.' ) ); |
635 | 636 | var fName = oggName + '.' + oggExt; |
636 | 637 | } |
637 | | - _this.new_source_cb( _this.fogg.sourceFilename, fName ); |
| 638 | + _this.selectFileCb( fName ); |
638 | 639 | } |
639 | 640 | }, |
640 | 641 | |
— | — | @@ -1059,7 +1060,7 @@ |
1060 | 1061 | |
1061 | 1062 | |
1062 | 1063 | if ( _this.oldResponseText != response_text ) { |
1063 | | - mw.log( 'new result text:' + response_text + ' state:' + _this.fogg.state ); |
| 1064 | + mw.log( 'Fogg: new result text:' + response_text + ' state:' + _this.fogg.state ); |
1064 | 1065 | _this.oldResponseText = response_text; |
1065 | 1066 | // Parse the response text and check for errors |
1066 | 1067 | try { |
— | — | @@ -1072,8 +1073,8 @@ |
1073 | 1074 | } catch( e ) { |
1074 | 1075 | var apiResult = null; |
1075 | 1076 | } |
1076 | | - } |
1077 | | - |
| 1077 | + } |
| 1078 | + |
1078 | 1079 | //Check for success: |
1079 | 1080 | if( apiResult && _this.isApiSuccess( apiResult ) ){ |
1080 | 1081 | if( _this.processApiResult ( apiResult ) ){ |
— | — | @@ -1144,7 +1145,7 @@ |
1145 | 1146 | * @param {Element} dialogElement Dialog element that was "canceled" |
1146 | 1147 | */ |
1147 | 1148 | onCancel: function( dialogElement ) { |
1148 | | - if ( !this.have_firefogg ) { |
| 1149 | + if ( !this.getFirefogg() ) { |
1149 | 1150 | return this.parent_cancel_action(); |
1150 | 1151 | } |
1151 | 1152 | mw.log( 'firefogg:cancel' ) |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/jquery.simpleUploadForm.js |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | 'enable_chunks' : false, |
149 | 149 | |
150 | 150 | 'form_selector' : '#suf_upload', |
151 | | - 'new_source_cb' : function( orgFilename, oggName ) { |
| 151 | + 'selectFileCb' : function( fileName ) { |
152 | 152 | $j( "#wpDestFile" ).val( oggName ).doDestCheck( { |
153 | 153 | warn_target: "#wpDestFile-warning" |
154 | 154 | } ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js |
— | — | @@ -193,41 +193,64 @@ |
194 | 194 | |
195 | 195 | // Setup the proxy callback to display the upload unhide the iframe upload form |
196 | 196 | proxyCallback = function( iframeData ){ |
197 | | - //hide the loading spinner |
198 | | - $j( options.target ).find('.loading_spinner').fadeOut('fast'); |
199 | | - mw.log("iframe ready callback"); |
200 | | - $j( '#' + iFrameName ).fadeIn( 'fast' ); |
| 197 | + //proccess fileBrowse callbacks:: |
| 198 | + |
| 199 | + // check for basic status "ok" |
| 200 | + if( iframeData['status'] == 'ok' ){ |
| 201 | + // Hide the loading spinner |
| 202 | + $j( options.target ).find('.loading_spinner').fadeOut('fast'); |
| 203 | + mw.log("iframe ready callback"); |
| 204 | + $j( '#' + iFrameName ).fadeIn( 'fast' ); |
| 205 | + } |
| 206 | + // else check for event |
| 207 | + if( iframeData['event'] ){ |
| 208 | + switch( iframeData['event'] ){ |
| 209 | + case 'selectFileCb': |
| 210 | + if( options.selectFileCb ){ |
| 211 | + options.selectFileCb( iframeData['fileName'] ); |
| 212 | + } |
| 213 | + break; |
| 214 | + default: |
| 215 | + mw.log(" Error unreconginzed event " + iframeData['event'] ); |
| 216 | + } |
| 217 | + |
| 218 | + } |
| 219 | + |
| 220 | + |
201 | 221 | } |
202 | 222 | |
203 | 223 | } |
204 | 224 | |
205 | 225 | /** |
206 | 226 | * Api server proxy entry point: |
207 | | - * |
208 | | - * @param {Object} proxyConfig The server side proxy configuration |
209 | | - * @param {Function} callbcak Function to call once server is setup |
210 | | - * |
| 227 | + * validates the server frame request |
| 228 | + * and proccess the request type |
211 | 229 | */ |
212 | | - $.server = function( proxyConfig, callback ) { |
| 230 | + $.server = function() { |
| 231 | + var proxyConfig = mw.getConfig( 'apiProxyConfig' ); |
213 | 232 | // Validate the server request: |
214 | | - if( validateIframeRequest( proxyConfig ) ){ |
215 | | - var clientRequest = getClientRequest(); |
216 | | - |
217 | | - // Inform the client frame that we passed validation |
218 | | - outputResultsFrame( clientRequest.clientFrame, 'nested_ok', { 'state':'ok' } ); |
219 | | - // Process request type |
220 | | - if( clientRequest['browseFile'] ){ |
221 | | - mw.log( "DO BROWSE FILE" ); |
222 | | - serverBrowseFile( proxyConfig ); |
223 | | - return ; |
224 | | - } |
225 | | - // Else do a normal api request : |
226 | | - return doApiRequest(); |
227 | | - } |
| 233 | + if( !validateIframeRequest( proxyConfig ) ){ |
| 234 | + mw.log( "Not a valid iframe request"); |
| 235 | + return false; |
| 236 | + } |
| 237 | + var clientRequest = getClientRequest(); |
| 238 | + |
| 239 | + // Inform the client frame that we passed validation |
| 240 | + sendClientMsg( { 'state':'ok' } ); |
| 241 | + |
| 242 | + // Process request type |
| 243 | + if( clientRequest['browseFile'] ){ |
| 244 | + mw.log( "DO BROWSE FILE" ); |
| 245 | + serverBrowseFile( proxyConfig ); |
| 246 | + return ; |
| 247 | + } |
| 248 | + // Else do a normal api request : |
| 249 | + return doApiRequest(); |
| 250 | + |
228 | 251 | } |
229 | 252 | |
230 | 253 | /** |
231 | | - * Local scoped helper functions: |
| 254 | + * Local scoped helper functions: (works well with closure compiler ) |
232 | 255 | */ |
233 | 256 | |
234 | 257 | /** |
— | — | @@ -337,12 +360,24 @@ |
338 | 361 | |
339 | 362 | mw.log( "Setup server on: " + mw.parseUri( document.URL ).host ); |
340 | 363 | mw.log('Client frame: ' + clientRequest.clientFrame ); |
341 | | - |
342 | | - var clientDomain = mw.parseUri( clientRequest.clientFrame ).host ; |
343 | | - |
| 364 | + |
344 | 365 | /** |
345 | | - * HERE WE CHECK IF THE DOMAIN IS ALLOWED per the proxyConfig |
| 366 | + * HERE WE CHECK IF THE DOMAIN IS ALLOWED per the proxyConfig |
346 | 367 | */ |
| 368 | + return isAllowedClientFrame( clientRequest.clientFrame ); |
| 369 | + |
| 370 | + |
| 371 | + // Not a valid request return false |
| 372 | + } |
| 373 | + |
| 374 | + /** |
| 375 | + * Check if a domain is allowed. |
| 376 | + * @param {Object} clientFrame |
| 377 | + */ |
| 378 | + function isAllowedClientFrame( clientFrame ){ |
| 379 | + var clientDomain = mw.parseUri( clientFrame ).host ; |
| 380 | + // Get the proxy config |
| 381 | + var proxyConfig = mw.getConfig( 'apiProxyConfig' ); |
347 | 382 | // Check master blacklist |
348 | 383 | for ( var i in proxyConfig.master_blacklist ) { |
349 | 384 | if ( clientDomain == proxyConfig.master_blacklist ) { |
— | — | @@ -356,16 +391,13 @@ |
357 | 392 | return true; |
358 | 393 | } |
359 | 394 | } |
360 | | - |
361 | 395 | // FIXME Add in user based approval :: |
362 | 396 | |
363 | 397 | // FIXME offer the user the ability to "approve" requested domain save to |
364 | 398 | // their user preference setup ) |
365 | 399 | |
366 | | - // FIXME grab the users whitelist for our current domain |
367 | | - |
368 | | - // Not a valid request return false |
369 | | - return false; |
| 400 | + // FIXME grab the users whitelist for our current domain |
| 401 | + return false; |
370 | 402 | } |
371 | 403 | |
372 | 404 | /** |
— | — | @@ -437,8 +469,8 @@ |
438 | 470 | $j.post( wgScriptPath + '/api' + wgScriptExtension, |
439 | 471 | clientRequest.request, |
440 | 472 | function( data ) { |
441 | | - // Put it result into nested frame hash string: |
442 | | - outputResultsFrame( clientRequest.clientFrame, 'nested_push', JSON.parse( data ) ); |
| 473 | + // Send the result data to the client |
| 474 | + sendClientMsg( JSON.parse( data ) ); |
443 | 475 | } |
444 | 476 | ); |
445 | 477 | } |
— | — | @@ -451,7 +483,7 @@ |
452 | 484 | function serverBrowseFile( proxyConfig ){ |
453 | 485 | //check for fw ( file width ) |
454 | 486 | if( ! proxyConfig.fileWidth ){ |
455 | | - proxyConfig.fileWidth = 200; |
| 487 | + proxyConfig.fileWidth = 130; |
456 | 488 | } |
457 | 489 | //Build a form with bindings similar to uploadPage.js ( but only the browse button ) |
458 | 490 | $j('body').html( |
— | — | @@ -478,12 +510,6 @@ |
479 | 511 | ) |
480 | 512 | ); |
481 | 513 | |
482 | | - // Local function to call once frame is ready: |
483 | | - function clientFrameReady( status ){ |
484 | | - var clientRequest = getClientRequest(); |
485 | | - // Inform the client frame that we passed validation |
486 | | - outputResultsFrame( clientRequest.clientFrame, 'browse_file', status ); |
487 | | - } |
488 | 514 | |
489 | 515 | // load the mw.upload library with iframe interface (similar to uploadPage.js) |
490 | 516 | |
— | — | @@ -491,53 +517,70 @@ |
492 | 518 | if ( typeof wgEnableFirefogg == 'undefined' ){ |
493 | 519 | wgEnableFirefogg = true; |
494 | 520 | } |
495 | | - |
| 521 | + |
| 522 | + |
| 523 | + var uploadConfig = { |
| 524 | + // Set the interface type |
| 525 | + 'interface_type' : 'iframe', |
| 526 | + |
| 527 | + // Set the select file callback to update clientFrame |
| 528 | + 'selectFileCb' : function( fileName ){ |
| 529 | + sendClientMsg( { |
| 530 | + 'event': 'selectFileCb', |
| 531 | + 'fileName' : fileName |
| 532 | + } ); |
| 533 | + } |
| 534 | + } |
| 535 | + |
496 | 536 | if( wgEnableFirefogg ){ |
497 | 537 | mw.load( 'AddMedia.firefogg', function(){ |
498 | | - $j( '#wpUploadFile' ).firefogg( { |
499 | | - // Set the interface type |
500 | | - 'interface_type' : 'iframe' |
501 | | - }); |
| 538 | + $j( '#wpUploadFile' ).firefogg( uploadConfig ); |
502 | 539 | // Update status |
503 | | - clientFrameReady( { 'firefogg' : 'ok' } ); |
| 540 | + sendClientMsg( {'status':'ok'} ); |
504 | 541 | }); |
505 | 542 | } else { |
506 | 543 | mw.load( 'AddMedia.UploadHandler', function(){ |
507 | | - $j( mwUploadFormSelector ).uploadHandler({ |
508 | | - // Set the interface type |
509 | | - 'interface_type' : 'iframe' |
510 | | - }); |
511 | | - clientFrameReady(); |
| 544 | + $j( 'mw-upload-form' ).uploadHandler( uploadConfig ); |
| 545 | + sendClientMsg( {'status':'ok'} ); |
512 | 546 | }); |
513 | | - } |
514 | | - |
515 | | - |
516 | | - |
517 | | - |
518 | | - |
| 547 | + } |
519 | 548 | }; |
520 | 549 | |
521 | 550 | /** |
522 | 551 | * Outputs the result object to the client domain |
523 | 552 | * |
524 | | - * @param {clientFrame} clientFrame Client frame name |
525 | | - * @param {String} nestName Name of iframe |
526 | | - * @param {resultObj} the result to pass back to the client domain |
| 553 | + * @param {msgObj} msgObj Msg to send to client domain |
527 | 554 | */ |
528 | | - function outputResultsFrame( clientFrame, nestName, resultObj ) { |
529 | | - $j( '#nested_push' ).remove(); |
| 555 | + function sendClientMsg( msgObj ) { |
| 556 | + |
| 557 | + // Get a local refrence to the client request |
| 558 | + var clientFrame = getClientRequest()['clientFrame']; |
| 559 | + |
| 560 | + // Double check that the client is an approved domain before outputing the iframe |
| 561 | + if( ! isAllowedClientFrame ( clientFrame ) ){ |
| 562 | + mw.log( "cant send msg to " + clientFrame ); |
| 563 | + return false; |
| 564 | + } |
| 565 | + var nestName = 'NestedFrame_' + $j('iframe').length; |
| 566 | + |
530 | 567 | // Setup the nested iframe proxy that points back to top domain |
531 | | - // (can use jQuery buildout since we don't need to refrence this frame again) |
| 568 | + // can't use jquery build out because of IE name attribute bug |
532 | 569 | $j( 'body' ).append( |
533 | | - $j('<iframe>').attr({ |
534 | | - 'id' : nestName, |
535 | | - 'name' : nestName, |
536 | | - 'src' : clientFrame + '#' + escape( JSON.stringify( resultObj ) ) |
537 | | - }) |
538 | | - .css({ |
539 | | - 'display': 'none' |
540 | | - }) |
541 | | - ); |
| 570 | + '<iframe ' + |
| 571 | + 'id="' + nestName + '" ' + |
| 572 | + 'name="' + nestName + '" ' + |
| 573 | + 'src="' + clientFrame + '#' + escape( JSON.stringify( msgObj ) ) + '" ' + |
| 574 | + 'style="display:none" ' + |
| 575 | + '></iframe>' |
| 576 | + ); |
| 577 | + |
| 578 | + // After the nested frame is done loading schedule its removal |
| 579 | + $j( '#' + nestName ).get( 0 ).onload = function() { |
| 580 | + // use a settimeout to give time for client frame to propogate update. |
| 581 | + setTimeout( function(){ |
| 582 | + $j('#' + nestName ).remove(); |
| 583 | + }, 10 ); |
| 584 | + } |
542 | 585 | }; |
543 | 586 | |
544 | 587 | } )( window.mw.ApiProxy ); |
Index: branches/js2-work/phase3/js/apiProxyPage.js |
— | — | @@ -24,15 +24,15 @@ |
25 | 25 | |
26 | 26 | // User white_list should also be checked and configured at runtime. |
27 | 27 | mw.ready( function() { |
| 28 | + // Build our configuration from the default and mwApiProxyConfig vars |
| 29 | + mwApiProxyConfig = $j.extend( true, mwApiProxyDefaultConfig, mwApiProxyConfig ); |
| 30 | + mw.setConfig( 'apiProxyConfig', mwApiProxyConfig); |
| 31 | + |
28 | 32 | //Do a setTimeout to 0 to call after other zero delay async events |
29 | 33 | // ( once everyone is doing buildout withthin mwsetup priror to .ready this won't be needed. ) |
30 | | - mw.load( 'ApiProxy', function(){ |
31 | | - |
| 34 | + mw.load( 'ApiProxy', function(){ |
32 | 35 | //Clear out the page content ( not needed for iframe proxy ) |
33 | 36 | $j( 'body' ).html( '' ); |
34 | | - |
35 | | - // Build our configuration from the default and mwApiProxyConfig vars |
36 | | - mwApiProxyConfig = $j.extend( true, mwApiProxyDefaultConfig, mwApiProxyConfig ); |
37 | | - mw.ApiProxy.server( mwApiProxyConfig ); |
| 37 | + mw.ApiProxy.server(); |
38 | 38 | }); |
39 | 39 | } ); |
Index: branches/js2-work/phase3/js/uploadPage.js |
— | — | @@ -28,8 +28,10 @@ |
29 | 29 | 'interface_type' : 'dialog', |
30 | 30 | |
31 | 31 | 'form_selector': mwUploadFormSelector, |
32 | | - 'new_source_cb': function( orgFilename, oggName ) { |
33 | | - $j( '#wpDestFile' ).val( oggName ); |
| 32 | + |
| 33 | + // Set the select file callback: |
| 34 | + 'selectFileCb': function( fileName ) { |
| 35 | + $j( '#wpDestFile' ).val( fileName ); |
34 | 36 | $j( '#wpDestFile' ).doDestCheck( { |
35 | 37 | 'warn_target': '#wpDestFile-warning' |
36 | 38 | } ); |