Robert Vogel has uploaded a new change for review.

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

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
---
M includes/BsBaseTemplate.php
1 file changed, 23 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation 
refs/changes/32/201432/1

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/201432
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b11073fc89dcd93457da320f4c553125c715f01
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Robert Vogel <vo...@hallowelt.biz>

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

Reply via email to