Index: trunk/phase3/includes/CategoryPage.php |
— | — | @@ -89,6 +89,7 @@ |
90 | 90 | $articles, $articles_start_char, |
91 | 91 | $children, $children_start_char, |
92 | 92 | $showGallery, $gallery, |
| 93 | + $imgsNoGalley, $imgsNoGallery_start_char, |
93 | 94 | $skin; |
94 | 95 | # Category object for this page |
95 | 96 | private $cat; |
— | — | @@ -155,6 +156,9 @@ |
156 | 157 | if ( $this->showGallery ) { |
157 | 158 | $this->gallery = new ImageGallery(); |
158 | 159 | $this->gallery->setHideBadImages(); |
| 160 | + } else { |
| 161 | + $this->imgsNoGallery = array(); |
| 162 | + $this->imgsNoGallery_start_char = array(); |
159 | 163 | } |
160 | 164 | } |
161 | 165 | |
— | — | @@ -217,6 +221,7 @@ |
218 | 222 | * Add a page in the image namespace |
219 | 223 | */ |
220 | 224 | function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) { |
| 225 | + global $wgContLang; |
221 | 226 | if ( $this->showGallery ) { |
222 | 227 | $flip = $this->flip['file']; |
223 | 228 | if ( $flip ) { |
— | — | @@ -225,7 +230,18 @@ |
226 | 231 | $this->gallery->add( $title ); |
227 | 232 | } |
228 | 233 | } else { |
229 | | - $this->addPage( $title, $sortkey, $pageLength, $isRedirect ); |
| 234 | + $this->imgsNoGallery[] = $isRedirect |
| 235 | + ? '<span class="redirect-in-category">' . |
| 236 | + $this->getSkin()->link( |
| 237 | + $title, |
| 238 | + null, |
| 239 | + array(), |
| 240 | + array(), |
| 241 | + array( 'known', 'noclasses' ) |
| 242 | + ) . '</span>' |
| 243 | + : $this->getSkin()->link( $title ); |
| 244 | + |
| 245 | + $this->imgsNoGallery_start_char[] = $wgContLang->convert( $wgContLang->firstLetterForLists( $sortkey ) ); |
230 | 246 | } |
231 | 247 | } |
232 | 248 | |
— | — | @@ -257,6 +273,10 @@ |
258 | 274 | $this->articles = array_reverse( $this->articles ); |
259 | 275 | $this->articles_start_char = array_reverse( $this->articles_start_char ); |
260 | 276 | } |
| 277 | + if ( !$this->showGallery && $this->flip['file'] ) { |
| 278 | + $this->imgsNoGallery = array_reverse( $this->imgsNoGallery ); |
| 279 | + $this->imgsNoGallery_start_char = array_reverse( $this->imgsNoGallery_start_char ); |
| 280 | + } |
261 | 281 | } |
262 | 282 | |
263 | 283 | function doCategoryQuery() { |
— | — | @@ -318,7 +338,7 @@ |
319 | 339 | if ( $title->getNamespace() == NS_CATEGORY ) { |
320 | 340 | $cat = Category::newFromRow( $row, $title ); |
321 | 341 | $this->addSubcategoryObject( $cat, $rawSortkey, $row->page_len ); |
322 | | - } elseif ( $this->showGallery && $title->getNamespace() == NS_FILE ) { |
| 342 | + } elseif ( $title->getNamespace() == NS_FILE ) { |
323 | 343 | $this->addImage( $title, $rawSortkey, $row->page_len, $row->page_is_redirect ); |
324 | 344 | } else { |
325 | 345 | $this->addPage( $title, $rawSortkey, $row->page_len, $row->page_is_redirect ); |
— | — | @@ -382,16 +402,20 @@ |
383 | 403 | |
384 | 404 | function getImageSection() { |
385 | 405 | $r = ''; |
386 | | - if ( $this->showGallery && ! $this->gallery->isEmpty() ) { |
| 406 | + $rescnt = $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery ); |
| 407 | + if ( $rescnt > 0 ) { |
387 | 408 | $dbcnt = $this->cat->getFileCount(); |
388 | | - $rescnt = $this->gallery->count(); |
389 | 409 | $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'file' ); |
390 | 410 | |
391 | 411 | $r .= "<div id=\"mw-category-media\">\n"; |
392 | 412 | $r .= '<h2>' . wfMsg( 'category-media-header', htmlspecialchars( $this->title->getText() ) ) . "</h2>\n"; |
393 | 413 | $r .= $countmsg; |
394 | 414 | $r .= $this->getSectionPagingLinks( 'file' ); |
395 | | - $r .= $this->gallery->toHTML(); |
| 415 | + if ( $this->showGallery ) { |
| 416 | + $r .= $this->gallery->toHTML(); |
| 417 | + } else { |
| 418 | + $r .= $this->formatList( $this->imgsNoGallery, $this->imgsNoGallery_start_char ); |
| 419 | + } |
396 | 420 | $r .= $this->getSectionPagingLinks( 'file' ); |
397 | 421 | $r .= "\n</div>"; |
398 | 422 | } |
— | — | @@ -594,7 +618,7 @@ |
595 | 619 | # know the right figure. |
596 | 620 | # 3) We have no idea. |
597 | 621 | $totalrescnt = count( $this->articles ) + count( $this->children ) + |
598 | | - ( $this->showGallery ? $this->gallery->count() : 0 ); |
| 622 | + ( $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery ) ); |
599 | 623 | |
600 | 624 | # Check if there's a "from" or "until" for anything |
601 | 625 | $fromOrUntil = false; |