Skip to content
Browse files

fixed custom jquery ui skin support

  • Loading branch information...
1 parent 0ce1fea commit 494a4df72387e4d475f07ba8b5cb7460bb5cea5a Michael Dale committed Aug 15, 2012
View
1 modules/KalturaSupport/KalturaSupport.loader.js
@@ -93,6 +93,7 @@
embedPlayer.playerConfig = mw.getConfig( 'KalturaSupport.PlayerConfig' );
mw.setConfig('KalturaSupport.PlayerConfig', null );
}
+ // player config should be set before calling KalturaSupportNewPlayer
$( mw ).trigger( 'KalturaSupportNewPlayer', [ embedPlayer ] );
});
View
63 modules/KalturaSupport/kalturaIframe.php
@@ -44,6 +44,7 @@ class kalturaIframe {
var $debug = false;
var $error = false;
var $playerError = false;
+ var $envConfig = null; // lazy init
// Plugins used in $this context
var $plugins = array();
@@ -264,26 +265,23 @@ private function getCustomPlayerIncludes(){
* TODO: we should use getWidgetUiVars instead of parsing the XML
* */
private function getEnvironmentConfig(){
- $configVars = array();
- if( ! $this->getUiConfResult()->getUiConf() ){
- return $configVars;
- }
- // uiVars
- $xml = $this->getUiConfResult()->getUiConfXML();
- if( isset( $xml->uiVars ) && isset( $xml->uiVars->var ) ){
- foreach ( $xml->uiVars->var as $var ){
- if( isset( $var['key'] ) && is_string( $var['key'] ) && isset( $var['value'] ) ){
- $configVars[ $var['key'] ] = $var['value'];
- }
+ if( $this->envConfig === null ){
+ $this->envConfig = array();
+ if( ! $this->getUiConfResult()->getUiConf() ){
+ return $this->envConfig;
}
- }
- // Flashvars
- if( $this->getUiConfResult()->urlParameters[ 'flashvars' ] ) {
- foreach( $this->getUiConfResult()->urlParameters[ 'flashvars' ] as $fvKey => $fvValue) {
- $configVars[ $fvKey ] = json_decode( html_entity_decode( $fvValue ) );
+ // uiVars
+ $this->envConfig = array_merge( $this->envConfig,
+ $this->getUiConfResult()->getWidgetUiVars() );
+
+ // Flashvars
+ if( $this->getUiConfResult()->urlParameters[ 'flashvars' ] ) {
+ foreach( $this->getUiConfResult()->urlParameters[ 'flashvars' ] as $fvKey => $fvValue) {
+ $this->envConfig[ $fvKey ] = json_decode( html_entity_decode( $fvValue ) );
+ }
}
}
- return $configVars;
+ return $this->envConfig;
}
private function getSwfUrl(){
$swfUrl = $this->getUiConfResult()->getServiceConfig('ServiceUrl') . '/index.php/kwidget';
@@ -369,12 +367,26 @@ private function getVersionUrlParams(){
}
return $versionParam;
}
+ /**
+ * Retrieves a custom skin url if set
+ * @return false if unset
+ */
+ private function getCustomSkinUrl(){
+ $envConfig = $this->getEnvironmentConfig();
+ if( isset( $envConfig['IframeCustomjQueryUISkinCss'] ) ){
+ return $envConfig['IframeCustomjQueryUISkinCss'];
+ }
+ return false;
+ }
/**
* Get the startup location
*/
private function getMwEmbedStartUpLocation(){
- return $this->getMwEmbedPath() . 'mwEmbedStartup.php' . $this->getVersionUrlParams() . '&mwEmbedSetupDone=1';
+ $skinParam =( $this->getCustomSkinUrl() ) ? '&skin=custom' : '';
+ return $this->getMwEmbedPath() . 'mwEmbedStartup.php' .
+ $this->getVersionUrlParams() . '&mwEmbedSetupDone=1' .
+ $skinParam;
}
/**
* Get the location of the mwEmbed library
@@ -577,6 +589,7 @@ function getKalturaIframeScripts(){
// For loading iframe side resources that need to be loaded after mw
// but before player build out
var loadCustomResourceIncludes = function( loadSet, callback ){
+ // if an empty set issue callback directly
if( loadSet.length == 0 ){
callback();
return ;
@@ -604,7 +617,19 @@ function getKalturaIframeScripts(){
}
};
loadMw( function(){
- // Load iframe custom resources
+ <!-- Load any custom skins: -->
+ <?php
+ if( $this->getCustomSkinUrl() ){
+ ?>jQuery('head').append( $('<link />' ).attr({
+ type: 'text/css',
+ rel:'stylesheet',
+ media: 'screen',
+ href : '<?php echo htmlspecialchars( $this->getCustomSkinUrl() ) ?>'
+ })
+ );<?php
+ }
+ ?>
+ // Load any other iframe custom resources
loadCustomResourceIncludes( window.kalturaIframePackageData['customPlayerIncludes'], function(){
<?php
echo $this->outputKalturaModules();
View
2 modules/KalturaSupport/tests/PS/HBP/hbpAudio.js
@@ -1,4 +1,4 @@
-( function( mw, $ ) {"use strict";
+( function( mw, $ ) { "use strict";
$( mw ).bind( 'EmbedPlayerNewPlayer', function( event, embedPlayer ) {
embedPlayer.displayPlayer = false;
embedPlayer.attributionbutton = false;
View
5 modules/MwEmbedSupport/MwEmbedSupport.php
@@ -30,12 +30,7 @@
'styles'=> array( 'skins/common/MwEmbedCommonStyle.css' ),
'skinStyles' => array(
/* shared jQuery ui skin styles */
- 'darkness' => 'skins/jquery.ui.themes/darkness/jquery-ui-1.7.2.css',
'kaltura-dark' => 'skins/jquery.ui.themes/kaltura-dark/jquery-ui-1.7.2.css',
- 'le-frog' => 'skins/jquery.ui.themes/le-frog/jquery-ui-1.7.2.css',
- 'redmond' => 'skins/jquery.ui.themes/redmond/jquery-ui-1.7.2.css',
- 'start' => 'skins/jquery.ui.themes/start/jquery-ui-1.7.2.css',
- 'sunny' => 'skins/jquery.ui.themes/sunny/jquery-ui-1.7.2.css',
),
),
'mediawiki.UtilitiesTime' => array( 'scripts' => 'mediawiki/mediawiki.UtilitiesTime.js' ),
View
4 modules/Omniture/Omniture.loader.js
@@ -1,7 +1,6 @@
( function( mw, $ ) { "use strict";
-$( mw ).bind( 'EmbedPlayerNewPlayer', function( event, embedPlayer ){
- $( embedPlayer ).bind( 'KalturaSupport_CheckUiConf', function( event, $uiConf, callback ){
+ mw.addKalturaConfCheck( function( embedPlayer, callback ){
var pluginName = null;
pluginName = embedPlayer.isPluginEnabled( 'omniture' ) ? 'omniture' : null;
if( ! pluginName ){
@@ -17,6 +16,5 @@ $( mw ).bind( 'EmbedPlayerNewPlayer', function( event, embedPlayer ){
// no Omniture, run callback directly
callback();
});
-});
})( window.mw, window.jQuery);
View
4 mwEmbedLoader.php
@@ -1,8 +1,4 @@
<?php
-// Special mwEmbedLoader.js entry point with php based configuration
-// ( will be deprecated once we move to new resource loader )
-
-
// Include configuration
require_once( realpath( dirname( __FILE__ ) ) . '/includes/DefaultSettings.php' );
View
1 mwEmbedStartup.php
@@ -15,6 +15,7 @@
print "if( console && console.log ){ console.log( 'Error can't find load.php' ) }";
}
+
// Output MWEMBED_VERSION global:
echo "window['MWEMBED_VERSION'] = '$wgMwEmbedVersion';\n";

0 comments on commit 494a4df

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