Robert Vogel has submitted this change and it was merged.

Change subject: BsBaseTemplate: Restored custom sidebar icon mechanism
......................................................................


BsBaseTemplate: Restored custom sidebar icon mechanism

The "custom icons in MediaWiki:Sidebar" mechanism was broken with 2.23
relaese. This change restores the general machanism. It also makes icons
clickable.

THERE IS ANOTHER CHANGE IN BlueSpiceSkin REPO THAT BELONGS TO THIS ONE!

Needs merge to REL1_23.

Change-Id: I6b11073fc89dcd93457da320f4c553125c715f01
(cherry picked from commit 6ba4b273e7269b2aef144aa920c2390aed45389b)
---
M includes/BsBaseTemplate.php
1 file changed, 23 insertions(+), 8 deletions(-)

Approvals:
  Robert Vogel: Verified; Looks good to me, approved



diff --git a/includes/BsBaseTemplate.php b/includes/BsBaseTemplate.php
index 4540761..82faa3f 100644
--- a/includes/BsBaseTemplate.php
+++ b/includes/BsBaseTemplate.php
@@ -435,6 +435,16 @@
                                $aOut[] = '  <h5>' . $sTitle . '</h5>';
                                $aOut[] = '  <ul>';
                                foreach ($cont as $key => $val) {
+                                       /* $val is created in 
Skin::addToSidebarPlain and contains
+                                        * the following:
+                                        * 'id' -> ID for list item
+                                        * 'active' -> Flag for list item class 
'active'
+                                        * 'text' -> Text for anchor
+                                        * 'href' -> Href for anchot
+                                        * 'rel' -> Rel for anchor
+                                        * 'target' -> Target for anchor
+                                        */
+
                                        if ( strpos( $val['text'], "|" ) !== 
false ) {
                                                $aVal = explode( '|', 
$val['text'] );
                                                $val['id'] = 'n-' . $aVal[0];
@@ -443,12 +453,20 @@
                                        $sCssClass = (!isset($val['active']) ) 
? ' class="active"' : '';
                                        $sTarget = ( isset($val['target']) ) ? 
' target="' . $val['target'] . '"' : '';
                                        $sRel = ( isset($val['rel']) ) ? ' 
rel="' . $val['rel'] . '"' : '';
+
                                        $aOut[] = '<li id="' . 
Sanitizer::escapeId($val['id']) . '"' . $sCssClass . ' class="clearfix">';
+
+                                       $sTitle = 
htmlspecialchars($val['text']);
+                                       $sText = htmlspecialchars($val['text']);
+                                       $sHref = htmlspecialchars($val['href']);
+                                       $sIcon = '<span class="icon24"></span>';
                                        if ( !empty( $aVal ) ) {
                                                $oFile = wfFindFile( $aVal[1] );
                                                if ( strpos( $lang = 
$this->translator->translate( $aVal[0] ), "&lt;" ) === false ) {
                                                        $aVal[0] = $lang;
                                                }
+                                               $sTitle = 
htmlspecialchars($aVal[0]);
+                                               $sText = 
htmlspecialchars($aVal[0]);
 
                                                if ( is_object( $oFile ) && 
$oFile->exists() ) {
                                                        if ( 
BsExtensionManager::isContextActive( 'MW::SecureFileStore::Active' ) ) {
@@ -456,16 +474,13 @@
                                                        } else {
                                                                $sUrl = 
$oFile->getUrl();
                                                        }
-                                                       $aOut[] = '<div 
style="background:url(' . $sUrl . ') center no-repeat; width:24px; 
height:24px;" class="left_navigation_icon" ></div>';
-                                               } else {
-                                                       //default
-                                                       $aOut[] = '<div 
class="left_navigation_icon"></div>';
+                                                       $sIcon = '<span 
class="icon24" style="background-image:url(' . $sUrl . ')"></span>';
                                                }
-                                               $aOut[] = '<a href="' . 
htmlspecialchars($val['href']) . '" title="' . htmlspecialchars($aVal[0]) .'" ' 
. $sTarget . $sRel . '>' . htmlspecialchars($aVal[0]) . '</a>';
-                                       } else {
-                                               $aOut[] = '<div 
class="left_navigation_icon"></div>';
-                                               $aOut[] = '<a href="' . 
htmlspecialchars($val['href']) . '" title="' . htmlspecialchars($val['text']) 
.'" ' . $sTarget . $sRel . '>' . htmlspecialchars($val['text']) . '</a>';
                                        }
+                                       $aOut[] = '<a href="' . $sHref . '" 
title="' . $sTitle .'" ' . $sTarget . $sRel . '>';
+                                       $aOut[] = $sIcon;
+                                       $aOut[] = '<span 
class="bs-nav-item-text">' . $sText . '</span>';
+                                       $aOut[] = '</a>';
                                        $aOut[] = '</li>';
                                        unset( $aVal );
                                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6b11073fc89dcd93457da320f4c553125c715f01
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: REL1_23
Gerrit-Owner: Robert Vogel <vo...@hallowelt.biz>
Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to