Merge "Default is not necessary for toggle fields"
[lhc/web/wiklou.git] / includes / CategoryViewer.php
index 970adb5..a9f5d23 100644 (file)
@@ -141,8 +141,9 @@ class CategoryViewer extends ContextSource {
                $this->children = array();
                $this->children_start_char = array();
                if ( $this->showGallery ) {
-                       $this->gallery = new ImageGallery();
+                       $this->gallery = ImageGalleryBase::factory();
                        $this->gallery->setHideBadImages();
+                       $this->gallery->setContext( $this->getContext() );
                } else {
                        $this->imgsNoGallery = array();
                        $this->imgsNoGallery_start_char = array();
@@ -526,7 +527,10 @@ class CategoryViewer extends ContextSource {
 
                        $first = true;
                        foreach ( $colContents as $char => $articles ) {
-                               $ret .= '<h3>' . htmlspecialchars( $char );
+                               # Change space to non-breaking space to keep headers aligned
+                               $h3char = $char === ' ' ? '&#160;' : htmlspecialchars( $char );
+
+                               $ret .= '<h3>' . $h3char;
                                if ( $first && $char === $prevchar ) {
                                        # We're continuing a previous chunk at the top of a new
                                        # column, so add " cont." after the letter.
@@ -645,11 +649,6 @@ class CategoryViewer extends ContextSource {
         * returned?  This function says what. Each type is considered independently
         * of the other types.
         *
-        * Note for grepping: uses the messages category-article-count,
-        * category-article-count-limited, category-subcat-count,
-        * category-subcat-count-limited, category-file-count,
-        * category-file-count-limited.
-        *
         * @param int $rescnt The number of items returned by our database query.
         * @param int $dbcnt The number of items according to the category table.
         * @param string $type 'subcat', 'article', or 'file'
@@ -697,8 +696,12 @@ class CategoryViewer extends ContextSource {
                        $this->cat->refreshCounts();
                } else {
                        # Case 3: hopeless.  Don't give a total count at all.
+                       # Give grep a chance to find the usages: category-subcat-count-limited,
+                       # category-article-count-limited, category-file-count-limited
                        return $this->msg( "category-$type-count-limited" )->numParams( $rescnt )->parseAsBlock();
                }
+               # Give grep a chance to find the usages:
+               # category-subcat-count, category-article-count, category-file-count
                return $this->msg( "category-$type-count" )->numParams( $rescnt, $totalcnt )->parseAsBlock();
        }
 }