r48248 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48247‎ | r48248 | r48249 >
Date:00:26, 10 March 2009
Author:dale
Status:deferred
Tags:
Comment:
minor fixes for add media wiz
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/MetavidWiki/languages/MV_Messages.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/add_media_wizard.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvPlayList.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php
@@ -117,6 +117,7 @@
118118 $wgJSAutoloadClasses['j.contextMenu'] = $mvjsp . 'jquery/plugins/jquery.contextMenu.js';
119119 $wgJSAutoloadClasses['j.fn.autocomplete'] = $mvjsp . 'jquery/plugins/jquery.autocomplete.js';
120120 $wgJSAutoloadClasses['j.fn.hoverIntent'] = $mvjsp . 'jquery/plugins/jquery.hoverIntent.js';
 121+ $wgJSAutoloadClasses['j.Jcrop'] = $mvjsp . 'jquery/plugins/Jcrop/js/jquery.Jcrop.js';
121122
122123 //libAddMedia:
123124 $wgJSAutoloadClasses['mvFirefogg'] = $mvjsp . 'libAddMedia/mvFirefogg.js';
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php
@@ -75,7 +75,7 @@
7676 'rsd_box_layout' => 'Box layout',
7777 'rsd_list_layout' => 'List layout',
7878 #set to ignored for now. Messages does not appear to be final
79 - 'rsd_results_desc' => 'Results some', # do not translate or duplicate this message to other languages
 79+ 'rsd_results_desc' => 'Results', # do not translate or duplicate this message to other languages
8080 'rsd_results_next' => 'next',
8181 'rsd_results_prev' => 'previous',
8282 'upload' => 'Upload',
Index: trunk/extensions/MetavidWiki/skins/add_media_wizard.js
@@ -30,7 +30,7 @@
3131 });
3232 }
3333 //add firefog support to Special Upload page:
34 -if(wgPageName== "Special:Upload"){
 34+if( wgPageName== "Special:Upload" ){
3535 addOnloadHook( function(){
3636 //(for commons force the &uploadformstyle=plain form
3737 /*var loc = window.location.toString();
@@ -41,7 +41,7 @@
4242 }*/
4343 //alert("!!upload hook");
4444 load_mv_embed( function(){
45 - //load jQuery and what not (we need to refactor the loading system for mv_embed)
 45+ //load jQuery and what not
4646 mvJsLoader.loadBaseLibs(function(){
4747 mvJsLoader.doLoad( {
4848 'mvFirefogg' : 'libAddMedia/mvFirefogg.js',
@@ -146,8 +146,7 @@
147147 function check_for_mv_embed( callback ){
148148 if( typeof mvEmbed == 'undefined'){
149149 setTimeout('check_for_mv_embed( ' + callback +');', 25);
150 - }else{
151 - js_log('callback is now: ' + callback);
 150+ }else{
152151 callback();
153152 }
154153 }
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js
@@ -1,5 +1,5 @@
2 -/* firefogg refactor using jQuery
3 - invovked using the
 2+/* adds firefogg support.
 3+* autodetects: new upload api or old http POST.
44 */
55
66 var default_firefogg_options = {
@@ -15,7 +15,7 @@
1616 min_firefogg_version : '0.9.3',
1717 enabled : false, //if firefogg is enabled or not.
1818 upload_mode:'autodetect', //can be 'post', 'chunks' or autodetect. (autodetect issues an api call)
19 - encoder_settings:{ //@@todo maybe allow server to set this?
 19+ encoder_settings:{ //@@todo allow server to set this
2020 'maxSize': 400,
2121 'videoBitrate': 400
2222 },
@@ -127,7 +127,10 @@
128128 return false;
129129 }
130130 }
131 -
 131+ //run the onClick hanndle:
 132+ if(toggleFilenameFiller)
 133+ toggleFilenameFiller();
 134+
132135 //setup the form handling
133136 _this.editForm = $j('#mw-upload-form').get(0);
134137
@@ -207,10 +210,32 @@
208211 },
209212 //doChunkUpload does both uploading and encoding at the same time and uploads one meg chunks as they are ready
210213 doChunkUpload : function(){
211 - var _this = this;
212 - _this.fogg.upload( JSON.stringify( _this.encoder_settings ), _this.editForm.action , JSON.stringify( _this.formData ) );
 214+ var _this = this;
 215+ //build the api url:
 216+ var aReq ={
 217+ 'action' : 'upload',
 218+ 'format' : 'json',
 219+ 'filename' : _this.formData['wpDestFile'],
 220+ 'comment' : _this.formData['wpUploadDescription']
 221+ };
 222+ if( _this.formData['wpWatchthis'] )
 223+ aReq['watch'] = _this.formData['wpWatchthis'];
 224+
 225+ if( _this.formData['wpIgnoreWarning'] )
 226+ aReq['ignorewarnings'] = _this.formData['wpIgnoreWarning'];
 227+
 228+ do_api_req({
 229+ 'data': aReq
 230+ }, function(data){
 231+ var foo = data;
 232+ js_log('data');
 233+ debugger;
 234+ });
 235+ //_this.fogg.upload( JSON.stringify( _this.encoder_settings ), aReq , JSON.stringify( _this.formData ) );
 236+
 237+
213238 //update upload status:
214 - _this.doUploadStatus();
 239+ //_this.doUploadStatus();
215240 },
216241 //doEncUpload first encodes then uploads
217242 doEncUpload : function(){
@@ -236,10 +261,16 @@
237262 //show the fogg-status-upload
238263 $j('#fogg-status-upload').show();
239264
240 - //send to the post url:
 265+ //send to the post url:
 266+ js_log('sending form data to : ' + _this.editForm.action);
 267+ for(var fk in _this.formData){
 268+ js_log(fk + ' : ' + _this.formData[fk]);
 269+ }
241270 _this.fogg.post( _this.editForm.action, 'wpUploadFile', JSON.stringify( _this.formData ) );
 271+
242272 //update upload status:
243273 _this.doUploadStatus();
 274+
244275 }else if(_this.fogg.state == 'encoding fail'){
245276 //@@todo error handling:
246277 alert('encoding failed');
@@ -263,23 +294,24 @@
264295 }
265296 //check upload state
266297 else if( _this.fogg.state == 'upload done' || _this.fogg.state == 'done' ) {
267 - js_log( 'firefogg:upload done: ');
268 - //@@todo handle errors same problem as #695 in remoteSearchDriver.js
269 -
 298+ js_log( 'firefogg:upload done: ');
 299+ //@@todo improve error hanlding for http response
 300+ //improve firefogg side of things result responseText should be in resultText;
 301+ var cat = JSON.parse( _this.fogg.uploadstatus() );
 302+ //$j('body').html( cat["responseText"] );
 303+ //debugger;
270304 //if in "post" upload mode read the html response:
271305 if( _this.upload_mode == 'post' ) {
272 - js_log('done upload response is:' + _this.fogg.responseText );
273 - _this.procPageResponse( _this.fogg.responseText );
 306+ js_log( 'done upload response is: ' + cat["responseText"] );
 307+ _this.procPageResponse( cat["responseText"] );
274308 }else if( _this.upload_mode == 'chunks'){
275 - //should have an json result:\
 309+ //should have an json result:
276310 var foo = _this;
277311 var cat = _this.fogg.responseText;
278 - var cat_json = eval('var result =' + _this.fogg.responseText );
279 - debugger;
 312+ var cat_json = eval('var result =' + _this.fogg.resultText );
280313 }
281 - }
282 - //upload error:
283 - else{
 314+ }else{
 315+ //upload error:
284316 alert('firefogg upload error: ' + _this.fogg.state );
285317 }
286318 }
@@ -307,6 +339,7 @@
308340 wgArticlePath.replace(/\$1/, 'File:' + this.formData['wpDestFile'] ) + '">'+
309341 'here</a> \n';
310342 }else{
 343+
311344 sp = result_page.indexOf('<span class="error">');
312345 if(sp!=-1){
313346 se = result_page.indexOf('</span>', sp);
@@ -317,6 +350,13 @@
318351 if(sp!=-1){
319352 se = result_page.indexOf('</ul>', sp);
320353 error_txt = result_page.substr(sp, (sp-se));
 354+ }else{
 355+ //one more error type check:
 356+ sp = result_page.indexOf('class="mw-warning-with-logexcerpt">')
 357+ if(sp!=-1){
 358+ se = result_page.indexOf('</div>', sp);
 359+ error_txt = result_page.substr(sp, (sp-se));
 360+ }
321361 }
322362 }
323363 }
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js
@@ -7,11 +7,10 @@
88 metavid
99 and archive.org
1010 */
11 -
1211 loadGM( { "mv_media_search" : "Media Search why test test",
1312 "rsd_box_layout" : "Box layout",
1413 "rsd_list_layout" : "List Layout",
15 - "rsd_results_desc" : "Results some ",
 14+ "rsd_results_desc" : "Results ",
1615 "rsd_results_next" : "next ",
1716 "rsd_results_prev" : "previous ",
1817 "upload" : "Upload",
@@ -1007,7 +1006,7 @@
10081007 var to_num = ( cp.limit > cp.sObj.num_results )?
10091008 (cp.offset + cp.sObj.num_results):
10101009 (cp.offset + cp.limit);
1011 - var out = gM('rsd_results_desc') + (cp.offset+1) + ' to ' + to_num;
 1010+ var out = gM('rsd_results_desc') + ' ' + (cp.offset+1) + ' to ' + to_num;
10121011 //check if we have more results (next prev link)
10131012 if( cp.offset >= cp.limit )
10141013 out+=' <a href="#" id="rsd_pprev">' + gM('rsd_results_prev') + cp.limit + '</a>';
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvPlayList.js
@@ -471,7 +471,7 @@
472472 //render out the dividers on the timeline:
473473 this.colorPlayHead();
474474 //update status:
475 - this.setStatus('0:0:00/'+seconds2ntp( this.getDuration() ));
 475+ this.setStatus( '0:0:00/' + seconds2ntp( this.getDuration() ) );
476476 },
477477 /*setStatus override (could call the jquery directly) */
478478 setStatus:function(value){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -1077,9 +1077,10 @@
10781078 js_log('Error: no api url');
10791079 return false;
10801080 }
1081 - options.url = wgServer +((wgServer == null) ? parseUri(document.URL).host + (wgScriptPath + "/api.php") : parseUri(document.URL).host + wgScript);
 1081+ if (wgServer && wgScript)
 1082+ options.url = wgServer + wgScript;
10821083 //update to api.php (if index.php was in the wgScript path):
1083 - options.url = options.url.replace('index.php', 'api.php');
 1084+ options.url = options.url.replace(/index.php/, 'api.php');
10841085 }
10851086 if(typeof options.data == 'undefined')
10861087 options.data = {};

Status & tagging log