Tweichart has uploaded a new change for review.

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

Change subject: SmartList: fixed whitespace error in toplist
......................................................................

SmartList: fixed whitespace error in toplist

Categories with whitespaces were not recognized. User had to use _
instead. This problem is fixed.

Change-Id: Ifc0d0deda4435f6505d0e7906fa32cd369afcaf1
---
M SmartList/SmartList.class.php
1 file changed, 15 insertions(+), 10 deletions(-)


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

diff --git a/SmartList/SmartList.class.php b/SmartList/SmartList.class.php
index e712725..0390363 100644
--- a/SmartList/SmartList.class.php
+++ b/SmartList/SmartList.class.php
@@ -1100,23 +1100,19 @@
                }
 
                if ( !empty( $sCat ) ) {
-                       if ( substr_count( $sCat , ',') > 0 ) {
-                               $aCategories = explode( ',', $sCat );
-                               $aCategories = array_map( 'trim', $aCategories 
);
-                               $sCategory = $aCategories[0];
-                       } else {
-                               $sCategory = $sCat;
-                       }
+                       $aCategories = explode( ',', $sCat );
+                       $aCategories = array_map('trim', $aCategories);
+                       $aCategories = str_replace(' ', '_',$aCategories);
 
                        if ( $bAlltime === false ) {
                                $aColumns[] = 'wo_page_id';
                                $aJoinConditions = array( 'categorylinks' => 
array( 'INNER JOIN ', 'wo_page_id = cl_from' ) );
                                $aTables[]            = 'categorylinks';
-                               $aConditions['cl_to'] = $sCategory;
+                               $aConditions['cl_to'] = $aCategories;
                        } else {
                                $aTables[]            = 'categorylinks';
                                $aConditions[]        = 'page_id = cl_from';
-                               $aConditions['cl_to'] = $sCategory;
+                               $aConditions['cl_to'] = $aCategories;
                        }
                }
 
@@ -1150,6 +1146,7 @@
                        }
 
                        $aList = array();
+                       $aInList = array();
                        $iCurrCount = 0;
                        if ( $bAlltime === false ) {
                                foreach ( $res as $row ) {
@@ -1166,7 +1163,10 @@
                                                        continue;
                                                }
                                        }
-
+                                       if( in_array( 
$oTitle->getPrefixedText(), $aInList ) ) {
+                                               continue;
+                                       }
+                                       $aInList[] = $oTitle->getPrefixedText();
                                        $sLink = BsLinkProvider::makeLink( 
$oTitle );
                                        $aList['<li>'. $sLink . ' (' . 
$row->page_counter . ')</li>'] = (int)$row->page_counter;
                                        $iCurrCount++;
@@ -1189,6 +1189,11 @@
                                                if ( !empty( $aResult ) ) 
continue;
                                        }
 
+                                       if( in_array( 
$oTitle->getPrefixedText(), $aInList ) ) {
+                                               continue;
+                                       }
+                                       $aInList[] = $oTitle->getPrefixedText();
+
                                        $sLink = BsLinkProvider::makeLink( 
$oTitle );
                                        $aList[] = '<li>' . $sLink . ' (' . 
$row->page_counter . ')</li>';
                                        $iCurrCount++;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc0d0deda4435f6505d0e7906fa32cd369afcaf1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_23
Gerrit-Owner: Tweichart <weich...@hallowelt.biz>
Gerrit-Reviewer: Dvogel hallowelt <daniel.vo...@hallowelt.com>

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

Reply via email to