Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js |
— | — | @@ -442,7 +442,7 @@ |
443 | 443 | //check what mode to use firefogg in: |
444 | 444 | if( _this.upload_mode == 'post' ){ |
445 | 445 | _this.doEncode(); |
446 | | - }else if( _this.upload_mode == 'api' && _this.chunks_supported){ //if api mode and chunks supported do chunkUpload |
| 446 | + }else if( _this.upload_mode == 'api' ){ //if api mode and chunks supported do chunkUpload |
447 | 447 | _this.doChunkUpload(); |
448 | 448 | }else{ |
449 | 449 | js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
— | — | @@ -450,36 +450,38 @@ |
451 | 451 | }, |
452 | 452 | //doChunkUpload does both uploading and encoding at the same time and uploads one meg chunks as they are ready |
453 | 453 | doChunkUpload : function(){ |
454 | | - js_log('doChunkUpload::'); |
| 454 | + js_log('firefogg::doChunkUpload'); |
455 | 455 | var _this = this; |
456 | 456 | _this.action_done = false; |
| 457 | + |
457 | 458 | //extension should already be ogg but since its user editable, |
458 | 459 | //check again |
459 | 460 | //we are transcoding so we know it will be an ogg |
460 | 461 | //(should not be done for passthrough mode) |
461 | | - var sf = _this.formData['wpDestFile']; |
| 462 | + var sf = _this.formData['filename']; |
462 | 463 | var ext = ''; |
463 | 464 | if( sf.lastIndexOf('.') != -1){ |
464 | 465 | ext = sf.substring( sf.lastIndexOf('.') ).toLowerCase(); |
465 | 466 | } |
466 | | - if(!_this.encoder_settings['passthrough'] && $j.inArray(ext.substr(1), _this.ogg_extensions) == -1 ){ |
| 467 | + if( !_this.encoder_settings['passthrough'] && $j.inArray(ext.substr(1), _this.ogg_extensions) == -1 ){ |
467 | 468 | var extreg = new RegExp(ext + '$', 'i'); |
468 | | - _this.formData['wpDestFile'] = sf.replace(extreg, '.ogg'); |
| 469 | + _this.formData['filename'] = sf.replace(extreg, '.ogg'); |
469 | 470 | } |
470 | 471 | //add chunk response hook to build the resultURL when uploading chunks |
471 | 472 | |
472 | 473 | //check for editToken: |
473 | 474 | if(!this.etoken){ |
474 | | - if( _this.formData['wpEditToken']){ |
475 | | - _this.etoken = _this.formData['wpEditToken']; |
| 475 | + js_log('missing token try ' + _this.formData['token']); |
| 476 | + if( _this.formData['token']){ |
| 477 | + _this.etoken = _this.formData['token']; |
476 | 478 | _this.doChunkWithFormData(); |
477 | 479 | }else{ |
478 | 480 | get_mw_token( |
479 | | - 'File:'+ _this.formData['wpDestFile'], |
| 481 | + 'File:'+ _this.formData['filename'], |
480 | 482 | _this.api_url, |
481 | 483 | function( eToken ){ |
482 | 484 | if( !eToken || eToken == '+\\' ){ |
483 | | - _this.updateProgressWin(gM('fogg-badtoken'), gM('fogg-badtoken')); |
| 485 | + _this.updateProgressWin( gM('fogg-badtoken'), gM('fogg-badtoken') ); |
484 | 486 | return false; |
485 | 487 | } |
486 | 488 | _this.etoken = eToken; |
— | — | @@ -488,29 +490,30 @@ |
489 | 491 | ); |
490 | 492 | } |
491 | 493 | }else{ |
| 494 | + js_log('we already have token: ' + this.etoken); |
492 | 495 | _this.doChunkWithFormData(); |
493 | 496 | } |
494 | 497 | }, |
495 | 498 | doChunkWithFormData:function(){ |
496 | 499 | var _this = this; |
497 | | - js_log("doChunkWithFormData::" + _this.etoken); |
| 500 | + js_log("firefogg::doChunkWithFormData" + _this.etoken); |
498 | 501 | //build the api url: |
499 | 502 | var aReq ={ |
500 | 503 | 'action': 'upload', |
501 | 504 | 'format': 'json', |
502 | | - 'filename': _this.formData['wpDestFile'], |
503 | | - 'comment': _this.formData['wpUploadDescription'], |
| 505 | + 'filename': _this.formData['filename'], |
| 506 | + 'comment': _this.formData['comment'], |
504 | 507 | 'enablechunks': 'true' |
505 | 508 | }; |
506 | 509 | |
507 | 510 | if( _this.etoken ) |
508 | 511 | aReq['token'] = this.etoken; |
509 | 512 | |
510 | | - if( _this.formData['wpWatchthis'] ) |
511 | | - aReq['watch'] = _this.formData['wpWatchthis']; |
| 513 | + if( _this.formData['watch'] ) |
| 514 | + aReq['watch'] = _this.formData['watch']; |
512 | 515 | |
513 | | - if( _this.formData['wpIgnoreWarning'] ) |
514 | | - aReq['ignorewarnings'] = _this.formData['wpIgnoreWarning']; |
| 516 | + if( _this.formData['ignorewarnings'] ) |
| 517 | + aReq['ignorewarnings'] = _this.formData['ignorewarnings']; |
515 | 518 | |
516 | 519 | js_log('do fogg upload/encode call: '+ _this.api_url + ' :: ' + JSON.stringify( aReq ) ); |
517 | 520 | js_log('foggEncode: '+ JSON.stringify( _this.encoder_settings ) ); |
— | — | @@ -562,7 +565,7 @@ |
563 | 566 | _this.formData[ 'wpSourceType' ] = 'upload'; |
564 | 567 | _this.formData[ 'action' ] = 'submit'; |
565 | 568 | //wpUploadFile is set by firefogg |
566 | | - delete _this.formData[ 'wpUploadFile' ]; |
| 569 | + delete _this.formData[ 'file' ]; |
567 | 570 | |
568 | 571 | _this.fogg.post( _this.editForm.action, 'wpUploadFile', JSON.stringify( _this.formData ) ); |
569 | 572 | //update upload status: |
— | — | @@ -606,7 +609,7 @@ |
607 | 610 | var apiResult = eval( response_text ); |
608 | 611 | }catch(e){ |
609 | 612 | var apiResult = null; |
610 | | - } |
| 613 | + } |
611 | 614 | } |
612 | 615 | if(apiResult && _this.apiUpdateErrorCheck( apiResult ) === false){ |
613 | 616 | //stop status update we have an error |
— | — | @@ -621,14 +624,13 @@ |
622 | 625 | //loop to get new status if still uploading (could also be encoding if we are in chunk upload mode) |
623 | 626 | if( _this.fogg.state == 'encoding' || _this.fogg.state == 'uploading') { |
624 | 627 | setTimeout(uploadStatus, 100); |
625 | | - |
626 | 628 | }//check upload state |
627 | 629 | else if( _this.fogg.state == 'upload done' || |
628 | 630 | _this.fogg.state == 'done' || |
629 | 631 | _this.fogg.state == 'encoding done' ) { |
630 | 632 | //if in "post" upload mode read the html response (should be depricated): |
631 | 633 | if( _this.upload_mode == 'api' ){ |
632 | | - if( apiResult.resultUrl ){ |
| 634 | + if( apiResult && apiResult.resultUrl ){ |
633 | 635 | var buttons ={}; |
634 | 636 | buttons[gM('mwe-go-to-resource')] = function(){ |
635 | 637 | window.location = apiResult.resultUrl; |
— | — | @@ -686,10 +688,10 @@ |
687 | 689 | procPageResponse:function( result_page ){ |
688 | 690 | var _this = this; |
689 | 691 | js_log('f:procPageResponse'); |
690 | | - var sstring = 'var wgTitle = "' + this.formData['wpDestFile'].replace('_',' '); |
| 692 | + var sstring = 'var wgTitle = "' + this.formData['filename'].replace('_',' '); |
691 | 693 | |
692 | 694 | if(wgArticlePath){ |
693 | | - var result_txt = gM('mwe-upload_done', wgArticlePath.replace(/\$1/, 'File:' + _this.formData['wpDestFile'] ) ); |
| 695 | + var result_txt = gM('mwe-upload_done', wgArticlePath.replace(/\$1/, 'File:' + _this.formData['filename'] ) ); |
694 | 696 | }else{ |
695 | 697 | result_txt = 'File has uploaded but api "done" URL was provided. Check the log for result page output'; |
696 | 698 | } |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -34,10 +34,8 @@ |
35 | 35 | "mwe-results_from" : "Results from <a href=\"$1\" target=\"_new\" >$2<\/a>", |
36 | 36 | "mwe-missing_desc_see_source" : "This asset is missing a description. Please see the [$1 orginal source] and help describe it.", |
37 | 37 | "rsd_config_error" : "Add media wizard configuration error: $1", |
38 | | - |
39 | 38 | "mwe-your_recent_uploads" : "Your recent uploads", |
40 | 39 | "mwe-upload_a_file" : "Upload a new file", |
41 | | - |
42 | 40 | "mwe-resource_page_desc" : "Resource page description:", |
43 | 41 | "mwe-edit_resource_desc" : "Edit wiki text resource description:", |
44 | 42 | "mwe-local_resource_title" : "Local resource title:", |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/simpleUploadForm.js |
— | — | @@ -55,10 +55,10 @@ |
56 | 56 | |
57 | 57 | //form name set: |
58 | 58 | '<label for="wpUploadFile">' + gM('mwe-select_file') + '</label><br>'+ |
59 | | - '<input type="file" style="display: inline;" name="wpUploadFile" size="15"/><br>' + |
| 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" name="wpDestFile" size="30" /><br>'+ |
| 62 | + '<input type="text" id="wpDestFile" name="wpDestFile" size="30" /><br>'+ |
63 | 63 | |
64 | 64 | '<label for="wpUploadDescription">' + gM('mwe-summary') + ':</label><br>' + |
65 | 65 | '<textarea cols="30" rows="3" name="wpUploadDescription" tabindex="3"/><br>'+ |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | |
126 | 126 | //set up the binding per the config |
127 | 127 | if( opt.enable_fogg ){ |
128 | | - $j("#suf-upload [name='wpUploadFile']").firefogg({ |
| 128 | + $j("#wpUploadFile").firefogg({ |
129 | 129 | //an api url (we won't submit directly to action of the form) |
130 | 130 | 'api_url' : opt.api_target, |
131 | 131 | 'form_rewrite': true, |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js |
— | — | @@ -39,8 +39,8 @@ |
40 | 40 | 'done_upload_cb': null, |
41 | 41 | 'target_edit_from':null, |
42 | 42 | |
43 | | - //upload_mode can be 'post', 'api' or 'autodetect'. (autodetect issues an api call) |
44 | | - 'upload_mode': 'autodetect' |
| 43 | + //default upload mode is 'api' but if no api_url will try tp post |
| 44 | + 'upload_mode': 'api' |
45 | 45 | |
46 | 46 | } |
47 | 47 | var mvBaseUploadInterface = function( iObj ){ |
— | — | @@ -72,13 +72,19 @@ |
73 | 73 | //set up the local pointer to the edit form: |
74 | 74 | _this.editForm = _this.getEditForm(); |
75 | 75 | if( _this.editForm ){ |
| 76 | + |
| 77 | + //if in api re-map the upload form to api: (we have to do this BEFORE the users selects a file) |
| 78 | + if(_this.upload_mode == 'api'){ |
| 79 | + _this.doRemapFormToApi(); |
| 80 | + } |
| 81 | + |
76 | 82 | //set up the org_onsubmit if not set: |
77 | 83 | if( typeof( _this.org_onsubmit ) == 'undefined' && _this.editForm.onsubmit ) |
78 | 84 | _this.org_onsubmit = _this.editForm.onsubmit; |
79 | 85 | |
80 | 86 | //set up the submit action: |
81 | 87 | $j( _this.editForm ).submit( function(){ |
82 | | - js_log('j.onSubmit'); |
| 88 | + js_log('setupForm.onSubmit:'); |
83 | 89 | //run the original onsubmit (if not run yet set flag to avoid excessive chaining ) |
84 | 90 | if( typeof( _this.org_onsubmit ) == 'function' ){ |
85 | 91 | if( ! _this.org_onsubmit() ){ |
— | — | @@ -92,6 +98,7 @@ |
93 | 99 | return true; |
94 | 100 | } |
95 | 101 | //get the input form data in flat json: |
| 102 | + js_log('update formData::'); |
96 | 103 | var tmpAryData = $j( _this.editForm ).serializeArray(); |
97 | 104 | for(var i=0; i < tmpAryData.length; i++){ |
98 | 105 | if( tmpAryData[i]['name'] ) |
— | — | @@ -105,10 +112,10 @@ |
106 | 113 | //for some unknown reason we have to drop down the #p-search z-index: |
107 | 114 | $j('#p-search').css('z-index', 1); |
108 | 115 | |
109 | | - //select upload mode: |
| 116 | + //select upload mode: |
110 | 117 | _this.detectUploadMode(); |
111 | 118 | }catch(e){ |
112 | | - |
| 119 | + js_log('::error in dispProgressOverlay or detectUploadMode'); |
113 | 120 | } |
114 | 121 | |
115 | 122 | //don't submit the form we will do the post in ajax |
— | — | @@ -119,14 +126,15 @@ |
120 | 127 | }, |
121 | 128 | detectUploadMode:function( callback ){ |
122 | 129 | var _this = this; |
| 130 | + js_log('detectUploadMode::' + _this.upload_mode); |
123 | 131 | //check the upload mode: |
124 | 132 | if( _this.upload_mode == 'autodetect' ){ |
125 | 133 | js_log('detectUploadMode::' + _this.upload_mode + ' api:' + _this.api_url); |
126 | 134 | if( ! _this.api_url ) |
127 | 135 | return js_error( 'Error: can\'t autodetect mode without api url' ); |
128 | 136 | do_api_req( { |
129 | | - 'data':{ 'action':'paraminfo','modules':'upload' }, |
130 | | - 'url' :_this.api_url |
| 137 | + 'data': { 'action' : 'paraminfo', 'modules' : 'upload' }, |
| 138 | + 'url' : _this.api_url |
131 | 139 | }, function(data){ |
132 | 140 | if( typeof data.paraminfo == 'undefined' || typeof data.paraminfo.modules == 'undefined' ) |
133 | 141 | return js_error( 'Error: bad api results' ); |
— | — | @@ -153,6 +161,37 @@ |
154 | 162 | _this.doUploadSwitch(); |
155 | 163 | } |
156 | 164 | }, |
| 165 | + //@@NOTE this could probably be depricated to just have a special:upload page that uses api keys? |
| 166 | + // or maybe its usefull to seperate js and non-js submits |
| 167 | + doRemapFormToApi:function(){ |
| 168 | + var _this = this; |
| 169 | + if( !_this.api_url ) |
| 170 | + return false; |
| 171 | + |
| 172 | + //add the action api |
| 173 | + $j(_this.editForm).attr('action', _this.api_url); |
| 174 | + |
| 175 | + //add api url |
| 176 | + //add api action: |
| 177 | + if( $j(_this.editForm).find("[name='action']").length == 0) |
| 178 | + $j(_this.editForm).append('<input type="hidden" name="action" value="upload">'); |
| 179 | + |
| 180 | + //add json format |
| 181 | + if( $j(_this.editForm).find("[name='format']").length == 0) |
| 182 | + $j(_this.editForm).append('<input type="hidden" name="format" value="jsonfm">'); |
| 183 | + |
| 184 | + //map a new hidden form |
| 185 | + $j(_this.editForm).find("[name='wpUploadFile']").attr('name', 'file'); |
| 186 | + $j(_this.editForm).find("[name='wpDestFile']").attr('name', 'filename'); |
| 187 | + $j(_this.editForm).find("[name='wpUploadDescription']").attr('name', 'comment'); |
| 188 | + $j(_this.editForm).find("[name='wpEditToken']").attr('name', 'token'); |
| 189 | + $j(_this.editForm).find("[name='wpIgnoreWarning']").attr('name', 'ignorewarnings'); |
| 190 | + $j(_this.editForm).find("[name='wpWatchthis']").attr('name', 'watch'); |
| 191 | + |
| 192 | + //update the status to 100% progress bar (no status in iframe submit) |
| 193 | + $j('#up-progressbar' ).progressbar( 'value', parseInt( 100 ) ); |
| 194 | + $j('#up-status-container').html( gM('mwe-upload-in-progress') ); |
| 195 | + }, |
157 | 196 | doUploadSwitch:function(){ |
158 | 197 | var _this = this; |
159 | 198 | js_log('mvUPload:doUploadSwitch():' + _this.upload_mode); |
— | — | @@ -165,61 +204,46 @@ |
166 | 205 | ); |
167 | 206 | //do normal post |
168 | 207 | _this.form_post_override = true; |
| 208 | + js_log('doUploadSwitch:: submit call'); |
169 | 209 | //do the submit : |
170 | 210 | _this.editForm.submit(); |
171 | 211 | }else if( |
172 | | - _this.upload_mode=='api' && |
| 212 | + _this.upload_mode == 'api' && |
173 | 213 | ( $j('#wpSourceTypeFile').length == 0 || $j('#wpSourceTypeFile').get(0).checked ) |
174 | 214 | ){ |
175 | 215 | //@@TODO check for sendAsBinnary to support firefox 3.5 progress |
176 | 216 | |
177 | | - //set the form target to iframe target: |
178 | | - _this.iframeId = 'f_' + ($j('iframe').length + 1); |
179 | | - $j(_this.editForm).attr('target', _this.iframeId); |
180 | | - |
| 217 | + //set the form target to iframe target: |
| 218 | + _this.iframeId = 'f_' + ($j('iframe').length + 1); |
181 | 219 | //add the iframe |
182 | 220 | $j("body").append('<iframe src="javascript:false;" id="' + _this.iframeId + '" ' + |
183 | | - 'name="' + _this.iframeId + '" style="display:none;" ></iframe>'); |
| 221 | + 'name="' + _this.iframeId + '" style="display:none;" ></iframe>'); |
| 222 | + $j(_this.editForm).attr('target', _this.iframeId); |
184 | 223 | |
185 | 224 | //set up the done binding |
186 | 225 | $j('#' + _this.iframeId).load(function(){ |
187 | 226 | _this.proccessIframeResult( $j(this).get(0) ); |
188 | 227 | }); |
189 | | - |
190 | | - //set the editForm iframe target |
191 | | - //$j(_this.editForm).attr('target', id); |
192 | | - |
193 | 228 | //set the action to the api url: |
194 | 229 | $j(_this.editForm).attr('action', _this.api_url ); |
195 | | - //add api action: |
196 | | - if( $j(_this.editForm).find("[name='action']").length == 0) |
197 | | - $j(_this.editForm).append('<input type="hidden" name="action" value="upload">'); |
198 | | - |
199 | | - //add json format |
200 | | - if( $j(_this.editForm).find("[name='format']").length == 0) |
201 | | - $j(_this.editForm).append('<input type="hidden" name="format" value="jsonfm">'); |
202 | | - |
203 | | - //map the form vars to api vars: |
204 | | - $j(_this.editForm).find("[name='wpUploadFile']").attr('name', 'file'); |
205 | | - $j(_this.editForm).find("[name='wpDestFile']").attr('name', 'filename'); |
206 | | - $j(_this.editForm).find("[name='wpUploadDescription']").attr('name', 'comment'); |
207 | | - $j(_this.editForm).find("[name='wpEditToken']").attr('name', 'token'); |
208 | | - $j(_this.editForm).find("[name='wpIgnoreWarning']").attr('name', 'ignorewarnings'); |
209 | | - $j(_this.editForm).find("[name='wpWatchthis']").attr('name', 'watch'); |
210 | | - |
211 | | - //update the status to 100% progress bar (no status in iframe submit) |
212 | | - $j('#up-progressbar' ).progressbar('value', parseInt( 100 ) ); |
213 | | - $j('#up-status-container').html( gM('mwe-upload-in-progress') ); |
214 | | - |
215 | | - js_log('do iframe form submit to: ' + $j(_this.editForm).attr('target')); |
216 | | - |
| 230 | + |
| 231 | + js_log('do iframe form submit to: ' + $j(_this.editForm).attr('target') |
| 232 | + + ' destName:' + $j(_this.editForm).find("[name='filename']").val() ); |
| 233 | + |
| 234 | + |
217 | 235 | //do post override |
218 | 236 | _this.form_post_override = true; |
219 | 237 | //reset the done with action flag: |
220 | 238 | _this.action_done = false; |
| 239 | + |
| 240 | + js_log('run editForm submit()'); |
| 241 | + var tmpAryData = $j('#mw-upload-form' ).serializeArray(); |
| 242 | + for(var i=0; i < tmpAryData.length; i++){ |
| 243 | + if( tmpAryData[i]['name'] ) |
| 244 | + js_log('name: ' + tmpAryData[i]['name'] + ' = ' + tmpAryData[i]['value']); |
| 245 | + } |
| 246 | + $j('#mw-upload-form').submit(); |
221 | 247 | |
222 | | - _this.editForm.submit(); |
223 | | - |
224 | 248 | return false; |
225 | 249 | }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){ |
226 | 250 | js_log('doHttpUpload (no form submit) '); |
— | — | @@ -263,6 +287,7 @@ |
264 | 288 | } else if (doc.body){ |
265 | 289 | // get the json str: |
266 | 290 | json_str = $j(doc.body).find('pre').html(); |
| 291 | + js_log('iframe:json::' + json_str + "\nbody:" + $j(doc.body).html() ); |
267 | 292 | //htmlentties |
268 | 293 | if (json_str) { |
269 | 294 | response = window["eval"]("(" +json_str + ")"); |
— | — | @@ -329,14 +354,14 @@ |
330 | 355 | }); |
331 | 356 | }, |
332 | 357 | doAjaxUploadStatus:function() { |
333 | | - var _this = this; |
334 | | - |
| 358 | + var _this = this; |
| 359 | + |
335 | 360 | //set up the progress display for status updates: |
336 | 361 | _this.dispProgressOverlay(); |
337 | 362 | var req = { |
338 | | - 'action' : 'upload', |
339 | | - 'httpstatus' : 'true', |
340 | | - 'sessionkey' : _this.upload_session_key |
| 363 | + 'action' : 'upload', |
| 364 | + 'httpstatus' : 'true', |
| 365 | + 'sessionkey' : _this.upload_session_key |
341 | 366 | }; |
342 | 367 | //add token if present: |
343 | 368 | if(this.etoken) |
— | — | @@ -540,6 +565,7 @@ |
541 | 566 | _this.warnings_sessionkey = apiRes.upload.warnings.sessionkey; |
542 | 567 | var bObj = {}; |
543 | 568 | bObj[ gM('mwe-ignorewarning') ] = function() { |
| 569 | + js_log('ignorewarning req:') |
544 | 570 | //re-inciate the upload proccess |
545 | 571 | $j('#wpIgnoreWarning').attr('checked', true); |
546 | 572 | $j( '#mw-upload-form' ).submit(); |
— | — | @@ -556,7 +582,7 @@ |
557 | 583 | }, |
558 | 584 | processApiResult: function( apiRes ){ |
559 | 585 | var _this = this; |
560 | | - js_log('processApiResult::'); |
| 586 | + js_log('processApiResult::'); |
561 | 587 | //check for upload api error: |
562 | 588 | // {"upload":{"result":"Failure","error":"unknown-error","code":{"status":5,"filtered":"NGC2207%2BIC2163.jpg"}}} |
563 | 589 | if( _this.apiUpdateErrorCheck(apiRes) === false){ |
— | — | @@ -637,6 +663,7 @@ |
638 | 664 | /*update to jQuery.ui progress display type */ |
639 | 665 | dispProgressOverlay:function(){ |
640 | 666 | var _this = this; |
| 667 | + |
641 | 668 | //remove old instance: |
642 | 669 | if($j('#upProgressDialog').length!=0){ |
643 | 670 | $j('#upProgressDialog').dialog( 'destroy' ).remove(); |
— | — | @@ -706,25 +733,27 @@ |
707 | 734 | */ |
708 | 735 | $.fn.doDestCheck = function( opt ){ |
709 | 736 | var _this = this; |
710 | | - var destFile = this.selector; |
| 737 | + js_log('doDestCheck::' + _this.selector); |
| 738 | + |
711 | 739 | //set up option defaults; |
712 | 740 | if(!opt.warn_target) |
713 | 741 | opt.warn_target = '#wpDestFile-warning'; |
714 | 742 | |
715 | 743 | //empty target warn: |
716 | | - $j(opt.warn_target).empty(); |
717 | | - |
718 | | - //show loading |
719 | | - $j(destFile).after('<img id = "mw-spinner-wpDestFile" src ="'+ stylepath + '/common/images/spinner.gif" />'); |
| 744 | + $j( opt.warn_target ).empty(); |
| 745 | + |
| 746 | + //show loading |
| 747 | + $j( _this.selector ).append('<img id="mw-spinner-wpDestFile" src ="'+ stylepath + '/common/images/spinner.gif" />'); |
| 748 | + |
720 | 749 | //try and get a thumb of the current file (check its destination) |
721 | 750 | do_api_req({ |
722 | 751 | 'data':{ |
723 | | - 'titles': 'File:' + $j(destFile).val(),//@@todo we may need a more clever way to get a the filename |
| 752 | + 'titles': 'File:' + $j(_this.selector).val(),//@@todo we may need a more clever way to get a the filename |
724 | 753 | 'prop': 'imageinfo', |
725 | 754 | 'iiprop':'url|mime|size', |
726 | 755 | 'iiurlwidth': 150 |
727 | 756 | } |
728 | | - },function(data){ |
| 757 | + },function(data){ |
729 | 758 | //remove spinner: |
730 | 759 | $j('#mw-spinner-wpDestFile').remove(); |
731 | 760 | if(data && data.query && data.query.pages){ |
Index: trunk/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -842,7 +842,7 @@ |
843 | 843 | var sElm = $j(this.selector).get(0); |
844 | 844 | if(sElm['firefogg']){ |
845 | 845 | if(sElm['firefogg']=='loading'){ |
846 | | - js_log("Error: called firefogg operations on Firefogg selector that is not done loading"); |
| 846 | + js_log("Error: called firefogg operations on Firefogg selector that is not done loading"); |
847 | 847 | return false; |
848 | 848 | } |
849 | 849 | //update properties: |
— | — | @@ -887,7 +887,7 @@ |
888 | 888 | }else{ |
889 | 889 | var myFogg = new mvFirefogg( iObj ); |
890 | 890 | } |
891 | | - if(myFogg){ |
| 891 | + if(myFogg){ |
892 | 892 | myFogg.doRewrite( callback ); |
893 | 893 | var selectorElement = $j( iObj.selector ).get(0); |
894 | 894 | selectorElement['firefogg']=myFogg; |
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js |
— | — | @@ -45,11 +45,11 @@ |
46 | 46 | "mwe-ogg-player-selected" : "(selected)", |
47 | 47 | "mwe-ogg-player-omtkplayer" : "OMTK Flash Vorbis", |
48 | 48 | "mwe-generic_missing_plugin" : "You browser does not appear to support the following playback type: <b>$1<\/b><br \/>Visit the <a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Media_help\">Playback Methods<\/a> page to download a player.<br \/>", |
49 | | - "mwe-for_best_experience" : "For a better video playback experience we recommend: <b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>", |
| 49 | + "mwe-for_best_experience" : "For a better video playback experience we recommend:<br \/><b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>", |
50 | 50 | "mwe-do_not_warn_again" : "Dissmiss for now.", |
51 | 51 | "mwe-playerselect" : "Players", |
52 | 52 | "mwe-read_before_embed" : "Please <a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read This<\/a> before embeding!", |
53 | | - "mwe-embed_site_or_blog" : "Embed on your site or blog", |
| 53 | + "mwe-embed_site_or_blog" : "Embed on your site or blog", |
54 | 54 | "mwe_related_videos" : "Related Videos" |
55 | 55 | }); |
56 | 56 | |
— | — | @@ -1094,14 +1094,14 @@ |
1095 | 1095 | var _this = this; |
1096 | 1096 | js_log('switch video Relational' ); |
1097 | 1097 | var reqObj = { |
1098 | | - 'action':'query', |
1099 | | - 'titles': this.wikiTitleKey, |
1100 | | - 'generator':'categories' |
| 1098 | + 'action' : 'query', |
| 1099 | + 'titles' : this.wikiTitleKey, |
| 1100 | + 'generator' : 'categories' |
1101 | 1101 | }; |
1102 | 1102 | var req_categories= new Array(); |
1103 | 1103 | do_api_req( { |
1104 | | - 'data':reqObj, |
1105 | | - 'url': commons_api_url |
| 1104 | + 'data' : reqObj, |
| 1105 | + 'url' : commons_api_url |
1106 | 1106 | }, function(data){ |
1107 | 1107 | req_categories = Array(); |
1108 | 1108 | if(data.query && data.query.pages){ |
— | — | @@ -1133,8 +1133,6 @@ |
1134 | 1134 | }, function(data){ |
1135 | 1135 | //empty the videos: |
1136 | 1136 | $j('#dc_'+ _this.id + ' .related_vids ul').html(' '); |
1137 | | - var leyenda=""; |
1138 | | - var titule=""; |
1139 | 1137 | |
1140 | 1138 | for(var j in data.query.pages){ |
1141 | 1139 | //setup poster default: |
— | — | @@ -1152,17 +1150,15 @@ |
1153 | 1151 | var liout = '<li>' + |
1154 | 1152 | '<a href="' + descriptionurl + '" >' + |
1155 | 1153 | '<img src="' + local_poster + '">' + |
1156 | | - '</a>' + |
1157 | | - '<div>' + |
1158 | | - '<a title="' + title_str + '" target="_blank" ' + |
1159 | | - 'href="'+ descriptionurl +'">' + title_str + '</a>' + |
1160 | | - '</div>' + |
| 1154 | + '</a>' + |
| 1155 | + ' <a title="' + title_str + '" target="_blank" ' + |
| 1156 | + 'href="'+ descriptionurl +'">' + title_str + '</a>' + |
1161 | 1157 | '</li>'; |
1162 | 1158 | $j('#dc_'+ _this.id + ' .related_vids ul').append(liout) ; |
1163 | 1159 | } |
1164 | 1160 | } |
1165 | 1161 | }; |
1166 | | - js_log( 'content: ' + $j('#dc_'+ _this.id + ' .related_vids ul').html() ); |
| 1162 | + //js_log( 'content: ' + $j('#dc_'+ _this.id + ' .related_vids ul').html() ); |
1167 | 1163 | }); //end do_api_req |
1168 | 1164 | }; |
1169 | 1165 | }, |
— | — | @@ -1378,7 +1374,7 @@ |
1379 | 1375 | time_req + '\'); return false; "'; |
1380 | 1376 | } |
1381 | 1377 | html+=' title="' + title_msg + '">' + |
1382 | | - gM(link_type+'_clip_msg') + |
| 1378 | + gM('mwe-' + link_type+'_clip_msg') + |
1383 | 1379 | '</a><br><span style="font-size:small">'+ title_msg +'<span></p>'; |
1384 | 1380 | } |
1385 | 1381 | } |
Index: trunk/phase3/js2/uploadPage.js |
— | — | @@ -7,8 +7,7 @@ |
8 | 8 | }); |
9 | 9 | var mwUploadFormTarget = '#mw-upload-form'; |
10 | 10 | //set up the upoload form bindings once all dom manipluation is done |
11 | | -var mwUploadHelper = { |
12 | | - firefogg_installed:false, |
| 11 | +var mwUploadHelper = { |
13 | 12 | init:function(){ |
14 | 13 | var _this = this; |
15 | 14 | //if not boolean false set to true: |
— | — | @@ -23,21 +22,13 @@ |
24 | 23 | 'form_rewrite': true, |
25 | 24 | 'target_edit_from' : mwUploadFormTarget, |
26 | 25 | 'new_source_cb' : function( orgFilename, oggName ){ |
27 | | - if($j('#wpDestFile').val() == "") |
28 | | - $j('#wpDestFile').val( oggName ); |
29 | | - $j('#wpDestFile').doDestCheck({ |
30 | | - 'warn_target':'#wpDestFile-warning' |
31 | | - }); |
32 | | - }, |
33 | | - 'detect_cb':function( fogg_installed ){ |
34 | | - if(fogg_installed){ |
35 | | - _this.firefogg_installed=true; |
36 | | - }else{ |
37 | | - _this.firefogg_installed=false; |
38 | | - } |
39 | | - } |
40 | | - }); |
41 | | - |
| 26 | + if($j('#wpDestFile').val() == "") |
| 27 | + $j('#wpDestFile').val( oggName ); |
| 28 | + $j('#wpDestFile').doDestCheck({ |
| 29 | + 'warn_target':'#wpDestFile-warning' |
| 30 | + }); |
| 31 | + } |
| 32 | + }); |
42 | 33 | }else{ |
43 | 34 | //Add basic upload profile support ( http status monitoring, progress box for browsers that support it etc.) |
44 | 35 | if($j('#wpUploadFileURL').length != 0){ |
— | — | @@ -51,7 +42,7 @@ |
52 | 43 | if( wgAjaxUploadDestCheck ){ |
53 | 44 | //do destination check: |
54 | 45 | $j('#wpDestFile').change(function(){ |
55 | | - $j(this).doDestCheck({ |
| 46 | + $j('#wpDestFile').doDestCheck({ |
56 | 47 | 'warn_target':'#wpDestFile-warning' |
57 | 48 | }); |
58 | 49 | }); |