r49681 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49680‎ | r49681 | r49682 >
Date:23:01, 20 April 2009
Author:dale
Status:deferred
Tags:
Comment:
* issue with mime type detection for clip edit
* fixed api-url in sequence context for searching
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/seqRemoteSearchDriver.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libClipEdit/mvClipEdit.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvSequencer.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/mediaWikiSearch.js
@@ -200,10 +200,10 @@
201201 }
202202 var style_attr = 'style="width:' + outOpt.width + 'px;height:' + outOpt.height +'px"';
203203 var id_attr = (options['id'])?' id = "' + options['id'] +'" ': '';
204 -
 204+ var cat = rObj;
205205 //return the html type:
206206 if(rObj.mime.indexOf('image')!=-1){
207 - return '<img ' + id_attr + ' src="' + rObj.url + '"' + style_attr + ' >';
 207+ return '<img ' + id_attr + ' src="' + rObj.edit_url + '"' + style_attr + ' >';
208208 }
209209 var ahtml='';
210210 if(rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg'){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/seqRemoteSearchDriver.js
@@ -28,7 +28,7 @@
2929 var insert_key='na';
3030 var clip_key ='';
3131
32 - //@@todo support multiple tracks
 32+ //@@todo support multiple target tracks
3333 $j('.mv_clip_box_result').draggable({
3434 start:function(){
3535 source_pos = $j(this).offset();
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js
@@ -325,7 +325,7 @@
326326 var _this = this;
327327 var dq = (this.default_query)? this.default_query : '';
328328 var out = '<div class="rsd_control_container" style="width:100%">' +
329 - '<form id="rsd_form" action="" method="GET">'+
 329+ '<form id="rsd_form" action="javascript:return false;" method="GET">'+
330330 '<table style="width:100%;background-color:transparent;">' +
331331 '<tr>'+
332332 '<td style="width:110px">'+
@@ -402,7 +402,7 @@
403403 }
404404 });
405405 //set form bindings
406 - $j('#rsd_form').submit(function(){
 406+ $j('#rsd_form').unbind().submit(function(){
407407 _this.runSearch();
408408 //don't submit the form
409409 return false;
@@ -453,9 +453,9 @@
454454 //check if we need to update:
455455 if( typeof cp.sObj != 'undefined' ){
456456 if(cp.sObj.last_query == $j('#rsd_q').val() && cp.sObj.last_offset == cp.offset){
457 - js_log('last query is: ' + cp.sObj.last_query + ' matches: ' + $j('#rsd_q').val());
 457+ js_log('last query is: ' + cp.sObj.last_query + ' matches: ' + $j('#rsd_q').val() );
458458 }else{
459 - js_log('last query is: ' + cp.sObj.last_query + ' not match: ' + $j('#rsd_q').val());
 459+ js_log('last query is: ' + cp.sObj.last_query + ' not match: ' + $j('#rsd_q').val() );
460460 draw_direct_flag = false;
461461 }
462462 }else{
@@ -477,7 +477,7 @@
478478 //this check can be avoided by setting the this.import_url_mode = 'api' | 'form' | insted of 'autodetect' or 'none'
479479 checkForCopyURLSupport:function ( callback ){
480480 var _this = this;
481 - js_log('checkForCopyURLSupport');
 481+ js_log('checkForCopyURLSupport:: ' + wgArticlePath);
482482 if( this.import_url_mode == 'autodetect' ){
483483 do_api_req( {
484484 'data':{ 'action':'paraminfo','modules':'upload' },
@@ -489,20 +489,20 @@
490490 $j.ajax({
491491 type: "GET",
492492 dataType: 'html',
493 - url: wgArticlePath.replace('$1', 'Special:Upload'), //@@todo may have problems in localized special pages
 493+ url: wgArticlePath.replace( '$1', 'Special:Upload' ), //@@todo may have problems in localized special pages
494494 //(could hit meta=siteinfo & specialpagealiases )
495 - // but might be overkill for now.
 495+ // but might be overkill for now cuz we want to switch to new-upload branch soon.
496496 success: function( form_html ){
497497 if( form_html.indexOf( 'wpUploadFileURL' ) != -1){
498 - _this.import_url_mode= 'form';
 498+ _this.import_url_mode = 'form';
499499 }else{
500 - _this.import_url_mode= 'none';
 500+ _this.import_url_mode = 'none';
501501 }
502502 callback();
503503 },
504504 error: function(){
505505 js_log('error in getting Special:Upload page');
506 - _this.import_url_mode= 'none';
 506+ _this.import_url_mode = 'none';
507507 callback();
508508 }
509509 });
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvSequencer.js
@@ -129,7 +129,8 @@
130130 }, function(){
131131 this_seq.mySearch = new seqRemoteSearchDriver({
132132 'p_seq':this_seq,
133 - 'target_id':'cliplib_ic',
 133+ 'target_id':'cliplib_ic',
 134+ 'local_wiki_api_url': this_seq.getLocalApiUrl(),
134135 'instance_name': this_seq.instance_name + '.mySearch'
135136 });
136137 this_seq.mySearch.doInitDisplay();
@@ -433,6 +434,9 @@
434435 }
435436 }
436437 },
 438+ getLocalApiUrl:function(){
 439+ return this.plObj.interface_url.replace(/index\.php/, 'api.php');
 440+ },
437441 plReadyInit:function(){
438442 var this_seq = this;
439443 //debugger;
@@ -456,10 +460,10 @@
457461 'intoken':'edit',
458462 'titles': this_seq.plObj.mTitle
459463 };
460 - var api_url = this.plObj.interface_url.replace(/index\.php/, 'api.php');
 464+
461465 do_api_req( {
462 - 'data':reqObj,
463 - 'url':api_url
 466+ 'data': reqObj,
 467+ 'url' : this_seq.getLocalApiUrl()
464468 },function(data){
465469 for(var i in data.query.pages){
466470 if(data.query.pages[i]['edittoken'])
@@ -470,8 +474,8 @@
471475 );
472476 reqObj['titles']=this_seq.plObj.mTalk;
473477 do_api_req( {
474 - 'data':reqObj,
475 - 'url':api_url
 478+ 'data': reqObj,
 479+ 'url' : this_seq.getLocalApiUrl()
476480 }, function( data ){
477481 for(var j in data.query.pages){
478482 if(data.query.pages[j]['edittoken'])
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libClipEdit/mvClipEdit.js
@@ -62,13 +62,13 @@
6363 }
6464
6565 //if media type was not supplied detect for resource if possible:
66 - //@@todo more advanced detection.
 66+ //@@todo more advanced detection.
6767 if(!this.media_type){
68 - if( this.rObj.mime.indexOf("image/") === 0){
 68+ if( this.rObj.type.indexOf("image/") === 0){
6969 this.media_type = 'image';
70 - }else if( this.rObj.mime.indexOf("video/") === 0){
 70+ }else if( this.rObj.type.indexOf("video/") === 0){
7171 this.media_type = 'video';
72 - }else if( this.rObj.mime.indexOf("text/") === 0){
 72+ }else if( this.rObj.type.indexOf("text/") === 0){
7373 this.media_type = 'template';
7474 }
7575 }
@@ -110,9 +110,11 @@
111111 var end_ntp = ( _this.rObj.embed.end_ntp) ? _this.rObj.embed.end_ntp : _this.rObj.embed.getDuration();
112112 if(!end_ntp)
113113 end_ntp = seconds2ntp( _this.rObj.dur );
 114+
 115+ var start_ntp = (_this.rObj.embed.start_ntp) ? _this.rObj.embed.start_ntp : seconds2ntp( 0 );
114116 $j('#sub_cliplib_ic').html(
115117 _this.getSetInOut({
116 - 'start_ntp' : _this.rObj.embed.start_ntp,
 118+ 'start_ntp' : start_ntp,
117119 'end_ntp' : end_ntp
118120 })
119121 );

Status & tagging log