From: Michael Dale Date: Sat, 15 Aug 2009 23:27:54 +0000 (+0000) Subject: * msg updates X-Git-Tag: 1.31.0-rc.0~40281 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=51c9bdb0424cd7e0d9776c244f53202cfa88f5cf;p=lhc%2Fweb%2Fwiklou.git * msg updates * firefogg updates for add-media-wizard usage * more support for simpleUploadFrom usage in add-media-wizard * some header updates --- diff --git a/js2/editPage.js b/js2/editPage.js index d9e90cb973..e7055ba053 100644 --- a/js2/editPage.js +++ b/js2/editPage.js @@ -32,8 +32,8 @@ var mwEditPageHelper = { ); //add to new toolbar (need to use api) - //$j('[rel=insert] .tool-file').addMediaWiz( - // mwAddMediaConfig - //); + /*$j('[rel=insert] tool-file').addMediaWiz( + mwAddMediaConfig + );*/ } } diff --git a/js2/mwApiProxy.html b/js2/mwApiProxy.html new file mode 100644 index 0000000000..7d66d13fc9 --- /dev/null +++ b/js2/mwApiProxy.html @@ -0,0 +1,31 @@ + + + + Javascript Api Proxy + + + + +

This file proxies api and html output for source domains:

+
+ + + + diff --git a/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js b/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js index 9a8681e239..69ee3bbb9b 100644 --- a/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js +++ b/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js @@ -31,6 +31,7 @@ loadGM({ "ignorewarning" : "Ignore warning and save file anyway", "file-thumbnail-no" : "The filename begins with $1", "go-to-resource" : "Go to Resource Page", + "upload-misc-error" : "Unknown upload error", "wgfogg_waring_bad_extension" : "You have selected a file with an unsuported extension (more information).", @@ -696,7 +697,7 @@ mvBaseUploadInterface.prototype = { }; return cancelBtn; }, - cancel_action:function(dlElm){ + cancel_action : function( dlElm ){ //confirm: if( confirm( gM('mv-cancel-confim') )){ //@@todo (cancel the encode / upload) diff --git a/js2/mwEmbed/libAddMedia/mvFirefogg.js b/js2/mwEmbed/libAddMedia/mvFirefogg.js index d5c2801fca..6f142dd062 100644 --- a/js2/mwEmbed/libAddMedia/mvFirefogg.js +++ b/js2/mwEmbed/libAddMedia/mvFirefogg.js @@ -25,7 +25,7 @@ var firefogg_install_links = { var default_firefogg_options = { //what to do when finished uploading - 'upload_done_action':'redirect', + 'done_upload_cb':false, //if firefoog is enabled 'fogg_enabled':false, //the api url to upload to @@ -476,7 +476,8 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface get_mw_token( 'File:'+ _this.formData['wpDestFile'], _this.api_url, - function( eToken ){ + function( eToken ){ + if(eToken==) _this.etoken = eToken; _this.doChunkWithFormData(); } @@ -631,9 +632,18 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface buttons[gM('go-to-resource')] = function(){ window.location = _this.fogg.resultUrl; } - var go_to_url_txt = gM('go-to-resource'); - //should have an json result: - _this.updateProgressWin( gM('successfulupload'), gM( 'mv_upload_done', _this.fogg.resultUrl),buttons); + var go_to_url_txt = gM('go-to-resource'); + if( typeof _this.done_upload_cb == 'function' ){ + //if done action return 'true' + if( _this.done_upload_cb() ){ + //update status + _this.updateProgressWin( gM('successfulupload'), gM( 'mv_upload_done', _this.fogg.resultUrl),buttons); + }else{ + //if done action returns 'false' //close progress window + this.action_done = true; + $j('#upProgressDialog').dialog('close'); + } + } }else{ //done state with error? ..not really possible given how firefogg works js_log(" upload done, in chunks mode, but no resultUrl!"); @@ -682,14 +692,14 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface _this.updateProgressWin( gM('mv_upload_completed'), result_txt ); if( result_page && result_page.toLowerCase().indexOf( sstring.toLowerCase() ) != -1){ - js_log( 'upload done got redirect found: ' + sstring + ' r:' + _this.upload_done_action ); - if( _this.upload_done_action == 'redirect' ){ + js_log( 'upload done got redirect found: ' + sstring + ' r:' + _this.done_upload_cb ); + if( _this.done_upload_cb == 'redirect' ){ $j( '#dlbox-centered' ).html( '

Upload Completed:

' + result_txt + '
' + form_txt); window.location = wgArticlePath.replace( /\$1/, 'File:' + _this.formData['wpDestFile'] ); }else{ //check if the add_done_action is a callback: - if( typeof _this.upload_done_action == 'function' ) - _this.upload_done_action(); + if( typeof _this.done_upload_cb == 'function' ) + _this.done_upload_cb(); } }else{ //js_log( 'upload page error: did not find: ' +sstring + ' in ' + "\n" + result_page ); diff --git a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js index 5da7e3449a..45329ade67 100644 --- a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js +++ b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js @@ -577,18 +577,25 @@ remoteSearchDriver.prototype = { $j('#tab-upload').html( gM('rsd_config_error', 'bad_api_url') ); return false; } - //output the form - mvJsLoader.doLoad(['$j.fn.simpleUploadForm'],function(){ - //set the form action based on domain: - if( parseUri( document.URL ).host == parseUri( _this.upload_api_target ).host ){ + //output the form + //set the form action based on domain: + if( parseUri( document.URL ).host == parseUri( _this.upload_api_target ).host ){ + mvJsLoader.doLoad(['$j.fn.simpleUploadForm'],function(){ //deal with the api form upload form directly: $j('#tab-upload').simpleUploadForm({ - "api_target" : _this.upload_api_target + "api_target" : _this.upload_api_target , + "ondone_cb" : function( resultData ){ + var cat = resultData; + debugger; + return false; + } }) - }else{ - //setup the proxy - } - }); + }); + }else{ + //setup the proxy + js_log('do proxy:: ' + parseUri( _this.upload_api_target ).host); + $j('#tab-upload').html('proxy upload not yet ready'); + } }, runSearch: function(){ js_log("f:runSearch::" + this.disp_item); @@ -1352,8 +1359,7 @@ remoteSearchDriver.prototype = { mvJsLoader.doLoad([ 'mvBaseUploadInterface', '$j.ui.progressbar' - ],function(){ - + ],function(){ //initicate a download similar to url copy: myUp = new mvBaseUploadInterface({ 'api_url' : _this.local_wiki_api_url, @@ -1363,7 +1369,9 @@ remoteSearchDriver.prototype = { //close up the rsd_resource_import $j('#rsd_resource_import').remove(); //run the parent callback: - cir_callback(); + cir_callback(); + //return false to avoid BaseUploadInterface done actions + return false; } }); //set the edit token if we have it handy diff --git a/js2/mwEmbed/libAddMedia/simpleUploadForm.js b/js2/mwEmbed/libAddMedia/simpleUploadForm.js index 7ea8a0df26..3094599e9e 100644 --- a/js2/mwEmbed/libAddMedia/simpleUploadForm.js +++ b/js2/mwEmbed/libAddMedia/simpleUploadForm.js @@ -11,13 +11,15 @@ loadGM({ "licence_cc-by-sa" : "Creative Commons Share Alike (3.0)", "upload" : "Upload File", "destfilename" : "Destination filename:", - "summary" : "Summary" + "summary" : "Summary", + "error_not_loggedin" : "You don't appear to be logged in or don't have upload privlages." }); var default_form_options = { 'enable_fogg' : true, 'licence_options':['cc-by-sa'], - 'api_target' : false + 'api_target' : false, + 'ondone_cb' : null }; (function($) { @@ -32,55 +34,66 @@ var default_form_options = { if(!opt.api_target){ $(this.selector).html('Error: Missing api target'); return false; - } - + } //@@todo this is just a proof of concept //much todo to improved this web form - var o = '
'+ - '
' + - '
'+ - '
' + - '
'+ - '
'+ - '
' + - '