Swidmann has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/145569

Change subject: UserPrefernces fixed bug in usersidbar little refactoring for 
REL2_23
......................................................................

UserPrefernces
fixed bug in usersidbar
little refactoring for REL2_23

Change-Id: If9461c41f213f6d627c5ceb85c4b04749d318fda
---
M UserPreferences/UserPreferences.class.php
M UserSidebar/UserSidebar.class.php
M WidgetBar/WidgetBar.class.php
3 files changed, 20 insertions(+), 36 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/69/145569/1

diff --git a/UserPreferences/UserPreferences.class.php 
b/UserPreferences/UserPreferences.class.php
index 3942207..12716d8 100644
--- a/UserPreferences/UserPreferences.class.php
+++ b/UserPreferences/UserPreferences.class.php
@@ -109,7 +109,6 @@
 
                        if ( !( $iOptions & ( BsConfig::LEVEL_USER ) ) ) 
continue;
 
-                       $sAdapterName = strtoupper( $oVariable->getAdapter() );
                        $sExtensionName = $oVariable->getExtension();
 
                        if ( empty( $sExtensionName ) ){
@@ -119,46 +118,29 @@
                                $sExtensionNameLower = strtolower( 
$sExtensionName );
                                $sExtensionTranslation = wfMessage( 'prefs-' . 
$sExtensionNameLower )->plain();
                        }
-                       
$aSortedVariables[$sAdapterName][$sExtensionTranslation][$sExtensionName][] = 
$oVariable;
-                       ksort( $aSortedVariables[$sAdapterName] );
+                       
$aSortedVariables[$sExtensionTranslation][$sExtensionName][] = $oVariable;
+                       ksort( $aSortedVariables );
                }
 
-               foreach ( $aSortedVariables as $sAdapterName => $aExtensions ) {
-                       if ( !count( $aExtensions ) )continue;
-                       $sBaseSection = 'bluespice/' . $sAdapterName;
+               foreach ( $aSortedVariables as $val ){
+                       if ( !count( $val ) ) continue;
 
-                       foreach ( $aExtensions as $val ){
-                               if ( !count( $val ) ) continue;
+                       foreach ( $val as $sExtensionName => $aSettings ) {
+                               // if continue, then $oAdapterSetView is not 
added to output
+                               if ( !count( $aSettings ) ) continue;
+                               $sSection = 'bluespice/' . $sExtensionName;
 
-                               foreach ( $val as $sExtensionName => $aSettings 
) {
-                                       // if continue, then $oAdapterSetView 
is not added to output
-                                       if ( !count( $aSettings ) ) continue;
-                                       $sSection = $sBaseSection . '/' . 
$sExtensionName;
+                               foreach ( $aSettings as $oVariable ) {
+                                       $field = 
$oVariable->getFieldDefinition( $sSection );
 
-                                       foreach ( $aSettings as $oVariable ) {
-                                               $field = array(
-                                                       'type' => 
$oVariable->getFieldMapping(),
-                                                       'label-message' => 
$oVariable->getI18nName(), // a system message
-                                                       'section' => $sSection,
-                                                       'default' => ( 
BsStringHelper::isSerialized( $oVariable->getValue() ) ) ? unserialize( 
$oVariable->getValue() ) : $oVariable->getValue()
-                                               );
+                                       if ( $oVariable->getOptions() & 
BsConfig::USE_PLUGIN_FOR_PREFS ) {
+                                               $oExtension = 
BsExtensionManager::getExtension( $sExtensionName );
+                                               $tmp = 
$oExtension->runPreferencePlugin( 'MW', $oVariable );
 
-                                               if ( 
$oVariable->getFieldMapping() == 'multiselectplusadd' ) {
-                                                       $field[ 'options' ] = 
$oVariable->getValue();
-                                                       $field[ 'title' ] = 
'toc-' . $oVariable->getName() . '-title';
-                                                       $field[ 'message' ] = 
'toc-' . $oVariable->getName() . '-message';
-                                               }
-
-                                               if ( $oVariable->getOptions() & 
BsConfig::USE_PLUGIN_FOR_PREFS ) {
-
-                                                       $oExtension = 
BsExtensionManager::getExtension( $sExtensionName );
-                                                       $tmp = 
$oExtension->runPreferencePlugin( 'MW', $oVariable );
-
-                                                       $field = array_merge( 
$field, $tmp );
-                                               }
-
-                                               
$preferences[$oVariable->generateFieldId()] = $field;
+                                               $field = array_merge( $field, 
$tmp );
                                        }
+
+                                       
$preferences[$oVariable->generateFieldId()] = $field;
                                }
                        }
                }
diff --git a/UserSidebar/UserSidebar.class.php 
b/UserSidebar/UserSidebar.class.php
index e0a6100..1869829 100644
--- a/UserSidebar/UserSidebar.class.php
+++ b/UserSidebar/UserSidebar.class.php
@@ -85,6 +85,8 @@
 
                $wgAPIModules['sidebar'] = 'ApiSidebar';
 
+               BsConfig::registerVar( 'MW::UserSidebar::LinkToEdit', 
array('href' => '', 'content' => ''), BsConfig::LEVEL_USER, 
'bs-usersidebar-userpagesettings-link-title', 'link' );
+
                wfProfileOut( 'BS::'.__METHOD__ );
        }
 
@@ -135,7 +137,7 @@
                $oUserSidebarArticleTitle = Title::makeTitle( NS_USER, 
$oUser->getName().'/Sidebar' );
                $aPreferences['MW_UserSidebar_LinkToEdit']['default'] = array(
                        'href' => $oUserSidebarArticleTitle->getEditURL(),
-                       'content' => wfMessage( 
'bs-usersidebar-userpagesettings-link-text' )->plain()
+                       'content' => wfMessage( 
'bs-usersidebar-userpagesettings-link-text' )->text()
                );
                return true;
        }
diff --git a/WidgetBar/WidgetBar.class.php b/WidgetBar/WidgetBar.class.php
index d2b97f5..8969337 100644
--- a/WidgetBar/WidgetBar.class.php
+++ b/WidgetBar/WidgetBar.class.php
@@ -128,7 +128,7 @@
                $oWidgetBarArticleTitle = Title::makeTitle( NS_USER, 
$user->getName().'/Widgetbar' );
                $preferences['MW_WidgetBar_LinkToEdit']['default'] = array(
                        'href' => $oWidgetBarArticleTitle->getEditURL(),
-                       'content' => wfMessage( 
'bs-widgetbar-userpagesettings-link-text' )->plain()
+                       'content' => wfMessage( 
'bs-widgetbar-userpagesettings-link-text' )->text()
                );
                return true;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/145569
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9461c41f213f6d627c5ceb85c4b04749d318fda
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Swidmann <widm...@hallowelt.biz>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to