Index: branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -1636,8 +1636,9 @@ |
1637 | 1637 | callback( provider ); |
1638 | 1638 | } ); |
1639 | 1639 | }, |
| 1640 | + |
1640 | 1641 | /** |
1641 | | - * get a resource from a url loads the provider if not already initialized |
| 1642 | + * Get a resource from a url loads the provider if not already initialized |
1642 | 1643 | */ |
1643 | 1644 | getResourceFromUrl: function ( provider, url, callback){ |
1644 | 1645 | if (!provider.sObj) { |
— | — | @@ -1650,8 +1651,20 @@ |
1651 | 1652 | } |
1652 | 1653 | }, |
1653 | 1654 | |
1654 | | - |
1655 | 1655 | /** |
| 1656 | + * Get a resource from a titleKey loads the provider if not already initialized |
| 1657 | + */ |
| 1658 | + getResourceFromTitleKey: function ( provider, title, callback){ |
| 1659 | + if (!provider.sObj) { |
| 1660 | + this.loadSearchLib( provider, function( provider ){ |
| 1661 | + provider.sObj.getByTitle( title, callback); |
| 1662 | + }); |
| 1663 | + } |
| 1664 | + else { |
| 1665 | + provider.sObj.getByTitle( title, callback); |
| 1666 | + } |
| 1667 | + }, |
| 1668 | + /** |
1656 | 1669 | * Get a resource object from a resource id |
1657 | 1670 | * |
1658 | 1671 | * NOTE: We could bind resource objects to html elements to avoid this lookup |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -106,11 +106,14 @@ |
107 | 107 | |
108 | 108 | // If the player controls should be overlaid |
109 | 109 | //( Global default via config EmbedPlayer.OverlayControls in module loader.js) |
110 | | - "overlayControls" : true, |
| 110 | + "overlaycontrols" : true, |
111 | 111 | |
112 | 112 | // Attribute to use 'native' controls |
113 | 113 | "usenativecontrols" : false, |
114 | 114 | |
| 115 | + // If the player should include an attribution button: |
| 116 | + 'attributionbutton' : true, |
| 117 | + |
115 | 118 | // ROE url ( for xml based metadata ) |
116 | 119 | // also see: http://wiki.xiph.org/ROE |
117 | 120 | "roe" : null, |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js |
— | — | @@ -166,7 +166,7 @@ |
167 | 167 | this.supportedComponets['timedText'] = true; |
168 | 168 | } |
169 | 169 | // Check for Attribution button |
170 | | - if( mw.getConfig( 'EmbedPlayer.AttributionButton' ) ){ |
| 170 | + if( mw.getConfig( 'EmbedPlayer.AttributionButton' ) && embedPlayer.attributionbutton ){ |
171 | 171 | this.supportedComponets[ 'attributionButton' ] = true; |
172 | 172 | } |
173 | 173 | |
— | — | @@ -640,7 +640,7 @@ |
641 | 641 | } |
642 | 642 | |
643 | 643 | // If disabled via the player |
644 | | - if( this.embedPlayer.overlayControls === false ){ |
| 644 | + if( this.embedPlayer.overlaycontrols === false ){ |
645 | 645 | return false; |
646 | 646 | } |
647 | 647 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js |
— | — | @@ -1,126 +0,0 @@ |
2 | | -/** |
3 | | -* Sequencer add by url support ( ties into mwEmbed AddMedia remoteSearchDriver module ) |
4 | | -*/ |
5 | | - |
6 | | -//Wrap in mw closure |
7 | | -( function( mw ) { |
8 | | - |
9 | | -mw.SequencerAddByUrl = function( sequencer ) { |
10 | | - return this.init( sequencer ); |
11 | | -}; |
12 | | -mw.SequencerAddByUrl.prototype = { |
13 | | - init: function( sequencer ){ |
14 | | - this.sequencer = sequencer; |
15 | | - }, |
16 | | - |
17 | | - /** |
18 | | - * Does a basic parseUri check to see if a string is likely a url: |
19 | | - */ |
20 | | - isUrl: function( inputString ){ |
21 | | - return ( mw.parseUri( inputString ).protocol ) ; |
22 | | - }, |
23 | | - |
24 | | - /** |
25 | | - * Try to add media via url and present a dialog if failed |
26 | | - * or user input is required |
27 | | - * |
28 | | - * Uses remoteSearchDriver to help in retrieving entry info |
29 | | - * @param {Object} remoteSearchDriver The remote search driver |
30 | | - */ |
31 | | - addByUrlDialog: function( remoteSearchDriver, importUrl ){ |
32 | | - var _this = this; |
33 | | - var importUrl = unescape( importUrl ); |
34 | | - mw.log('SequencerAddByUrl::addByUrlDialog:'+ importUrl); |
35 | | - var $dialog = mw.addLoaderDialog( gM( 'mwe-sequencer-loading-asset' ) ); |
36 | | - |
37 | | - // Close / empty the toolWindow |
38 | | - _this.sequencer.getTools().setDefaultText(); |
39 | | - |
40 | | - var foundImportUrl = false; |
41 | | - // See if the asset matches the detailsUrl key type of any enabled content provider: |
42 | | - $j.each( remoteSearchDriver.getEnabledProviders(), function(providerName, provider){ |
43 | | - if( mw.parseUri( provider.detailsUrl ).host == mw.parseUri( importUrl).host ){ |
44 | | - foundImportUrl = true; |
45 | | - mw.log( "addByUrlDialog: matching host getResourceFromUrl::" |
46 | | - + mw.parseUri( provider.detailsUrl ).host |
47 | | - + ' == ' + mw.parseUri( importUrl ).host ); |
48 | | - |
49 | | - // Do special check for mediawiki templates and pages as 'special' smil types |
50 | | - if( provider.lib == 'mediaWiki' ){ |
51 | | - // xxx we should do a query to the api to determine namespace instead of hard coded checks |
52 | | - remoteSearchDriver.loadSearchLib( provider, function( provider ){ |
53 | | - var titleKey = provider.sObj.getTitleKeyFromMwUrl( importUrl ); |
54 | | - if( !titleKey ){ |
55 | | - $dialog.html( gM('mwe-sequencer-import-url-not-supported', 'commons.wikimedia.org' ) ) |
56 | | - // continue for loop ( if we can't get a title from the mediaWiki url ) |
57 | | - return true; |
58 | | - } |
59 | | - |
60 | | - // Check the title type |
61 | | - // xxx should use wgFormattedNamespacess |
62 | | - if( titleKey.indexOf('File:') == 0 ){ |
63 | | - // Asset is a file import resource as a file: |
64 | | - remoteSearchDriver.getResourceFromUrl( provider, importUrl, function( resource ){ |
65 | | - if( ! resource ){ |
66 | | - $dialog.html( 'Error loading asset'); |
67 | | - return ; |
68 | | - } |
69 | | - // Get convert resource to smilClip and insert into the timeline |
70 | | - _this |
71 | | - .sequencer |
72 | | - .getAddMedia() |
73 | | - .getSmilClipFromResource( resource, function( smilClip ) { |
74 | | - _this.sequencer.getTimeline().insertSmilClipEdit( smilClip ); |
75 | | - mw.closeLoaderDialog(); |
76 | | - }); |
77 | | - }); |
78 | | - } else if( titleKey.indexOf('Template:') == 0 ) { |
79 | | - // Parse any parameters we can find: |
80 | | - var apiProvider = ''; |
81 | | - if( mw.parseUri(provider.apiUrl ).host == 'commons.wikimedia.org' ){ |
82 | | - apiProvider = 'commons' |
83 | | - } else { |
84 | | - // xxx we need to abstract the remoteSearch driver provider logic |
85 | | - // into a provider class |
86 | | - apiProvider = 'local'; |
87 | | - } |
88 | | - // Get template smilClip: |
89 | | - var smilClip = _this |
90 | | - .sequencer |
91 | | - .getAddMedia() |
92 | | - .getSmilClipFromWikiTemplate( titleKey, apiProvider ); |
93 | | - |
94 | | - // Add the smil clip to the sequencer |
95 | | - _this.sequencer.getTimeline().insertSmilClipEdit( smilClip ); |
96 | | - |
97 | | - // Close the dialog loading: |
98 | | - mw.closeLoaderDialog(); |
99 | | - |
100 | | - /* |
101 | | - * Soon sequence transclution fun: |
102 | | - * else if( titleKey.indexOf('Sequence:') == 0 ) { |
103 | | - */ |
104 | | - |
105 | | - } else { |
106 | | - $dialog.html( 'Error loading asset type'); |
107 | | - } |
108 | | - |
109 | | - }); |
110 | | - } else { |
111 | | - mw.log(" only MediaWiki URLs supported as resources right now"); |
112 | | - } |
113 | | - } |
114 | | - }); |
115 | | - |
116 | | - if( ! foundImportUrl ){ |
117 | | - $dialog.html( gM('mwe-sequencer-import-url-not-supported', 'commons.wikimedia.org' ) ); |
118 | | - } |
119 | | - |
120 | | - // xxx support direct asset include |
121 | | - if( mw.getConfig( 'Sequencer.AddAssetByUrl' )){ |
122 | | - // try directly adding the asset |
123 | | - } |
124 | | - } |
125 | | -}; |
126 | | - |
127 | | -} )( window.mw ); |
\ No newline at end of file |
Index: branches/MwEmbedStandAlone/modules/Sequencer/loader.js |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | |
21 | 21 | "mw.SequencerServer" : "mw.SequencerServer.js", |
22 | 22 | "mw.SequencerAddMedia" : "mw.SequencerAddMedia.js", |
23 | | - "mw.SequencerAddByUrl" : "mw.SequencerAddByUrl.js", |
| 23 | + "mw.SequencerAddByUri" : "mw.SequencerAddByUri.js", |
24 | 24 | "mw.SequencerPlayer" : "mw.SequencerPlayer.js", |
25 | 25 | "mw.SequencerTimeline" : "mw.SequencerTimeline.js", |
26 | 26 | "mw.SequencerKeyBindings" : "mw.SequencerKeyBindings.js", |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | [ |
70 | 70 | '$j.contextMenu', |
71 | 71 | 'mw.SequencerServer', |
72 | | - 'mw.SequencerAddByUrl', |
| 72 | + 'mw.SequencerAddByUri', |
73 | 73 | 'mw.SequencerAddMedia', |
74 | 74 | 'mw.SequencerPlayer', |
75 | 75 | 'mw.SequencerRender', |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js |
— | — | @@ -294,11 +294,11 @@ |
295 | 295 | } |
296 | 296 | return this.addMedia; |
297 | 297 | }, |
298 | | - getAddByUrl: function(){ |
299 | | - if( ! this.addByUrl ){ |
300 | | - this.addByUrl = new mw.SequencerAddByUrl( this ); |
| 298 | + getAddByUri: function(){ |
| 299 | + if( ! this.addByUri ){ |
| 300 | + this.addByUri = new mw.SequencerAddByUri( this ); |
301 | 301 | } |
302 | | - return this.addByUrl |
| 302 | + return this.addByUri |
303 | 303 | }, |
304 | 304 | getKeyBindings:function(){ |
305 | 305 | if( ! this.keyBindings ){ |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/mw.SequencerTools.js |
— | — | @@ -605,7 +605,7 @@ |
606 | 606 | return ; |
607 | 607 | } |
608 | 608 | $j( target ).empty().append( |
609 | | - $j('<h3 />').text( gM('mwe-sequencer-editTemplate-params') ) |
| 609 | + $j('<h3 />').text( gM('mwe-sequencer-edittemplate-params') ) |
610 | 610 | ) |
611 | 611 | |
612 | 612 | // This is not supposed to be perfect .. |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js |
— | — | @@ -117,9 +117,10 @@ |
118 | 118 | |
119 | 119 | this.getSearchDriver( function( remoteSearchDriver ){ |
120 | 120 | // Check if input value can be handled by url |
121 | | - var inputValue = _this.sequencer.getMenuTarget().find('input.searchMedia').val(); |
122 | | - if( _this.sequencer.getAddByUrl().isUrl( inputValue) ){ |
123 | | - _this.sequencer.getAddByUrl().addByUrlDialog( remoteSearchDriver, inputValue ); |
| 121 | + var inputValue = _this.sequencer.getMenuTarget().find('input.searchMedia').val(); |
| 122 | + |
| 123 | + if( _this.sequencer.getAddByUri().isUri( inputValue) ){ |
| 124 | + _this.sequencer.getAddByUri().addByUriDialog( remoteSearchDriver, inputValue ); |
124 | 125 | } else { |
125 | 126 | // Else just use the remoteSearchDriver search interface |
126 | 127 | remoteSearchDriver.createUI(); |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerPlayer.js |
— | — | @@ -34,7 +34,9 @@ |
35 | 35 | $video.css( |
36 | 36 | _this.getPlayerSize() |
37 | 37 | ).attr({ |
38 | | - 'id' : _this.getSmilPlayerId() |
| 38 | + 'id' : _this.getSmilPlayerId(), |
| 39 | + 'attributionbutton' : false, |
| 40 | + 'overlaycontrols' : false |
39 | 41 | }).append( |
40 | 42 | $j('<source />').attr({ |
41 | 43 | 'type' : 'application/smil', |
— | — | @@ -46,9 +48,7 @@ |
47 | 49 | // Draw the player ( keep the playhead for now ) |
48 | 50 | // xxx we will eventually replace the playhead with sequence |
49 | 51 | // based playhead interface for doing easy trims |
50 | | - $j( '#' + _this.getSmilPlayerId() ).embedPlayer({ |
51 | | - 'overlayControls' : false |
52 | | - }, function(){ |
| 52 | + $j( '#' + _this.getSmilPlayerId() ).embedPlayer({}, function(){ |
53 | 53 | // Set the player interface to autoMargin ( need to fix css propagation in embed player) |
54 | 54 | $j( '#' + _this.getSmilPlayerId() ).parent('.interface_wrap').css('margin', 'auto'); |
55 | 55 | if( callback ){ |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUri.js |
— | — | @@ -0,0 +1,157 @@ |
| 2 | +/** |
| 3 | +* Sequencer add by url support ( ties into mwEmbed AddMedia remoteSearchDriver module ) |
| 4 | +*/ |
| 5 | + |
| 6 | +//Wrap in mw closure |
| 7 | +( function( mw ) { |
| 8 | + |
| 9 | +mw.SequencerAddByUri = function( sequencer ) { |
| 10 | + return this.init( sequencer ); |
| 11 | +}; |
| 12 | +mw.SequencerAddByUri.prototype = { |
| 13 | + init: function( sequencer ){ |
| 14 | + this.sequencer = sequencer; |
| 15 | + }, |
| 16 | + |
| 17 | + /** |
| 18 | + * Does a basic parseUri check to see if a string is likely a url: |
| 19 | + */ |
| 20 | + isUri: function( inputString ){ |
| 21 | + // Check for file: type key |
| 22 | + if( inputString.indexOf('File:') === 0 ){ |
| 23 | + return true; |
| 24 | + } |
| 25 | + return ( mw.parseUri( inputString ).protocol ) ; |
| 26 | + }, |
| 27 | + |
| 28 | + /** |
| 29 | + * Try to add media via url and present a dialog if failed |
| 30 | + * or user input is required |
| 31 | + * |
| 32 | + * Uses remoteSearchDriver to help in retrieving entry info |
| 33 | + * @param {Object} remoteSearchDriver The remote search driver |
| 34 | + */ |
| 35 | + addByUriDialog: function( remoteSearchDriver, importString ){ |
| 36 | + var _this = this; |
| 37 | + var importString = unescape( importString ); |
| 38 | + mw.log('SequencerAddByUri::addByUrlDialog:'+ importString); |
| 39 | + var $dialog = mw.addLoaderDialog( gM( 'mwe-sequencer-loading-asset' ) ); |
| 40 | + |
| 41 | + // Close / empty the toolWindow |
| 42 | + _this.sequencer.getTools().setDefaultText(); |
| 43 | + |
| 44 | + // Check for file type uri direct key with local |
| 45 | + if( importString.indexOf('File:') === 0 ){ |
| 46 | + // make sure we have commons or local_wiki as a resource source: |
| 47 | + var provider = remoteSearchDriver.content_providers[ 'this_wiki' ]; |
| 48 | + if( ! provider ){ |
| 49 | + provider = remoteSearchDriver.content_providers[ 'wiki_commons' ]; |
| 50 | + } |
| 51 | + // Try to import from the given provider: |
| 52 | + if( provider ){ |
| 53 | + remoteSearchDriver.getResourceFromTitleKey( provider, importString, function( resource ){ |
| 54 | + if( ! resource ){ |
| 55 | + $dialog.html( 'Error loading asset'); |
| 56 | + return ; |
| 57 | + } |
| 58 | + // Get convert resource to smilClip and insert into the timeline |
| 59 | + _this |
| 60 | + .sequencer |
| 61 | + .getAddMedia() |
| 62 | + .getSmilClipFromResource( resource, function( smilClip ) { |
| 63 | + _this.sequencer.getTimeline().insertSmilClipEdit( smilClip ); |
| 64 | + mw.closeLoaderDialog(); |
| 65 | + }); |
| 66 | + }); |
| 67 | + return ; |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + var foundImportUrl = false; |
| 72 | + // See if the asset matches the detailsUrl key type of any enabled content provider: |
| 73 | + $j.each( remoteSearchDriver.getEnabledProviders(), function(providerName, provider){ |
| 74 | + if( mw.parseUri( provider.detailsUrl ).host == mw.parseUri( importString).host ){ |
| 75 | + foundImportUrl = true; |
| 76 | + mw.log( "addByUrlDialog: matching host getResourceFromUrl::" |
| 77 | + + mw.parseUri( provider.detailsUrl ).host |
| 78 | + + ' == ' + mw.parseUri( importString ).host ); |
| 79 | + |
| 80 | + // Do special check for mediawiki templates and pages as 'special' smil types |
| 81 | + if( provider.lib == 'mediaWiki' ){ |
| 82 | + // xxx we should do a query to the api to determine namespace instead of hard coded checks |
| 83 | + remoteSearchDriver.loadSearchLib( provider, function( provider ){ |
| 84 | + var titleKey = provider.sObj.getTitleKeyFromMwUrl( importString ); |
| 85 | + if( !titleKey ){ |
| 86 | + $dialog.html( gM('mwe-sequencer-import-url-not-supported', 'commons.wikimedia.org' ) ) |
| 87 | + // continue for loop ( if we can't get a title from the mediaWiki url ) |
| 88 | + return true; |
| 89 | + } |
| 90 | + |
| 91 | + // Check the title type |
| 92 | + // xxx should use wgFormattedNamespacess |
| 93 | + if( titleKey.indexOf('File:') == 0 ){ |
| 94 | + // Asset is a file import resource as a file: |
| 95 | + remoteSearchDriver.getResourceFromUrl( provider, importString, function( resource ){ |
| 96 | + if( ! resource ){ |
| 97 | + $dialog.html( 'Error loading asset'); |
| 98 | + return ; |
| 99 | + } |
| 100 | + // Get convert resource to smilClip and insert into the timeline |
| 101 | + _this |
| 102 | + .sequencer |
| 103 | + .getAddMedia() |
| 104 | + .getSmilClipFromResource( resource, function( smilClip ) { |
| 105 | + _this.sequencer.getTimeline().insertSmilClipEdit( smilClip ); |
| 106 | + mw.closeLoaderDialog(); |
| 107 | + }); |
| 108 | + }); |
| 109 | + } else if( titleKey.indexOf('Template:') == 0 ) { |
| 110 | + // Parse any parameters we can find: |
| 111 | + var apiProvider = ''; |
| 112 | + if( mw.parseUri(provider.apiUrl ).host == 'commons.wikimedia.org' ){ |
| 113 | + apiProvider = 'commons' |
| 114 | + } else { |
| 115 | + // xxx we need to abstract the remoteSearch driver provider logic |
| 116 | + // into a provider class |
| 117 | + apiProvider = 'local'; |
| 118 | + } |
| 119 | + // Get template smilClip: |
| 120 | + var smilClip = _this |
| 121 | + .sequencer |
| 122 | + .getAddMedia() |
| 123 | + .getSmilClipFromWikiTemplate( titleKey, apiProvider ); |
| 124 | + |
| 125 | + // Add the smil clip to the sequencer |
| 126 | + _this.sequencer.getTimeline().insertSmilClipEdit( smilClip ); |
| 127 | + |
| 128 | + // Close the dialog loading: |
| 129 | + mw.closeLoaderDialog(); |
| 130 | + |
| 131 | + /* |
| 132 | + * Soon sequence transclution fun: |
| 133 | + * else if( titleKey.indexOf('Sequence:') == 0 ) { |
| 134 | + */ |
| 135 | + |
| 136 | + } else { |
| 137 | + $dialog.html( 'Error loading asset type'); |
| 138 | + } |
| 139 | + |
| 140 | + }); |
| 141 | + } else { |
| 142 | + mw.log(" only MediaWiki URLs supported as resources right now"); |
| 143 | + } |
| 144 | + } |
| 145 | + }); |
| 146 | + |
| 147 | + if( ! foundImportUrl ){ |
| 148 | + $dialog.html( gM('mwe-sequencer-import-url-not-supported', 'commons.wikimedia.org' ) ); |
| 149 | + } |
| 150 | + |
| 151 | + // xxx support direct asset include |
| 152 | + if( mw.getConfig( 'Sequencer.AddAssetByUrl' )){ |
| 153 | + // try directly adding the asset |
| 154 | + } |
| 155 | + } |
| 156 | +}; |
| 157 | + |
| 158 | +} )( window.mw ); |
\ No newline at end of file |