Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php |
— | — | @@ -117,6 +117,7 @@ |
118 | 118 | $wgJSAutoloadClasses['j.contextMenu'] = $mvjsp . 'jquery/plugins/jquery.contextMenu.js'; |
119 | 119 | $wgJSAutoloadClasses['j.fn.autocomplete'] = $mvjsp . 'jquery/plugins/jquery.autocomplete.js'; |
120 | 120 | $wgJSAutoloadClasses['j.fn.hoverIntent'] = $mvjsp . 'jquery/plugins/jquery.hoverIntent.js'; |
| 121 | + $wgJSAutoloadClasses['j.Jcrop'] = $mvjsp . 'jquery/plugins/Jcrop/js/jquery.Jcrop.js'; |
121 | 122 | |
122 | 123 | //libAddMedia: |
123 | 124 | $wgJSAutoloadClasses['mvFirefogg'] = $mvjsp . 'libAddMedia/mvFirefogg.js'; |
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | 'rsd_box_layout' => 'Box layout', |
77 | 77 | 'rsd_list_layout' => 'List layout', |
78 | 78 | #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 |
80 | 80 | 'rsd_results_next' => 'next', |
81 | 81 | 'rsd_results_prev' => 'previous', |
82 | 82 | 'upload' => 'Upload', |
Index: trunk/extensions/MetavidWiki/skins/add_media_wizard.js |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | }); |
32 | 32 | } |
33 | 33 | //add firefog support to Special Upload page: |
34 | | -if(wgPageName== "Special:Upload"){ |
| 34 | +if( wgPageName== "Special:Upload" ){ |
35 | 35 | addOnloadHook( function(){ |
36 | 36 | //(for commons force the &uploadformstyle=plain form |
37 | 37 | /*var loc = window.location.toString(); |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | }*/ |
43 | 43 | //alert("!!upload hook"); |
44 | 44 | 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 |
46 | 46 | mvJsLoader.loadBaseLibs(function(){ |
47 | 47 | mvJsLoader.doLoad( { |
48 | 48 | 'mvFirefogg' : 'libAddMedia/mvFirefogg.js', |
— | — | @@ -146,8 +146,7 @@ |
147 | 147 | function check_for_mv_embed( callback ){ |
148 | 148 | if( typeof mvEmbed == 'undefined'){ |
149 | 149 | setTimeout('check_for_mv_embed( ' + callback +');', 25); |
150 | | - }else{ |
151 | | - js_log('callback is now: ' + callback); |
| 150 | + }else{ |
152 | 151 | callback(); |
153 | 152 | } |
154 | 153 | } |
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. |
4 | 4 | */ |
5 | 5 | |
6 | 6 | var default_firefogg_options = { |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | min_firefogg_version : '0.9.3', |
17 | 17 | enabled : false, //if firefogg is enabled or not. |
18 | 18 | 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 |
20 | 20 | 'maxSize': 400, |
21 | 21 | 'videoBitrate': 400 |
22 | 22 | }, |
— | — | @@ -127,7 +127,10 @@ |
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | } |
131 | | - |
| 131 | + //run the onClick hanndle: |
| 132 | + if(toggleFilenameFiller) |
| 133 | + toggleFilenameFiller(); |
| 134 | + |
132 | 135 | //setup the form handling |
133 | 136 | _this.editForm = $j('#mw-upload-form').get(0); |
134 | 137 | |
— | — | @@ -207,10 +210,32 @@ |
208 | 211 | }, |
209 | 212 | //doChunkUpload does both uploading and encoding at the same time and uploads one meg chunks as they are ready |
210 | 213 | 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 | + |
213 | 238 | //update upload status: |
214 | | - _this.doUploadStatus(); |
| 239 | + //_this.doUploadStatus(); |
215 | 240 | }, |
216 | 241 | //doEncUpload first encodes then uploads |
217 | 242 | doEncUpload : function(){ |
— | — | @@ -236,10 +261,16 @@ |
237 | 262 | //show the fogg-status-upload |
238 | 263 | $j('#fogg-status-upload').show(); |
239 | 264 | |
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 | + } |
241 | 270 | _this.fogg.post( _this.editForm.action, 'wpUploadFile', JSON.stringify( _this.formData ) ); |
| 271 | + |
242 | 272 | //update upload status: |
243 | 273 | _this.doUploadStatus(); |
| 274 | + |
244 | 275 | }else if(_this.fogg.state == 'encoding fail'){ |
245 | 276 | //@@todo error handling: |
246 | 277 | alert('encoding failed'); |
— | — | @@ -263,23 +294,24 @@ |
264 | 295 | } |
265 | 296 | //check upload state |
266 | 297 | 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; |
270 | 304 | //if in "post" upload mode read the html response: |
271 | 305 | 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"] ); |
274 | 308 | }else if( _this.upload_mode == 'chunks'){ |
275 | | - //should have an json result:\ |
| 309 | + //should have an json result: |
276 | 310 | var foo = _this; |
277 | 311 | 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 ); |
280 | 313 | } |
281 | | - } |
282 | | - //upload error: |
283 | | - else{ |
| 314 | + }else{ |
| 315 | + //upload error: |
284 | 316 | alert('firefogg upload error: ' + _this.fogg.state ); |
285 | 317 | } |
286 | 318 | } |
— | — | @@ -307,6 +339,7 @@ |
308 | 340 | wgArticlePath.replace(/\$1/, 'File:' + this.formData['wpDestFile'] ) + '">'+ |
309 | 341 | 'here</a> \n'; |
310 | 342 | }else{ |
| 343 | + |
311 | 344 | sp = result_page.indexOf('<span class="error">'); |
312 | 345 | if(sp!=-1){ |
313 | 346 | se = result_page.indexOf('</span>', sp); |
— | — | @@ -317,6 +350,13 @@ |
318 | 351 | if(sp!=-1){ |
319 | 352 | se = result_page.indexOf('</ul>', sp); |
320 | 353 | 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 | + } |
321 | 361 | } |
322 | 362 | } |
323 | 363 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -7,11 +7,10 @@ |
8 | 8 | metavid |
9 | 9 | and archive.org |
10 | 10 | */ |
11 | | - |
12 | 11 | loadGM( { "mv_media_search" : "Media Search why test test", |
13 | 12 | "rsd_box_layout" : "Box layout", |
14 | 13 | "rsd_list_layout" : "List Layout", |
15 | | - "rsd_results_desc" : "Results some ", |
| 14 | + "rsd_results_desc" : "Results ", |
16 | 15 | "rsd_results_next" : "next ", |
17 | 16 | "rsd_results_prev" : "previous ", |
18 | 17 | "upload" : "Upload", |
— | — | @@ -1007,7 +1006,7 @@ |
1008 | 1007 | var to_num = ( cp.limit > cp.sObj.num_results )? |
1009 | 1008 | (cp.offset + cp.sObj.num_results): |
1010 | 1009 | (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; |
1012 | 1011 | //check if we have more results (next prev link) |
1013 | 1012 | if( cp.offset >= cp.limit ) |
1014 | 1013 | 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 @@ |
472 | 472 | //render out the dividers on the timeline: |
473 | 473 | this.colorPlayHead(); |
474 | 474 | //update status: |
475 | | - this.setStatus('0:0:00/'+seconds2ntp( this.getDuration() )); |
| 475 | + this.setStatus( '0:0:00/' + seconds2ntp( this.getDuration() ) ); |
476 | 476 | }, |
477 | 477 | /*setStatus override (could call the jquery directly) */ |
478 | 478 | setStatus:function(value){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -1077,9 +1077,10 @@ |
1078 | 1078 | js_log('Error: no api url'); |
1079 | 1079 | return false; |
1080 | 1080 | } |
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; |
1082 | 1083 | //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'); |
1084 | 1085 | } |
1085 | 1086 | if(typeof options.data == 'undefined') |
1086 | 1087 | options.data = {}; |