r51842 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51841‎ | r51842 | r51843 >
Date:04:09, 14 June 2009
Author:dale
Status:deferred
Tags:
Comment:
* importing assets fixes
* clean up of asset insert code to avoid extra api hit
Modified paths:
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/seqRemoteSearchDriver.js (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/seqRemoteSearchDriver.js
@@ -97,26 +97,16 @@
9898 //get target order:
9999 var cat = rObj;
100100 //check for target insert path
101 - this.checkImportResource( rObj, function(){
102 - //get the local src file (if we imported) :
103 - do_api_req({
104 - 'data': {
105 - 'action' : 'query',
106 - 'prop' : 'imageinfo',
107 - 'iiprop' : 'url'
108 - },
109 - 'url': _this.local_wiki_api_url
110 - }, function(data){
111 - debugger;
112 - });
113 -
114 - var clipConfig = {
115 - 'src' : rObj.src,
 101+ this.checkImportResource( rObj, function(){
 102+ var clipConfig = {
116103 'type' : rObj.mime,
117 - 'uri' : _this.cFileNS + ':' + rObj.target_resource_title,
118 - 'poster' : rObj.poster,
 104+ 'uri' : _this.cFileNS + ':' + rObj.target_resource_title,
119105 'title' : rObj.title
120106 };
 107+ //set via local properites if avaliable
 108+ clipConfig['src'] = (rObj.local_src) ? rObj.local_src : rObj.src;
 109+ clipConfig['poster'] = (rObj.local_poster) ? rObj.local_poster : rObj.poster;
 110+
121111 if(rObj.start_time && rObj.end_time){
122112 clipConfig['dur'] = npt2seconds( rObj.end_time ) - npt2seconds( rObj.start_time );
123113 }
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -1150,7 +1150,7 @@
11511151 var _this = this;
11521152
11531153 //check if local repository
1154 - //or if import mode if just "linking"
 1154+ //or if import mode if just "linking" (we should alaredy have the 'url'
11551155 if( this.checkRepoLocal( cp ) || this.import_url_mode == 'remote_link'){
11561156 //local repo jump directly to check Import Resource callback:
11571157 cir_callback( rObj );
@@ -1162,7 +1162,10 @@
11631163 //check if the resource is not already on this wiki
11641164 reqObj={
11651165 'action':'query',
1166 - 'titles': _this.cFileNS + ':' + rObj.target_resource_title
 1166+ 'titles': _this.cFileNS + ':' + rObj.target_resource_title,
 1167+ 'prop' : 'imageinfo',
 1168+ 'iiprop' : 'url',
 1169+ 'iiurlwidth': '400'
11671170 };
11681171
11691172 do_api_req( {
@@ -1174,12 +1177,16 @@
11751178 if( i != '-1' && i != '-2' ){
11761179 js_log('found title: ' + i + ':' + data.query.pages[i]['title']);
11771180 found_title=data.query.pages[i]['title'];
 1181+ //update to local src
 1182+ rObj.local_src = data.query.pages[i]['imageinfo'][0].url;
 1183+ //@@todo maybe update poster too?
 1184+ rObj.local_poster = data.query.pages[i]['imageinfo'][0].thumburl;
11781185 }
11791186 }
11801187 if( found_title ){
11811188 js_log("checkImportResource:found title:" + found_title);
11821189 //resource is already present (or resource with same name is already present)
1183 - rObj.target_resource_title = found_title.replace(/File:|Image:/,'');
 1190+ rObj.target_resource_title = found_title.replace(/File:|Image:/,'');
11841191 cir_callback( rObj );
11851192 }else{
11861193 js_log("resource not present: update:"+ _this.cFileNS + ':' + rObj.target_resource_title);

Status & tagging log