Skip to content
This repository
Browse code

fixed custom jquery ui skin support

  • Loading branch information...
commit 494a4df72387e4d475f07ba8b5cb7460bb5cea5a 1 parent 0ce1fea
Michael Dale mdale authored
1  modules/KalturaSupport/KalturaSupport.loader.js
@@ -93,6 +93,7 @@
93 93 embedPlayer.playerConfig = mw.getConfig( 'KalturaSupport.PlayerConfig' );
94 94 mw.setConfig('KalturaSupport.PlayerConfig', null );
95 95 }
  96 + // player config should be set before calling KalturaSupportNewPlayer
96 97 $( mw ).trigger( 'KalturaSupportNewPlayer', [ embedPlayer ] );
97 98 });
98 99
63 modules/KalturaSupport/kalturaIframe.php
@@ -44,6 +44,7 @@ class kalturaIframe {
44 44 var $debug = false;
45 45 var $error = false;
46 46 var $playerError = false;
  47 + var $envConfig = null; // lazy init
47 48
48 49 // Plugins used in $this context
49 50 var $plugins = array();
@@ -264,26 +265,23 @@ private function getCustomPlayerIncludes(){
264 265 * TODO: we should use getWidgetUiVars instead of parsing the XML
265 266 * */
266 267 private function getEnvironmentConfig(){
267   - $configVars = array();
268   - if( ! $this->getUiConfResult()->getUiConf() ){
269   - return $configVars;
270   - }
271   - // uiVars
272   - $xml = $this->getUiConfResult()->getUiConfXML();
273   - if( isset( $xml->uiVars ) && isset( $xml->uiVars->var ) ){
274   - foreach ( $xml->uiVars->var as $var ){
275   - if( isset( $var['key'] ) && is_string( $var['key'] ) && isset( $var['value'] ) ){
276   - $configVars[ $var['key'] ] = $var['value'];
277   - }
  268 + if( $this->envConfig === null ){
  269 + $this->envConfig = array();
  270 + if( ! $this->getUiConfResult()->getUiConf() ){
  271 + return $this->envConfig;
278 272 }
279   - }
280   - // Flashvars
281   - if( $this->getUiConfResult()->urlParameters[ 'flashvars' ] ) {
282   - foreach( $this->getUiConfResult()->urlParameters[ 'flashvars' ] as $fvKey => $fvValue) {
283   - $configVars[ $fvKey ] = json_decode( html_entity_decode( $fvValue ) );
  273 + // uiVars
  274 + $this->envConfig = array_merge( $this->envConfig,
  275 + $this->getUiConfResult()->getWidgetUiVars() );
  276 +
  277 + // Flashvars
  278 + if( $this->getUiConfResult()->urlParameters[ 'flashvars' ] ) {
  279 + foreach( $this->getUiConfResult()->urlParameters[ 'flashvars' ] as $fvKey => $fvValue) {
  280 + $this->envConfig[ $fvKey ] = json_decode( html_entity_decode( $fvValue ) );
  281 + }
284 282 }
285 283 }
286   - return $configVars;
  284 + return $this->envConfig;
287 285 }
288 286 private function getSwfUrl(){
289 287 $swfUrl = $this->getUiConfResult()->getServiceConfig('ServiceUrl') . '/index.php/kwidget';
@@ -369,12 +367,26 @@ private function getVersionUrlParams(){
369 367 }
370 368 return $versionParam;
371 369 }
  370 + /**
  371 + * Retrieves a custom skin url if set
  372 + * @return false if unset
  373 + */
  374 + private function getCustomSkinUrl(){
  375 + $envConfig = $this->getEnvironmentConfig();
  376 + if( isset( $envConfig['IframeCustomjQueryUISkinCss'] ) ){
  377 + return $envConfig['IframeCustomjQueryUISkinCss'];
  378 + }
  379 + return false;
  380 + }
372 381
373 382 /**
374 383 * Get the startup location
375 384 */
376 385 private function getMwEmbedStartUpLocation(){
377   - return $this->getMwEmbedPath() . 'mwEmbedStartup.php' . $this->getVersionUrlParams() . '&mwEmbedSetupDone=1';
  386 + $skinParam =( $this->getCustomSkinUrl() ) ? '&skin=custom' : '';
  387 + return $this->getMwEmbedPath() . 'mwEmbedStartup.php' .
  388 + $this->getVersionUrlParams() . '&mwEmbedSetupDone=1' .
  389 + $skinParam;
378 390 }
379 391 /**
380 392 * Get the location of the mwEmbed library
@@ -577,6 +589,7 @@ function getKalturaIframeScripts(){
577 589 // For loading iframe side resources that need to be loaded after mw
578 590 // but before player build out
579 591 var loadCustomResourceIncludes = function( loadSet, callback ){
  592 + // if an empty set issue callback directly
580 593 if( loadSet.length == 0 ){
581 594 callback();
582 595 return ;
@@ -604,7 +617,19 @@ function getKalturaIframeScripts(){
604 617 }
605 618 };
606 619 loadMw( function(){
607   - // Load iframe custom resources
  620 + <!-- Load any custom skins: -->
  621 + <?php
  622 + if( $this->getCustomSkinUrl() ){
  623 + ?>jQuery('head').append( $('<link />' ).attr({
  624 + type: 'text/css',
  625 + rel:'stylesheet',
  626 + media: 'screen',
  627 + href : '<?php echo htmlspecialchars( $this->getCustomSkinUrl() ) ?>'
  628 + })
  629 + );<?php
  630 + }
  631 + ?>
  632 + // Load any other iframe custom resources
608 633 loadCustomResourceIncludes( window.kalturaIframePackageData['customPlayerIncludes'], function(){
609 634 <?php
610 635 echo $this->outputKalturaModules();
2  modules/KalturaSupport/tests/PS/HBP/hbpAudio.js
... ... @@ -1,4 +1,4 @@
1   -( function( mw, $ ) {"use strict";
  1 +( function( mw, $ ) { "use strict";
2 2 $( mw ).bind( 'EmbedPlayerNewPlayer', function( event, embedPlayer ) {
3 3 embedPlayer.displayPlayer = false;
4 4 embedPlayer.attributionbutton = false;
5 modules/MwEmbedSupport/MwEmbedSupport.php
@@ -30,12 +30,7 @@
30 30 'styles'=> array( 'skins/common/MwEmbedCommonStyle.css' ),
31 31 'skinStyles' => array(
32 32 /* shared jQuery ui skin styles */
33   - 'darkness' => 'skins/jquery.ui.themes/darkness/jquery-ui-1.7.2.css',
34 33 'kaltura-dark' => 'skins/jquery.ui.themes/kaltura-dark/jquery-ui-1.7.2.css',
35   - 'le-frog' => 'skins/jquery.ui.themes/le-frog/jquery-ui-1.7.2.css',
36   - 'redmond' => 'skins/jquery.ui.themes/redmond/jquery-ui-1.7.2.css',
37   - 'start' => 'skins/jquery.ui.themes/start/jquery-ui-1.7.2.css',
38   - 'sunny' => 'skins/jquery.ui.themes/sunny/jquery-ui-1.7.2.css',
39 34 ),
40 35 ),
41 36 'mediawiki.UtilitiesTime' => array( 'scripts' => 'mediawiki/mediawiki.UtilitiesTime.js' ),
4 modules/Omniture/Omniture.loader.js
... ... @@ -1,7 +1,6 @@
1 1 ( function( mw, $ ) { "use strict";
2 2
3   -$( mw ).bind( 'EmbedPlayerNewPlayer', function( event, embedPlayer ){
4   - $( embedPlayer ).bind( 'KalturaSupport_CheckUiConf', function( event, $uiConf, callback ){
  3 + mw.addKalturaConfCheck( function( embedPlayer, callback ){
5 4 var pluginName = null;
6 5 pluginName = embedPlayer.isPluginEnabled( 'omniture' ) ? 'omniture' : null;
7 6 if( ! pluginName ){
@@ -17,6 +16,5 @@ $( mw ).bind( 'EmbedPlayerNewPlayer', function( event, embedPlayer ){
17 16 // no Omniture, run callback directly
18 17 callback();
19 18 });
20   -});
21 19
22 20 })( window.mw, window.jQuery);
4 mwEmbedLoader.php
... ... @@ -1,8 +1,4 @@
1 1 <?php
2   -// Special mwEmbedLoader.js entry point with php based configuration
3   -// ( will be deprecated once we move to new resource loader )
4   -
5   -
6 2 // Include configuration
7 3 require_once( realpath( dirname( __FILE__ ) ) . '/includes/DefaultSettings.php' );
8 4
1  mwEmbedStartup.php
@@ -15,6 +15,7 @@
15 15 print "if( console && console.log ){ console.log( 'Error can't find load.php' ) }";
16 16 }
17 17
  18 +
18 19 // Output MWEMBED_VERSION global:
19 20 echo "window['MWEMBED_VERSION'] = '$wgMwEmbedVersion';\n";
20 21

0 comments on commit 494a4df

Please sign in to comment.
Something went wrong with that request. Please try again.