Robert Vogel has submitted this change and it was merged.
Change subject: Improved Vector skin support
......................................................................
Improved Vector skin support
Don't use wgDefaultSkin to verfiy which skin is active
* Fixed issue with untransformed message when vector skin is used
* Using BsBaseTemplate instade of SkinBlueSpiceSkin
Change-Id: I77497b68a6f4aef5dfb5186c10a96971984e04dc
---
M Authors/Authors.class.php
M Readers/Readers.class.php
M ShoutBox/ShoutBox.class.php
M StateBar/StateBar.class.php
M UserSidebar/UserSidebar.class.php
M WidgetBar/WidgetBar.class.php
M WikiAdmin/WikiAdmin.class.php
7 files changed, 37 insertions(+), 51 deletions(-)
Approvals:
Robert Vogel: Verified; Looks good to me, approved
diff --git a/Authors/Authors.class.php b/Authors/Authors.class.php
index 39cb109..769c693 100644
--- a/Authors/Authors.class.php
+++ b/Authors/Authors.class.php
@@ -164,8 +164,7 @@
return true;
}
- global $wgDefaultSkin;
- if ( $wgDefaultSkin != "bluespiceskin" ) {
+ if ( !( $sktemplate instanceof BsBaseTemplate ) ) {
return true;
}
@@ -181,7 +180,6 @@
/**
* Hook-Handler for 'SkinAfterContent'. Adds Authors view to the end of
the content.
- * @global String $wgDefaultSkin
* @param String $data
* @param Skin $sktemplate
* @return boolean
@@ -191,8 +189,7 @@
return true;
}
- global $wgDefaultSkin;
- if ( $wgDefaultSkin == "bluespiceskin" ) {
+ if ( $sktemplate instanceof BsBaseTemplate ) {
return true;
}
diff --git a/Readers/Readers.class.php b/Readers/Readers.class.php
index f60c848..2a76dc2 100644
--- a/Readers/Readers.class.php
+++ b/Readers/Readers.class.php
@@ -199,10 +199,9 @@
* @return bool always true
*/
public function onSkinTemplateOutputPageBeforeExec( &$sktemplate, &$tpl
) {
- global $wgDefaultSkin;
if ( $this->checkContext() === false ||
!$sktemplate->getTitle()->userCan(
'viewreaders' ) ||
- $wgDefaultSkin != "bluespiceskin" ) {
+ !( $sktemplate instanceof BsBaseTemplate ) ) {
return true;
}
if ( !$sktemplate->getTitle()->userCan( 'viewreaders' ) ) {
@@ -221,10 +220,9 @@
}
public function onSkinAfterContent( &$data, $sktemplate ) {
- global $wgDefaultSkin;
if ( $this->checkContext() === false ||
!$sktemplate->getTitle()->userCan(
'viewreaders' ) ||
- $wgDefaultSkin == "bluespiceskin" ) {
+ $sktemplate instanceof BsBaseTemplate ) {
return true;
}
if ( !$sktemplate->getTitle()->userCan( 'viewreaders' ) ) {
diff --git a/ShoutBox/ShoutBox.class.php b/ShoutBox/ShoutBox.class.php
index a251b62..dc1228f 100644
--- a/ShoutBox/ShoutBox.class.php
+++ b/ShoutBox/ShoutBox.class.php
@@ -230,8 +230,7 @@
* @return bool always true
*/
public function onSkinTemplateOutputPageBeforeExec( &$sktemplate, &$tpl
) {
- global $wgDefaultSkin;
- if ( !BsExtensionManager::isContextActive( 'MW::ShoutboxShow' )
|| $wgDefaultSkin != "bluespiceskin" ) {
+ if ( !BsExtensionManager::isContextActive( 'MW::ShoutboxShow' )
|| !( $sktemplate instanceof BsBaseTemplate ) ) {
return true;
}
@@ -245,14 +244,12 @@
/**
* Hook-Handler for 'SkinAfterContent'. Adds the ShoutboxView to the
end of the content
- * @global String $wgDefaultSkin
* @param String $data
* @param Skin $sktemplate
* @return boolean
*/
public function onSkinAfterContent( &$data, $sktemplate ) {
- global $wgDefaultSkin;
- if ( !BsExtensionManager::isContextActive( 'MW::ShoutboxShow' )
|| $wgDefaultSkin == "bluespiceskin" ) {
+ if ( !BsExtensionManager::isContextActive( 'MW::ShoutboxShow' )
|| $sktemplate instanceof BsBaseTemplate ) {
return true;
}
$oShoutboxView = $this->getShoutboxViewForAfterContent(
$sktemplate );
diff --git a/StateBar/StateBar.class.php b/StateBar/StateBar.class.php
index eb87aec..7cdaa73 100644
--- a/StateBar/StateBar.class.php
+++ b/StateBar/StateBar.class.php
@@ -319,12 +319,11 @@
* @return boolean Always true to keep hook running
*/
public function onSkinTemplateOutputPageBeforeExec( &$sktemplate, &$tpl
) {
- global $wgDefaultSkin;
- if( BsExtensionManager::isContextActive( 'MW::StateBarShow' )
=== false ) {
+ if ( BsExtensionManager::isContextActive( 'MW::StateBarShow' )
=== false ) {
return true;
}
- if( !is_null( $this->oRedirectTargetTitle ) ) {
+ if ( !is_null( $this->oRedirectTargetTitle ) ) {
$oTitle = $this->oRedirectTargetTitle;
}
wfRunHooks( 'BSStateBarBeforeTopViewAdd', array(
@@ -332,14 +331,14 @@
$sktemplate->getTitle(), $sktemplate )
);
- if( count( $this->aTopViews ) == 0 ) {
+ if ( count( $this->aTopViews ) == 0 ) {
// TODO RBV (01.07.11 18:26): Ain't this too late?
BsExtensionManager::removeContext( 'MW::StateBarShow' );
return true;
}
$aSortTopVars = BsConfig::get('MW::StateBar::SortTopVars');
- if( !empty( $aSortTopVars ) ) {
+ if ( !empty( $aSortTopVars ) ) {
$this->aTopViews = $this->reorderViews(
$this->aTopViews, $aSortTopVars );
}
@@ -348,15 +347,17 @@
$oViewStateBar->addStateBarTopView( $oTopView );
}
- if ($wgDefaultSkin == 'bluespiceskin')
+ if ( $sktemplate instanceof BsBaseTemplate ) {
$tpl->data['bs_dataBeforeContent']['bs-statebar'] =
array(
'position' => 20,
'label' => wfMessage( 'prefs-statebar'
)->text(),
'content' => $oViewStateBar
);
- //this is the case when BlueSpice Skin is not active, so use
vector methods.
- else
+ } else {
+ //this is the case when BlueSpice Skin is not active,
so use vector methods.
$tpl->data['prebodyhtml'] .= $oViewStateBar;
+ }
+
return true;
}
diff --git a/UserSidebar/UserSidebar.class.php
b/UserSidebar/UserSidebar.class.php
index f06f7fc..b84b5ab 100644
--- a/UserSidebar/UserSidebar.class.php
+++ b/UserSidebar/UserSidebar.class.php
@@ -212,16 +212,14 @@
$oUser = $sktemplate->getUser();
$oCurrentTitle = $sktemplate->getTitle();
$sEditLink = '';
- if( $sktemplate->getUser()->isLoggedIn() === false ) {
+ if ( $oUser->isLoggedIn() === false ) {
$this->getDefaultWidgets( $aViews, $oUser,
$oCurrentTitle );
- }
- else {
+ } else {
$oTitle = Title::makeTitle( NS_USER,
$oUser->getName().'/Sidebar' );
- $sEditLinkText = wfMessage('bs-widget-edit')->text();
$sEditLink = Linker::link(
$oTitle,
- Html::element( 'span', array(), $sEditLinkText
),
+ '',
array(
'id' => 'bs-usersidebar-edit',
'class' => 'icon-pencil'
@@ -232,12 +230,11 @@
)
);
- if( $oTitle->exists() === false ) {
+ if ( $oTitle->exists() === false ) {
$this->getDefaultWidgets( $aViews, $oUser,
$oTitle );
- }
- else {
+ }else {
$aWidgets =
BsWidgetListHelper::getInstanceForTitle( $oTitle )->getWidgets();
- if( empty($aWidgets) ) {
+ if ( empty($aWidgets) ) {
$this->getDefaultWidgets( $aViews,
$oUser, $oTitle );
}
@@ -246,14 +243,13 @@
}
$aOut = array();
$aOut[] = $sEditLink;
- foreach( $aViews as $oView ) {
- if( $oView instanceof ViewBaseElement ) {
+ foreach ( $aViews as $oView ) {
+ if ( $oView instanceof ViewBaseElement ) {
$aOut[] = $oView->execute();
}
}
- global $wgDefaultSkin;
- if ( $wgDefaultSkin == "bluespiceskin" ) {
+ if ( $sktemplate instanceof BsBaseTemplate ) {
$tpl->data['bs_navigation_main']['bs-usersidebar'] =
array(
'position' => 20,
'label' => wfMessage( 'bs-tab_focus' )->plain(),
diff --git a/WidgetBar/WidgetBar.class.php b/WidgetBar/WidgetBar.class.php
index e2042c5..89e98b0 100644
--- a/WidgetBar/WidgetBar.class.php
+++ b/WidgetBar/WidgetBar.class.php
@@ -171,25 +171,23 @@
* @return boolean Always true to keep hook running
*/
public function onSkinTemplateOutputPageBeforeExec( &$sktemplate, &$tpl
) {
- global $wgDefaultSkin;
$oCurrentTitle = $sktemplate->getTitle();
$oUser = $sktemplate->getUser();
+ $oView = $this->getWidgets( $oCurrentTitle, $oUser );
- $oView = $this->getWidgets($oCurrentTitle, $oUser);
-
-
- if ($wgDefaultSkin == "bluespiceskin")
+ if ( $sktemplate instanceof BsBaseTemplate ) {
$tpl->data['bs_dataBeforeContent']['bs-widgetbar'] =
array(
'position' => 10,
- 'label' => wfMessage('prefs-widgetbar')->text(),
+ 'label' => wfMessage( 'prefs-widgetbar'
)->text(),
'content' => $oView
);
- else
+ } else {
$tpl->data['prebodyhtml'] .= $oView;
+ }
return true;
}
- protected function getWidgets($oCurrentTitle, $oUser) {
+ protected function getWidgets( $oCurrentTitle, $oUser ) {
$oWidgetListView = new ViewWidgetList();
$aWidgetViews = array();
if ( $oCurrentTitle->userCan( 'read' ) == false ) {
diff --git a/WikiAdmin/WikiAdmin.class.php b/WikiAdmin/WikiAdmin.class.php
index 6337a2a..17fd699 100644
--- a/WikiAdmin/WikiAdmin.class.php
+++ b/WikiAdmin/WikiAdmin.class.php
@@ -193,19 +193,19 @@
* @return boolean Always true to keep hook running
*/
public static function onSkinTemplateOutputPageBeforeExec(
&$sktemplate, &$tpl ) {
- if( $sktemplate->getUser()->isAllowed('wikiadmin') === false ) {
+ if( $sktemplate->getUser()->isAllowed( 'wikiadmin' ) === false
) {
return true;
}
- $oSpecialPage = SpecialPage::getTitleFor('WikiAdmin');
+ $oSpecialPage = SpecialPage::getTitleFor( 'WikiAdmin' );
$aRegisteredModules = WikiAdmin::getRegisteredModules();
+ $aOutSortable = array();
$aOut = array();
$aOut[] = '<ul>';
- $aOutSortable = array();
foreach ( $aRegisteredModules as $sModuleKey => $aModulParams )
{
- $skeyLower = mb_strtolower($sModuleKey);
+ $skeyLower = mb_strtolower( $sModuleKey );
$sModulLabel = wfMessage( 'bs-' . $skeyLower . '-label'
)->plain();
$sUrl = $oSpecialPage->getLocalURL( array( 'mode' =>
$sModuleKey ) );
//$sUrl = str_replace( '&', '&', $sUrl );
@@ -221,12 +221,11 @@
$aOutSortable[$sModulLabel] = '<li>'.$sLink.'</li>';
}
- ksort($aOutSortable);
- $aOut[] = implode("\n", $aOutSortable).'</ul>';
+ ksort( $aOutSortable );
+ $aOut[] = implode( "\n", $aOutSortable ).'</ul>';
$aOut[] = '</ul>';
- global $wgDefaultSkin;
- if ( $wgDefaultSkin == "bluespiceskin" ) {
+ if ( $sktemplate instanceof BsBaseTemplate ) {
$tpl->data['bs_navigation_main']['bs-wikiadmin'] =
array(
'position' => 100,
'label' => wfMessage( 'bs-tab_admin' )->plain(),
--
To view, visit https://gerrit.wikimedia.org/r/169790
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I77497b68a6f4aef5dfb5186c10a96971984e04dc
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Smuggli <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pigpen <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: Tweichart <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits