Skip to content

Commit

Permalink
fixed custom jquery ui skin support
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Dale committed Aug 15, 2012
1 parent 0ce1fea commit 494a4df
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 32 deletions.
1 change: 1 addition & 0 deletions modules/KalturaSupport/KalturaSupport.loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );
});

Expand Down
63 changes: 44 additions & 19 deletions modules/KalturaSupport/kalturaIframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ;
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion modules/KalturaSupport/tests/PS/HBP/hbpAudio.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function( mw, $ ) {"use strict";
( function( mw, $ ) { "use strict";
$( mw ).bind( 'EmbedPlayerNewPlayer', function( event, embedPlayer ) {
embedPlayer.displayPlayer = false;
embedPlayer.attributionbutton = false;
Expand Down
5 changes: 0 additions & 5 deletions modules/MwEmbedSupport/MwEmbedSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand Down
4 changes: 1 addition & 3 deletions modules/Omniture/Omniture.loader.js
Original file line number Diff line number Diff line change
@@ -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 ){
Expand All @@ -17,6 +16,5 @@ $( mw ).bind( 'EmbedPlayerNewPlayer', function( event, embedPlayer ){
// no Omniture, run callback directly
callback();
});
});

})( window.mw, window.jQuery);
4 changes: 0 additions & 4 deletions mwEmbedLoader.php
Original file line number Diff line number Diff line change
@@ -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' );

Expand Down
1 change: 1 addition & 0 deletions mwEmbedStartup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down

0 comments on commit 494a4df

Please sign in to comment.