Index: branches/js2-work/phase3/js/mwEmbed/tests/Sequence_Editor.html |
— | — | @@ -11,7 +11,9 @@ |
12 | 12 | 'mv_pl_src':'media/sequence_transition_smil.xml', |
13 | 13 | //set the add media wizard to only include commons: |
14 | 14 | 'amw_conf':{ |
15 | | - 'enabled_providers':['wiki_commons'] |
| 15 | + 'enabled_providers':[ 'wiki_commons', 'kaltura', 'archive_org', 'flickr', 'metavid' ], |
| 16 | + 'import_url_mode' : 'remote_link', |
| 17 | + 'default_query' : 'fish' |
16 | 18 | } |
17 | 19 | }); |
18 | 20 | }); |
Index: branches/js2-work/phase3/js/mwEmbed/tests/Add_Media_Wizard.html |
— | — | @@ -33,10 +33,8 @@ |
34 | 34 | //we only enabled commons |
35 | 35 | //(since javascript includes from other servers would be problamatic ) in a default install |
36 | 36 | //** but you can set this to 'all' to pull from multiple repositories |
37 | | - 'enabled_providers' : [ 'wiki_commons', 'kaltura', 'archive_org', 'flickr', 'metavid' ], |
| 37 | + 'enabled_providers' : [ 'wiki_commons', 'kaltura', 'archive_org', 'flickr', 'metavid' ] |
38 | 38 | |
39 | | - //the local wiki api url: |
40 | | - 'local_wiki_api_url': 'none' |
41 | 39 | } ); |
42 | 40 | } ); |
43 | 41 | }); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -88,9 +88,6 @@ |
89 | 89 | |
90 | 90 | // The target button or link that will invoke the search interface |
91 | 91 | 'target_invoke_button': null, |
92 | | - |
93 | | - // The local wiki api url usually: wgServer + wgScriptPath + '/api.php' |
94 | | - 'local_wiki_api_url': null, |
95 | 92 | |
96 | 93 | /** |
97 | 94 | * import_url_mode |
— | — | @@ -99,8 +96,14 @@ |
100 | 97 | * autodetect: checks for api support before using the api to insert the media asset |
101 | 98 | * remote_link: hot-links the media directly into the page as html |
102 | 99 | */ |
103 | | - 'import_url_mode': 'api', |
| 100 | + 'import_url_mode': 'api', |
104 | 101 | |
| 102 | + // The api target can be "local" or the url or remote api entry point |
| 103 | + 'upload_api_target': 'local', |
| 104 | + |
| 105 | + // Name of the upload target |
| 106 | + 'upload_api_name': null, |
| 107 | + |
105 | 108 | // Target title used for previews of wiki page usually: wgPageName |
106 | 109 | 'target_title': null, |
107 | 110 | |
— | — | @@ -117,17 +120,8 @@ |
118 | 121 | 'default_query': null, |
119 | 122 | |
120 | 123 | // Canonical namespace prefix for images/ files |
121 | | - 'canonicalFileNS': 'File', |
| 124 | + 'canonicalFileNS': 'File', |
122 | 125 | |
123 | | - // The api target can be "local" or the url or remote api entry point |
124 | | - 'upload_api_target': 'local', |
125 | | - |
126 | | - // Name of the upload target |
127 | | - 'upload_api_name': null, |
128 | | - |
129 | | - // Name of the remote proxy page that will host the iframe api callback |
130 | | - 'upload_api_proxy_frame': null, |
131 | | - |
132 | 126 | // Enabled providers can be keyword 'all' or an array of enabled content provider keys |
133 | 127 | 'enabled_providers': 'all', |
134 | 128 | |
— | — | @@ -162,7 +156,7 @@ |
163 | 157 | } |
164 | 158 | |
165 | 159 | $.addMediaWizard = function( options ){ |
166 | | - $.fn.addMediaWizard ( options, function( amwObj ) { |
| 160 | + $.fn.addMediaWizard ( options, function( amwObj ) { |
167 | 161 | // do the add-media-wizard display |
168 | 162 | amwObj.createUI(); |
169 | 163 | } ) |
— | — | @@ -409,11 +403,8 @@ |
410 | 404 | displayMode : 'box', // box or list |
411 | 405 | |
412 | 406 | // The ClipEdit Object |
413 | | - clipEdit: null, |
| 407 | + clipEdit: null, |
414 | 408 | |
415 | | - // A flag for proxy setup. |
416 | | - proxySetupDone: null, |
417 | | - |
418 | 409 | /** |
419 | 410 | * The initialisation function |
420 | 411 | * |
— | — | @@ -475,24 +466,20 @@ |
476 | 467 | this.content_providers[ 'upload' ].enabled = false; |
477 | 468 | } |
478 | 469 | |
479 | | - // Set the target to "proxy" if a proxy frame is configured |
480 | | - if ( _this.upload_api_proxy_frame ) |
481 | | - _this.upload_api_target = 'proxy'; |
482 | 470 | |
483 | 471 | // Set up the local API upload URL |
484 | 472 | if ( _this.upload_api_target == 'local' ) { |
485 | | - if ( ! _this.local_wiki_api_url ) { |
486 | | - this.$resultsContainer.html( gM( 'rsd_config_error', 'missing_local_api_url' ) ); |
| 473 | + if ( ! mw.getLocalApiUrl() ) { |
| 474 | + $j( this.target_container ).html( gM( 'rsd_config_error', 'missing_local_api_url' ) ); |
487 | 475 | return false; |
488 | 476 | } else { |
489 | | - _this.upload_api_target = _this.local_wiki_api_url; |
| 477 | + _this.upload_api_target = mw.getLocalApiUrl(); |
490 | 478 | } |
491 | 479 | } |
492 | 480 | |
493 | 481 | // Set up the "add media wizard" button, which invokes this object |
494 | 482 | if ( !this.target_invoke_button || $j( this.target_invoke_button ).length == 0 ) { |
495 | | - mw.log( "RemoteSearchDriver:: no target invocation provided " + |
496 | | - "(will have to run your own createUI() )" ); |
| 483 | + mw.log( "RemoteSearchDriver:: no target invocation provided " ); |
497 | 484 | } else { |
498 | 485 | if ( this.target_invoke_button ) { |
499 | 486 | $j( this.target_invoke_button ) |
— | — | @@ -669,12 +656,16 @@ |
670 | 657 | * Creates the remote search driver User Interface |
671 | 658 | */ |
672 | 659 | createUI: function() { |
673 | | - var _this = this; |
674 | | - |
| 660 | + var _this = this; |
675 | 661 | this.clearTextboxCache(); |
676 | 662 | |
677 | | - // Setup the parent container: |
678 | | - this.createDialogContainer(); |
| 663 | + // Setup the parent container (if not already created) |
| 664 | + if( $j( _this.target_container ).length == 0 ){ |
| 665 | + this.createDialogContainer(); |
| 666 | + }else{ |
| 667 | + // Empty out the target |
| 668 | + $j( _this.target_container ).empty(); |
| 669 | + } |
679 | 670 | |
680 | 671 | // Setup remote search dialog & bindings |
681 | 672 | this.initDialog(); |
— | — | @@ -699,11 +690,9 @@ |
700 | 691 | var _this = this; |
701 | 692 | mw.log( "showDialog::" ); |
702 | 693 | |
703 | | - // Check if dialog target is present: |
704 | | - if( $j( _this.target_container ).length == 0 ){ |
705 | | - this.createUI(); |
706 | | - return ; |
707 | | - } |
| 694 | + // Create the UI |
| 695 | + this.createUI(); |
| 696 | + |
708 | 697 | |
709 | 698 | _this.clearTextboxCache(); |
710 | 699 | var query = _this.getDefaultQuery(); |
— | — | @@ -1525,7 +1514,11 @@ |
1526 | 1515 | }, |
1527 | 1516 | |
1528 | 1517 | /** |
1529 | | - * Get result html for box layout (see getResultHtml for params) |
| 1518 | + * Get result html for box layout |
| 1519 | + * |
| 1520 | + * @param {Object} provider the content provider for result |
| 1521 | + * @param {Number} resIndex the resource index to build unique ids |
| 1522 | + * @param {Object} resource the resource object |
1530 | 1523 | */ |
1531 | 1524 | getResultHtmlBox: function( provider, resIndex, resource ) { |
1532 | 1525 | |
— | — | @@ -1583,7 +1576,11 @@ |
1584 | 1577 | }, |
1585 | 1578 | |
1586 | 1579 | /** |
1587 | | - * Get result html for list layout (see getResultHtml for params) |
| 1580 | + * Get result html for list layout |
| 1581 | + * |
| 1582 | + * @param {Object} provider the content provider for result |
| 1583 | + * @param {Number} resIndex the resource index to build unique ids |
| 1584 | + * @param {Object} resource the resource object |
1588 | 1585 | */ |
1589 | 1586 | getResultHtmlList:function( provider, resIndex, resource ) { |
1590 | 1587 | |
— | — | @@ -2024,7 +2021,7 @@ |
2025 | 2022 | return true; |
2026 | 2023 | } else { |
2027 | 2024 | // Check if we can embed the content locally per a domain name check: |
2028 | | - var localHost = mw.parseUri( this.local_wiki_api_url ).host; |
| 2025 | + var localHost = mw.parseUri( mw.getLocalApiUrl() ).host; |
2029 | 2026 | if ( provider.local_domains ) { |
2030 | 2027 | for ( var i = 0; i < provider.local_domains.length; i++ ) { |
2031 | 2028 | var domain = provider.local_domains[i]; |
— | — | @@ -2429,7 +2426,7 @@ |
2430 | 2427 | 'iiurlwidth': '400' |
2431 | 2428 | }; |
2432 | 2429 | // First check the api for imagerepository |
2433 | | - mw.getJSON( this.local_wiki_api_url, request, function( data ) { |
| 2430 | + mw.getJSON( mw.getLocalApiUrl(), request, function( data ) { |
2434 | 2431 | if ( data.query.pages ) { |
2435 | 2432 | for ( var i in data.query.pages ) { |
2436 | 2433 | if( i == '-1' ){ |
— | — | @@ -2604,41 +2601,9 @@ |
2605 | 2602 | } else { |
2606 | 2603 | return resource.pSobj.getEmbedWikiCode( resource ); |
2607 | 2604 | } |
2608 | | - }, |
| 2605 | + }, |
2609 | 2606 | |
2610 | 2607 | /** |
2611 | | - * Get the preview text for a given resource |
2612 | | - * |
2613 | | - * builds the wikitext represnetation and |
2614 | | - * issues an api call to gennerate a preview |
2615 | | - * |
2616 | | - * @param {Object} resource Resource to get preview text for. |
2617 | | - */ |
2618 | | - /*getPreviewText: function( resource ) { |
2619 | | - var _this = this; |
2620 | | - var text; |
2621 | | - |
2622 | | - // Insert at start if textInput cursor has not been set (ie == length) |
2623 | | - var insertPos = _this.getCaretPos(); |
2624 | | - var originalText = _this.getTextboxValue(); |
2625 | | - var embedCode = _this.getEmbedCode( resource ); |
2626 | | - if ( insertPos !== false && originalText ) { |
2627 | | - if ( originalText.length == insertPos ) { |
2628 | | - insertPos = 0; |
2629 | | - } |
2630 | | - text = originalText.substring( 0, insertPos ) + |
2631 | | - embedCode + originalText.substring( insertPos ); |
2632 | | - } else { |
2633 | | - text = $j( _this.target_textbox ).val() + embedCode; |
2634 | | - } |
2635 | | - // check for missing </references> |
2636 | | - if ( text.indexOf( '<references/>' ) == -1 && text.indexOf( '<ref>' ) != -1 ) { |
2637 | | - text = text + '<references/>'; |
2638 | | - } |
2639 | | - return text; |
2640 | | - },*/ |
2641 | | - |
2642 | | - /** |
2643 | 2608 | * issues the wikitext parse call |
2644 | 2609 | * |
2645 | 2610 | * @param {String} wikitext Wiki Text to be parsed by mediaWiki api call |
— | — | @@ -2646,7 +2611,7 @@ |
2647 | 2612 | * @param {Function} callback Function called with api parser output |
2648 | 2613 | */ |
2649 | 2614 | parse: function( wikitext, title, callback ) { |
2650 | | - mw.getJSON( this.local_wiki_api_url, |
| 2615 | + mw.getJSON( mw.getLocalApiUrl(), |
2651 | 2616 | { |
2652 | 2617 | 'action': 'parse', |
2653 | 2618 | 'title' : title, |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.SeqRemoteSearchDriver.js |
— | — | @@ -16,7 +16,6 @@ |
17 | 17 | this.pSeq = mySequence; |
18 | 18 | var options = { |
19 | 19 | 'target_container' : '#cliplib_ic', |
20 | | - 'local_wiki_api_url': mySequence.getLocalApiUrl(), |
21 | 20 | 'instance_name' : mySequence.instance_name + '.mySearch', |
22 | 21 | 'default_query' : this.pSeq.plObj.title |
23 | 22 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.Sequencer.js |
— | — | @@ -183,7 +183,7 @@ |
184 | 184 | 'mw.SeqRemoteSearchDriver' |
185 | 185 | ], function() { |
186 | 186 | this_seq.mySearch = new mw.SeqRemoteSearchDriver( this_seq ); |
187 | | - this_seq.mySearch.createUI(); |
| 187 | + this_seq.mySearch.showDialog(); |
188 | 188 | } ); |
189 | 189 | } |
190 | 190 | }, |
— | — | @@ -263,25 +263,9 @@ |
264 | 264 | ).css( { |
265 | 265 | 'min-width':'850px' |
266 | 266 | } ); |
| 267 | + |
267 | 268 | |
268 | | - /*mw.log('set: '+this.target_sequence_container + ' html to:'+ "\n"+ |
269 | | - $j(this.target_sequence_container).html() |
270 | | - );*/ |
271 | | - |
272 | | - // first check if we got a cloned PL object: |
273 | | - // (when the editor is invoked with the plalylist already on the page) |
274 | | - /*if( this.plObj != 'null' ){ |
275 | | - mw.log('found plObj clone'); |
276 | | - //extend with mvSeqPlayList object: |
277 | | - this.plObj = new mvSeqPlayList(this.plObj); |
278 | | - mw.log('mvSeqPlayList added: ' + this.plObj.org_control_height ); |
279 | | - $j('#'+this.video_container_id).get(0).attachNode( this.plObj ); |
280 | | - this.plObj.getHTML(); |
281 | | - this.checkReadyPlObj(); |
282 | | - return ; |
283 | | - }*/ |
284 | | - |
285 | | - // else check for source based sequence editor (a clean page load of the editor) |
| 269 | + // Check for source based sequence editor (a clean page load of the editor) |
286 | 270 | if ( this.mv_pl_src != 'null' ) { |
287 | 271 | mw.log( ' pl src:: ' + this.mv_pl_src ); |
288 | 272 | var src_attr = ' src="' + this.mv_pl_src + '" '; |
— | — | @@ -307,7 +291,7 @@ |
308 | 292 | $j.btnHtml( gM( 'mwe-edit_cancel' ), 'seq_edit_cancel', 'close' ) |
309 | 293 | ); |
310 | 294 | } else { |
311 | | - $j( this.target_sequence_container + ' .seq_save_cancel' ).html( cancel_button + gM( 'mwe-no_edit_permissions' ) ); |
| 295 | + $j( this.target_sequence_container + ' .seq_save_cancel' ).html( gM( 'mwe-no_edit_permissions' ) ); |
312 | 296 | } |
313 | 297 | // assing bindings |
314 | 298 | $j( this.target_sequence_container + ' .seq_edit_cancel' ).unbind().click( function() { |
— | — | @@ -383,7 +367,7 @@ |
384 | 368 | if ( !dispCall ) |
385 | 369 | $j( "#seq_menu" ).tabs( 'select', this.menu_items[item].inx ); |
386 | 370 | |
387 | | - this.menu_items[item].default = 1; |
| 371 | + this.menu_items[item]['default'] = 1; |
388 | 372 | // do any click_js actions:getInsertControl |
389 | 373 | if ( this.menu_items[item].click_js ) |
390 | 374 | this.menu_items[item].click_js( this ); |
— | — | @@ -535,7 +519,12 @@ |
536 | 520 | // propagate the edit tokens |
537 | 521 | // if on an edit page just grab from the form: |
538 | 522 | this.sequenceEditToken = $j( 'input[wpEditToken]' ).val(); |
539 | | - |
| 523 | + |
| 524 | + // Update the buttons for no Api url (local editor) |
| 525 | + if( !this.getLocalApiUrl() ){ |
| 526 | + _this.updateSeqSaveButtons(); |
| 527 | + } |
| 528 | + |
540 | 529 | if ( typeof this.sequenceEditToken == 'undefined' && this.getLocalApiUrl() != null ) { |
541 | 530 | mw.getToken( _this.getLocalApiUrl(), _this.plObj.mTitle, function( token ) { |
542 | 531 | if ( token ) { |
— | — | @@ -585,7 +574,7 @@ |
586 | 575 | for ( var tab_id in this.menu_items ) { |
587 | 576 | menu_item = this.menu_items[tab_id]; |
588 | 577 | menu_item.inx = inx; |
589 | | - if ( menu_item.default ) { |
| 578 | + if ( menu_item['default'] ) { |
590 | 579 | selected_tab = inx; |
591 | 580 | _this.disp_menu_item = tab_id; |
592 | 581 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.PlayList.js |
— | — | @@ -973,7 +973,8 @@ |
974 | 974 | |
975 | 975 | var cur_pixle = 0; |
976 | 976 | // set up _this |
977 | | - |
| 977 | + //remove any old cl_status |
| 978 | + _this.$interface.find( '.play_head' ).find('.cl_status').remove(); |
978 | 979 | // mw.log("do play head total dur: "+pl_duration ); |
979 | 980 | $j.each( this.default_track.clips, function( i, clip ) { |
980 | 981 | // (use getSoloDuration to not include transitions and such) |
— | — | @@ -996,8 +997,7 @@ |
997 | 998 | |
998 | 999 | barHtml += '</div>'; |
999 | 1000 | |
1000 | | - // background:#DDD +clip.getColor(); |
1001 | | - |
| 1001 | + // background:#DDD +clip.getColor(); |
1002 | 1002 | _this.$interface.find( '.play_head' ).append( barHtml ); |
1003 | 1003 | |
1004 | 1004 | // mw.log('offset:' + cur_pixle +' width:'+pwidth+' add clip'+ clip.id + ' is '+clip.embed.getDuration() +' = ' + perc +' of ' + _this.track_len); |
Index: branches/js2-work/phase3/js/loader.js |
— | — | @@ -5,8 +5,8 @@ |
6 | 6 | mw.setConfig('loaderContext', wgScriptPath + '/js/'); |
7 | 7 | |
8 | 8 | mw.addClassFilePaths( { |
9 | | - 'uploadPage' : 'js/uploadPage.js', |
10 | | - 'editPage' : 'js/editPage.js', |
11 | | - 'ajaxCategories': 'js/ajaxcategories.js', |
12 | | - 'apiProxyPage' : 'js/apiProxyPage.js' |
| 9 | + 'uploadPage' : 'uploadPage.js', |
| 10 | + 'editPage' : 'editPage.js', |
| 11 | + 'ajaxCategories': 'ajaxcategories.js', |
| 12 | + 'apiProxyPage' : 'apiProxyPage.js' |
13 | 13 | } ); |
\ No newline at end of file |