Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/kalturaSearch.js |
— | — | @@ -0,0 +1,128 @@ |
| 2 | +/* |
| 3 | + * Kaltura agragated search: |
| 4 | + */ |
| 5 | + |
| 6 | +var kalturaSearch = function ( options ) { |
| 7 | + return this.init( options ); |
| 8 | +} |
| 9 | +kalturaSearch.prototype = { |
| 10 | + |
| 11 | + // Stores search library pointers |
| 12 | + searchLibs:{ }, |
| 13 | + |
| 14 | + /** |
| 15 | + * Initialize the flickr Search with provided options |
| 16 | + * |
| 17 | + * @param {Object} options Initial options for the kalturaSearch class |
| 18 | + */ |
| 19 | + init:function( options ) { |
| 20 | + this.options = options; |
| 21 | + var baseSearch = new baseRemoteSearch( options ); |
| 22 | + for ( var i in baseSearch ) { |
| 23 | + if ( typeof this[i] == 'undefined' ) { |
| 24 | + this[i] = baseSearch[i]; |
| 25 | + } else { |
| 26 | + this['parent_' + i] = baseSearch[i]; |
| 27 | + } |
| 28 | + } |
| 29 | + }, |
| 30 | + |
| 31 | + /** |
| 32 | + * Get the Search results setting _loading flag to false once results have been added |
| 33 | + * |
| 34 | + * Runs an api call then calls addResults with the resulting data |
| 35 | + * @param {String} search_query Text search string |
| 36 | + */ |
| 37 | + getSearchResults:function( search_query ) { |
| 38 | + var _this = this; |
| 39 | + mw.log( "Kaltura::getSearchResults" ); |
| 40 | + |
| 41 | + // call parent for common initialisation: |
| 42 | + this.parent_getSearchResults(); |
| 43 | + |
| 44 | + // setup the flickr request: |
| 45 | + var request = { |
| 46 | + 's': search_query |
| 47 | + } |
| 48 | + $j.getJSON( this.provider.api_url + '?callback=?', request, function( data ) { |
| 49 | + _this.addResults( data ); |
| 50 | + _this.loading = false; |
| 51 | + } ); |
| 52 | + }, |
| 53 | + |
| 54 | + /** |
| 55 | + * Adds results from kaltura api data response object |
| 56 | + * |
| 57 | + * @param {Object} data Fliker response data |
| 58 | + */ |
| 59 | + addResults:function( data ) { |
| 60 | + var _this = this; |
| 61 | + this.provider_libs = { }; |
| 62 | + |
| 63 | + if ( data ) { |
| 64 | + // set result info: |
| 65 | + //this.num_results = data.photos.total; |
| 66 | + //if ( this.num_results > this.provider.offset + this.provider.limit ) { |
| 67 | + // this.more_results = true; |
| 68 | + //} |
| 69 | + for ( var resource_id in data ) { |
| 70 | + var result = data[ resource_id ]; |
| 71 | + |
| 72 | + // Update mapings: |
| 73 | + result['poster'] = result['thumbnail']; |
| 74 | + result['pSobj'] = _this; |
| 75 | + |
| 76 | + if( !result['titleKey'] && result['src'] ){ |
| 77 | + result['titleKey'] = 'File:' + result['src'].split('/').pop(); |
| 78 | + } |
| 79 | + _this.resultsObj[ resource_id ] = result; |
| 80 | + |
| 81 | + } |
| 82 | + } |
| 83 | + }, |
| 84 | + |
| 85 | + /** |
| 86 | + * Return image transform via callback |
| 87 | + * Maps the image request to the proper search library helper |
| 88 | + * |
| 89 | + * @param {Object} resource Resource object |
| 90 | + * @param {Number} size Requested size |
| 91 | + * @param {Function} callback Callback function for image resource |
| 92 | + */ |
| 93 | + getImageObj: function( resource, size, callback ) { |
| 94 | + var _this = this; |
| 95 | + this.getSerachLib( resource.content_provider_id, function( searchLib ){ |
| 96 | + searchLib.getImageObj( resource, size, callback ); |
| 97 | + }); |
| 98 | + }, |
| 99 | + |
| 100 | + /** |
| 101 | + * Get and load provider via id |
| 102 | + * @param {String} provider_id The id of the content provider |
| 103 | + * @param {Function} callback Function to call once provider search lib is loaded |
| 104 | + * callback is passed the search object |
| 105 | + */ |
| 106 | + getSerachLib: function( provider_id, callback ){ |
| 107 | + var _this = this; |
| 108 | + // Check if we already have the library loaded: |
| 109 | + if( this.searchLibs[ provider_id ] ){ |
| 110 | + callback ( this.searchLibs[ provider_id ] ); |
| 111 | + return ; |
| 112 | + } |
| 113 | + // Else load the provider lib: |
| 114 | + var provider = this.rsd.content_providers [ provider_id ]; |
| 115 | + mw.load( provider.lib + 'Search', function(){ |
| 116 | + //Set up the search lib options |
| 117 | + var options = { |
| 118 | + 'provider': provider, |
| 119 | + // Same remote search driver as KalturaSearch |
| 120 | + 'rsd': _this.rsd |
| 121 | + } |
| 122 | + _this.searchLibs[ provider_id ] = new window[ provider.lib + 'Search' ]( options ); |
| 123 | + callback ( _this.searchLibs[ provider_id ] ); |
| 124 | + } ); |
| 125 | + } |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +} |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -299,7 +299,7 @@ |
300 | 300 | var request = { |
301 | 301 | 'action':'query', |
302 | 302 | 'format':'json', |
303 | | - 'titles':resource.titleKey, |
| 303 | + 'titles' : resource.titleKey, |
304 | 304 | 'prop':'imageinfo', |
305 | 305 | 'iiprop':'url|size|mime' |
306 | 306 | } |
— | — | @@ -307,11 +307,16 @@ |
308 | 308 | if ( size.width ) |
309 | 309 | request['iiurlwidth'] = size.width; |
310 | 310 | |
311 | | - mw.log( 'going to do req: ' + this.provider.api_url + ' ' + request ); |
| 311 | + mw.log( 'going to do req: ' + this.provider.api_url + ' ' + resource.titleKey ); |
312 | 312 | |
313 | | - mw.getJSON( this.provider.api_url, request, function( data ) { |
| 313 | + mw.getJSON( this.provider.api_url, request, function( data ) { |
314 | 314 | var imObj = { }; |
315 | 315 | for ( var page_id in data.query.pages ) { |
| 316 | + if( page_id == -1 ){ |
| 317 | + mw.log( 'Error: missing page for title: ' + resource.titleKey ) |
| 318 | + continue; |
| 319 | + } |
| 320 | + |
316 | 321 | var iminfo = data.query.pages[ page_id ].imageinfo[0]; |
317 | 322 | // store the orginal width: |
318 | 323 | imObj['org_width'] = iminfo.width; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/archiveOrgSearch.js |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | * @param {Object} data Api result data |
67 | 67 | */ |
68 | 68 | addResults:function( data ) { |
69 | | - var _this = this; |
| 69 | + var _this = this; |
70 | 70 | if ( data.response && data.response.docs ) { |
71 | 71 | // Set result info: |
72 | 72 | this.num_results = data.response.numFound; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/metavidSearch.js |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | /** |
119 | 119 | * Get additional wiki text description |
120 | 120 | * |
121 | | - * @param {Object} resource Resource to get addtional wikitext for. |
| 121 | + * @param {Object} resource Resource to get additional wikitext for. |
122 | 122 | */ |
123 | 123 | getExtraResourceDescWiki:function( resource ) { |
124 | 124 | var o = "\n"; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js |
— | — | @@ -21,7 +21,8 @@ |
22 | 22 | "metavidSearch" : "modules/AddMedia/searchLibs/metavidSearch.js", |
23 | 23 | "archiveOrgSearch" : "modules/AddMedia/searchLibs/archiveOrgSearch.js", |
24 | 24 | "flickrSearch" : "modules/AddMedia/searchLibs/flickrSearch.js", |
25 | | - "baseRemoteSearch" : "modules/AddMedia/searchLibs/baseRemoteSearch.js" |
| 25 | + "baseRemoteSearch" : "modules/AddMedia/searchLibs/baseRemoteSearch.js", |
| 26 | + "kalturaSearch" : "modules/AddMedia/searchLibs/kalturaSearch.js" |
26 | 27 | }); |
27 | 28 | |
28 | 29 | /** |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -57,6 +57,9 @@ |
58 | 58 | "rsd-wiki_commons-title": "Wikimedia Commons", |
59 | 59 | "rsd-wiki_commons": "Wikimedia Commons, an archive of freely-licensed educational media content (images, sound and video clips)", |
60 | 60 | |
| 61 | + "rsd-kaltura-title" : "Kaltura search", |
| 62 | + "rsd-kaltura" : "Kaltura agragated search for free-licenced media across multiple search providers", |
| 63 | + |
61 | 64 | "rsd-this_wiki-title" : "This wiki", |
62 | 65 | "rsd-this_wiki-desc" : "The local wiki install", |
63 | 66 | |
— | — | @@ -126,8 +129,11 @@ |
127 | 130 | // Enabled providers can be keyword 'all' or an array of enabled content provider keys |
128 | 131 | 'enabled_providers': 'all', |
129 | 132 | |
| 133 | + // Set a default provider |
| 134 | + 'default_provider': null, |
| 135 | + |
130 | 136 | // Current provider (used internally) |
131 | | - 'currentProvider': null, |
| 137 | + 'current_provider': null, |
132 | 138 | |
133 | 139 | // The timeout for search providers ( in seconds ) |
134 | 140 | 'search_provider_timeout': 10 |
— | — | @@ -243,7 +249,7 @@ |
244 | 250 | 'tab_img': false |
245 | 251 | }, |
246 | 252 | |
247 | | - /* |
| 253 | + /** |
248 | 254 | * Wikipedia Commons search provider configuration |
249 | 255 | */ |
250 | 256 | 'wiki_commons': { |
— | — | @@ -267,6 +273,18 @@ |
268 | 274 | |
269 | 275 | }, |
270 | 276 | |
| 277 | + /* |
| 278 | + * Kaltura aggregated search |
| 279 | + */ |
| 280 | + 'kaltura': { |
| 281 | + 'enabled': 1, |
| 282 | + 'checked': 1, |
| 283 | + 'homepage': 'http://kaltura.com', |
| 284 | + 'api_url': 'http://kaldev.kaltura.com/michael/federator.php', |
| 285 | + 'lib': 'kaltura', |
| 286 | + 'tab_image':false |
| 287 | + }, |
| 288 | + |
271 | 289 | /** |
272 | 290 | * Internet archive search provider configuration |
273 | 291 | */ |
— | — | @@ -399,7 +417,7 @@ |
400 | 418 | // A flag for proxy setup. |
401 | 419 | proxySetupDone: null, |
402 | 420 | |
403 | | - /* |
| 421 | + /** |
404 | 422 | * The initialisation function |
405 | 423 | * |
406 | 424 | * @param {Object} options Options to override: default_remote_search_options |
— | — | @@ -418,24 +436,27 @@ |
419 | 437 | if ( _this.enabled_providers.length == 1 && _this.enabled_providers[0] == 'all' ) |
420 | 438 | _this.enabled_providers = 'all'; |
421 | 439 | |
| 440 | + // Set the current_provider from default_provider |
| 441 | + if( this.default_provider && this.content_providers[ this.default_provider ] ){ |
| 442 | + this.current_provider = this.default_provider; |
| 443 | + } |
| 444 | + |
422 | 445 | // Set up content_providers |
423 | 446 | for ( var provider_id in this.content_providers ) { |
| 447 | + var provider = this.content_providers[ provider_id ]; |
424 | 448 | // Set the provider id |
425 | | - this.content_providers[ provider_id ][ 'id' ] = provider_id |
426 | | - |
427 | | - //Set local provider var: |
428 | | - var provider = this.content_providers[ provider_id ]; |
429 | | - |
430 | | - if ( _this.enabled_providers == 'all' && !this.currentProvider && provider.api_url ) { |
431 | | - this.currentProvider = provider_id; |
| 449 | + provider[ 'id' ] = provider_id |
| 450 | + |
| 451 | + if ( _this.enabled_providers == 'all' && !this.current_provider && provider.api_url ) { |
| 452 | + this.current_provider = provider_id; |
432 | 453 | break; |
433 | 454 | } else { |
434 | 455 | if ( $j.inArray( provider_id, _this.enabled_providers ) != -1 ) { |
435 | 456 | // This provider is enabled |
436 | 457 | this.content_providers[ provider_id ].enabled = true; |
437 | 458 | // Set the current provider to the first enabled one |
438 | | - if ( !this.currentProvider ) { |
439 | | - this.currentProvider = provider_id; |
| 459 | + if ( !this.current_provider ) { |
| 460 | + this.current_provider = provider_id; |
440 | 461 | } |
441 | 462 | } else { |
442 | 463 | // This provider is disabled |
— | — | @@ -634,6 +655,13 @@ |
635 | 656 | showDialog: function() { |
636 | 657 | var _this = this; |
637 | 658 | mw.log( "showDialog::" ); |
| 659 | + |
| 660 | + // Check if dialog target is present: |
| 661 | + if( $j( _this.target_container ).length == 0 ){ |
| 662 | + this.createUI(); |
| 663 | + return ; |
| 664 | + } |
| 665 | + |
638 | 666 | _this.clearTextboxCache(); |
639 | 667 | var query = _this.getDefaultQuery(); |
640 | 668 | if ( query != $j( '#rsd_q' ).val() ) { |
— | — | @@ -682,7 +710,7 @@ |
683 | 711 | return this.textboxValue; |
684 | 712 | }, |
685 | 713 | |
686 | | - /* |
| 714 | + /** |
687 | 715 | * Get the default query from the text selection |
688 | 716 | */ |
689 | 717 | getDefaultQuery: function() { |
— | — | @@ -942,13 +970,13 @@ |
943 | 971 | }, |
944 | 972 | |
945 | 973 | /** |
946 | | - * Show the current tab ( based on currentProvider var ) |
| 974 | + * Show the current tab ( based on current_provider var ) |
947 | 975 | */ |
948 | 976 | showCurrentTab: function() { |
949 | | - if ( this.currentProvider == 'upload' ) { |
| 977 | + if ( this.current_provider == 'upload' ) { |
950 | 978 | this.showUploadTab(); |
951 | 979 | } else { |
952 | | - this.showSearchTab( this.currentProvider, false ); |
| 980 | + this.showSearchTab( this.current_provider, false ); |
953 | 981 | } |
954 | 982 | }, |
955 | 983 | |
— | — | @@ -1108,11 +1136,11 @@ |
1109 | 1137 | } ); |
1110 | 1138 | return false; |
1111 | 1139 | } else if ( !this.isProviderLocal( provider ) && this.import_url_mode == 'none' ) { |
1112 | | - if ( this.currentProvider == 'combined' ) { |
| 1140 | + if ( this.current_provider == 'combined' ) { |
1113 | 1141 | // combined results are harder to error handle just ignore that repo |
1114 | 1142 | provider.sObj.loading = false; |
1115 | 1143 | } else { |
1116 | | - $j( '#tab-' + this.currentProvider ).html( |
| 1144 | + $j( '#tab-' + this.current_provider ).html( |
1117 | 1145 | '<div style="padding:10px">' + |
1118 | 1146 | gM( 'mwe-no_import_by_url' ) + |
1119 | 1147 | '</div>' ); |
— | — | @@ -1149,12 +1177,12 @@ |
1150 | 1178 | provider.lib + 'Search' |
1151 | 1179 | ], function() { |
1152 | 1180 | mw.log( "loaded lib:: " + provider.lib ); |
1153 | | - // else we need to run the search: |
| 1181 | + // Else we need to run the search: |
1154 | 1182 | var options = { |
1155 | 1183 | 'provider': provider, |
1156 | 1184 | 'rsd': _this |
1157 | 1185 | }; |
1158 | | - eval( 'provider.sObj = new ' + provider.lib + 'Search( options );' ); |
| 1186 | + provider.sObj = new window[ provider.lib + 'Search' ]( options ); |
1159 | 1187 | if ( !provider.sObj ) { |
1160 | 1188 | mw.log( 'Error: could not find search lib for ' + cp_id ); |
1161 | 1189 | return false; |
— | — | @@ -1227,7 +1255,7 @@ |
1228 | 1256 | var tabImage = mw.getMwEmbedPath() + '/skins/common/remote_cp/' + providerName + '_tab.png'; |
1229 | 1257 | if ( provider.enabled && provider.checked && provider.api_url ) { |
1230 | 1258 | // Add selected default if set |
1231 | | - if ( this.currentProvider == providerName ) |
| 1259 | + if ( this.current_provider == providerName ) |
1232 | 1260 | selected_tab = index; |
1233 | 1261 | |
1234 | 1262 | s += '<li class="rsd_cp_tab">'; |
— | — | @@ -1252,7 +1280,7 @@ |
1253 | 1281 | gM( 'mwe-upload_tab' ) + |
1254 | 1282 | '</a></li>'; |
1255 | 1283 | content += '<div id="tab-upload" />'; |
1256 | | - if ( this.currentProvider == 'upload' ) |
| 1284 | + if ( this.current_provider == 'upload' ) |
1257 | 1285 | selected_tab = index++; |
1258 | 1286 | } |
1259 | 1287 | s += '</ul>'; |
— | — | @@ -1301,33 +1329,33 @@ |
1302 | 1330 | }, |
1303 | 1331 | |
1304 | 1332 | /** |
1305 | | - * Show Results for the currentProvider |
| 1333 | + * Show Results for the current_provider |
1306 | 1334 | */ |
1307 | 1335 | showResults: function() { |
1308 | | - mw.log( 'f:showResults::' + this.currentProvider ); |
| 1336 | + mw.log( 'f:showResults::' + this.current_provider ); |
1309 | 1337 | var _this = this; |
1310 | 1338 | var o = ''; |
1311 | 1339 | var tabSelector = ''; |
1312 | 1340 | |
1313 | | - if ( this.currentProvider == 'upload' ) { |
| 1341 | + if ( this.current_provider == 'upload' ) { |
1314 | 1342 | tabSelector = '#upload_bin'; |
1315 | 1343 | var provider = _this.content_providers['this_wiki']; |
1316 | 1344 | } else { |
1317 | | - var provider = this.content_providers[ this.currentProvider ]; |
1318 | | - tabSelector = '#tab-' + this.currentProvider; |
| 1345 | + var provider = this.content_providers[ this.current_provider ]; |
| 1346 | + tabSelector = '#tab-' + this.current_provider; |
1319 | 1347 | // Output the results bar / controls |
1320 | 1348 | } |
1321 | 1349 | |
1322 | 1350 | // Empty the existing results: |
1323 | 1351 | $j( tabSelector ).empty(); |
1324 | 1352 | |
1325 | | - if ( this.currentProvider != 'upload' ) { |
| 1353 | + if ( this.current_provider != 'upload' ) { |
1326 | 1354 | _this.showResultsHeader(); |
1327 | 1355 | } |
1328 | 1356 | |
1329 | 1357 | var numResults = 0; |
1330 | 1358 | |
1331 | | - // Output all the results for the current currentProvider |
| 1359 | + // Output all the results for the current current_provider |
1332 | 1360 | if ( typeof provider['sObj'] != 'undefined' ) { |
1333 | 1361 | $j.each( provider.sObj.resultsObj, function( resIndex, resource ) { |
1334 | 1362 | o += _this.getResultHtml( provider, resIndex, resource ); |
— | — | @@ -1357,7 +1385,7 @@ |
1358 | 1386 | showFailure : function( resultStatus ){ |
1359 | 1387 | //only one type of resultStatus right now: |
1360 | 1388 | if( resultStatus == 'timeout' ) |
1361 | | - $j( '#tab-' + this.currentProvider ).text( |
| 1389 | + $j( '#tab-' + this.current_provider ).text( |
1362 | 1390 | gM('rsd-search-timeout') |
1363 | 1391 | ) |
1364 | 1392 | }, |
— | — | @@ -1397,7 +1425,7 @@ |
1398 | 1426 | // Get a thumb with proper resolution transform if possible: |
1399 | 1427 | var thumbUrl = provider.sObj.getImageTransform( resource, |
1400 | 1428 | { 'width' : this.thumb_width } ); |
1401 | | - |
| 1429 | + |
1402 | 1430 | o += '<img title="' + resource.title + '" ' + |
1403 | 1431 | 'class="rsd_res_item" id="res_' + provider.id + '__' + resIndex + '" ' + |
1404 | 1432 | 'style="width:' + this.thumb_width + 'px;" ' + |
— | — | @@ -1879,8 +1907,8 @@ |
1880 | 1908 | var proto = {}; |
1881 | 1909 | proto.prototype = resource; |
1882 | 1910 | var myRes = new proto; |
1883 | | - */ |
1884 | | - |
| 1911 | + */ |
| 1912 | + |
1885 | 1913 | // Update base target_resource_title: |
1886 | 1914 | resource.target_resource_title = resource.titleKey.replace( /^(File:|Image:)/ , '' ) |
1887 | 1915 | |
— | — | @@ -1948,7 +1976,8 @@ |
1949 | 1977 | } |
1950 | 1978 | } ); |
1951 | 1979 | }, |
1952 | | - /* |
| 1980 | + |
| 1981 | + /** |
1953 | 1982 | * Show Import User Interface |
1954 | 1983 | * |
1955 | 1984 | * @param {Object} resource Resource Object to be imported |
— | — | @@ -2484,12 +2513,12 @@ |
2485 | 2514 | var darkListUrl = mw.getConfig( 'skin_img_path' ) + 'list_layout_icon_dark.png'; |
2486 | 2515 | var lightListUrl = mw.getConfig( 'skin_img_path' ) + 'list_layout_icon.png'; |
2487 | 2516 | |
2488 | | - if ( !this.content_providers[ this.currentProvider ] ) { |
| 2517 | + if ( !this.content_providers[ this.current_provider ] ) { |
2489 | 2518 | return; |
2490 | 2519 | } |
2491 | | - var cp = this.content_providers[this.currentProvider]; |
| 2520 | + var cp = this.content_providers[this.current_provider]; |
2492 | 2521 | var resultsFromMsg = gM( 'mwe-results_from', |
2493 | | - [ cp.homepage, gM( 'rsd-' + this.currentProvider + '-title' ) ] ); |
| 2522 | + [ cp.homepage, gM( 'rsd-' + this.current_provider + '-title' ) ] ); |
2494 | 2523 | var defaultBoxUrl, defaultListUrl; |
2495 | 2524 | if ( _this.displayMode == 'box' ) { |
2496 | 2525 | defaultBoxUrl = darkBoxUrl; |
— | — | @@ -2502,7 +2531,7 @@ |
2503 | 2532 | var about_desc = '<span style="position:relative;top:0px;font-style:italic;">' + |
2504 | 2533 | '<i>' + resultsFromMsg + '</i></span>'; |
2505 | 2534 | |
2506 | | - $j( '#tab-' + this.currentProvider ).append( '<div id="rds_results_bar">' + |
| 2535 | + $j( '#tab-' + this.current_provider ).append( '<div id="rds_results_bar">' + |
2507 | 2536 | '<span style="float:left;top:0px;font-style:italic;">' + |
2508 | 2537 | gM( 'rsd_layout' ) + ' ' + |
2509 | 2538 | '<img id="msc_box_layout" ' + |
— | — | @@ -2552,19 +2581,19 @@ |
2553 | 2582 | }, |
2554 | 2583 | |
2555 | 2584 | /** |
2556 | | - * Shows pagging for a given target for a given currentProvider |
| 2585 | + * Shows pagging for a given target for a given current_provider |
2557 | 2586 | * |
2558 | 2587 | * @param {String} target jQuery Selector for pagging Header output |
2559 | 2588 | */ |
2560 | 2589 | showPagingHeader: function( target ) { |
2561 | 2590 | var _this = this; |
2562 | | - if ( _this.currentProvider == 'upload' ) { |
| 2591 | + if ( _this.current_provider == 'upload' ) { |
2563 | 2592 | var provider = _this.content_providers['this_wiki']; |
2564 | 2593 | } else { |
2565 | | - var provider = _this.content_providers[ _this.currentProvider ]; |
| 2594 | + var provider = _this.content_providers[ _this.current_provider ]; |
2566 | 2595 | } |
2567 | 2596 | var search = provider.sObj; |
2568 | | - mw.log( 'showPagingHeader:' + _this.currentProvider + ' len: ' + search.num_results ); |
| 2597 | + mw.log( 'showPagingHeader:' + _this.current_provider + ' len: ' + search.num_results ); |
2569 | 2598 | var to_num = ( provider.limit > search.num_results ) ? |
2570 | 2599 | ( parseInt( provider.offset ) + parseInt( search.num_results ) ) : |
2571 | 2600 | ( parseInt( provider.offset ) + parseInt( provider.limit ) ); |
— | — | @@ -2610,8 +2639,8 @@ |
2611 | 2640 | */ |
2612 | 2641 | selectTab: function( provider_id ) { |
2613 | 2642 | mw.log( 'select tab: ' + provider_id ); |
2614 | | - this.currentProvider = provider_id; |
2615 | | - if ( this.currentProvider == 'upload' ) { |
| 2643 | + this.current_provider = provider_id; |
| 2644 | + if ( this.current_provider == 'upload' ) { |
2616 | 2645 | this.showUploadTab(); |
2617 | 2646 | } else { |
2618 | 2647 | // update the search results: |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -1297,7 +1297,7 @@ |
1298 | 1298 | if( !data['format'] ) |
1299 | 1299 | data['format'] = 'json'; |
1300 | 1300 | |
1301 | | - mw.log("run getJSON: " + url + ' data: ' + data['action'] + ' apiPost: ' +mw.getConfig( 'apiPostActions' ) ); |
| 1301 | + mw.log("run getJSON: " + url + ' data: ' + data['action'] ); |
1302 | 1302 | |
1303 | 1303 | if( $j.inArray( data['action'], mw.getConfig( 'apiPostActions' ) ) != -1 ){ |
1304 | 1304 | if( ! mw.isLocalDomain( url ) ){ |