Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -77,3 +77,8 @@ |
78 | 78 | |
79 | 79 | body.ltr .thumbcaption { text-align:left; } |
80 | 80 | body.ltr .magnify { float:right; } |
| 81 | + |
| 82 | +/** |
| 83 | + * Hidden categories |
| 84 | + */ |
| 85 | +.mw-hidden-cats-hidden { display: none; } |
Index: trunk/phase3/includes/User.php |
— | — | @@ -76,6 +76,7 @@ |
77 | 77 | 'watchlisthideminor', |
78 | 78 | 'ccmeonemails', |
79 | 79 | 'diffonly', |
| 80 | + 'showhiddencats', |
80 | 81 | ); |
81 | 82 | |
82 | 83 | /** |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -3289,6 +3289,13 @@ |
3290 | 3290 | } |
3291 | 3291 | if ( isset( $this->mDoubleUnderscores['hiddencat'] ) ) { |
3292 | 3292 | $this->mOutput->setProperty( 'hiddencat', 'y' ); |
| 3293 | + |
| 3294 | + $containerCategory = Title::makeTitleSafe( NS_CATEGORY, wfMsg( 'hidden-category-category' ) ); |
| 3295 | + if ( $containerCategory ) { |
| 3296 | + $this->mOutput->addCategory( $containerCategory->getDBkey(), $this->getDefaultSort() ); |
| 3297 | + } else { |
| 3298 | + wfDebug( __METHOD__.": [[MediaWiki:hidden-category-category]] is not a valid title!\n" ); |
| 3299 | + } |
3293 | 3300 | } |
3294 | 3301 | return $text; |
3295 | 3302 | } |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -271,14 +271,12 @@ |
272 | 272 | * Add an array of categories, with names in the keys |
273 | 273 | */ |
274 | 274 | public function addCategoryLinks( $categories ) { |
275 | | - global $wgUser, $wgContLang, $wgTitle; |
| 275 | + global $wgUser, $wgContLang; |
276 | 276 | |
277 | | - if ( !is_array( $categories ) ) { |
| 277 | + if ( !is_array( $categories ) || count( $categories ) == 0 ) { |
278 | 278 | return; |
279 | 279 | } |
280 | | - if ( count( $categories ) == 0 ) { |
281 | | - return; |
282 | | - } |
| 280 | + |
283 | 281 | # Add the links to a LinkBatch |
284 | 282 | $arr = array( NS_CATEGORY => $categories ); |
285 | 283 | $lb = new LinkBatch; |
— | — | @@ -287,8 +285,8 @@ |
288 | 286 | # Fetch existence plus the hiddencat property |
289 | 287 | $dbr = wfGetDB( DB_SLAVE ); |
290 | 288 | $pageTable = $dbr->tableName( 'page' ); |
| 289 | + $where = $lb->constructSet( 'page', $dbr ); |
291 | 290 | $propsTable = $dbr->tableName( 'page_props' ); |
292 | | - $where = $lb->constructSet( 'page', $dbr ); |
293 | 291 | $sql = "SELECT page_id, page_namespace, page_title, pp_value FROM $pageTable LEFT JOIN $propsTable " . |
294 | 292 | " ON pp_propname='hiddencat' AND pp_page=page_id WHERE $where"; |
295 | 293 | $res = $dbr->query( $sql, __METHOD__ ); |
— | — | @@ -296,19 +294,23 @@ |
297 | 295 | # Add the results to the link cache |
298 | 296 | $lb->addResultToCache( LinkCache::singleton(), $res ); |
299 | 297 | |
300 | | - # Remove categories with hiddencat |
| 298 | + # Set all the values to 'normal'. This can be done with array_fill_keys in PHP 5.2.0+ |
| 299 | + $categories = array_combine( array_keys( $categories ), |
| 300 | + array_fill( 0, count( $categories ), 'normal' ) ); |
| 301 | + |
| 302 | + # Mark hidden categories |
301 | 303 | foreach ( $res as $row ) { |
302 | | - if ( isset( $row->pp_value ) and $wgTitle->getNamespace() != NS_CATEGORY ) { |
303 | | - unset( $categories[$row->page_title] ); |
| 304 | + if ( isset( $row->pp_value ) ) { |
| 305 | + $categories[$row->page_title] = 'hidden'; |
304 | 306 | } |
305 | 307 | } |
306 | | - |
| 308 | + |
307 | 309 | # Add the remaining categories to the skin |
308 | 310 | $sk = $wgUser->getSkin(); |
309 | | - foreach ( $categories as $category => $unused ) { |
| 311 | + foreach ( $categories as $category => $type ) { |
310 | 312 | $title = Title::makeTitleSafe( NS_CATEGORY, $category ); |
311 | 313 | $text = $wgContLang->convertHtml( $title->getText() ); |
312 | | - $this->mCategoryLinks[] = $sk->makeLinkObj( $title, $text ); |
| 314 | + $this->mCategoryLinks[$type][] = $sk->makeLinkObj( $title, $text ); |
313 | 315 | } |
314 | 316 | } |
315 | 317 | |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1326,7 +1326,7 @@ |
1327 | 1327 | * to ensure that client-side caches don't keep obsolete copies of global |
1328 | 1328 | * styles. |
1329 | 1329 | */ |
1330 | | -$wgStyleVersion = '116'; |
| 1330 | +$wgStyleVersion = '117'; |
1331 | 1331 | |
1332 | 1332 | |
1333 | 1333 | # Server-side caching: |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -300,7 +300,7 @@ |
301 | 301 | global $wgScript, $wgStylePath, $wgUser; |
302 | 302 | global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang; |
303 | 303 | global $wgTitle, $wgCanonicalNamespaceNames, $wgOut, $wgArticle; |
304 | | - global $wgBreakFrames, $wgRequest; |
| 304 | + global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths; |
305 | 305 | global $wgUseAjax, $wgAjaxWatch; |
306 | 306 | global $wgVersion, $wgEnableAPI, $wgEnableWriteAPI; |
307 | 307 | |
— | — | @@ -313,6 +313,8 @@ |
314 | 314 | 'wgArticlePath' => $wgArticlePath, |
315 | 315 | 'wgScriptPath' => $wgScriptPath, |
316 | 316 | 'wgScript' => $wgScript, |
| 317 | + 'wgVariantArticlePath' => $wgVariantArticlePath, |
| 318 | + 'wgActionPaths' => $wgActionPaths, |
317 | 319 | 'wgServer' => $wgServer, |
318 | 320 | 'wgCanonicalNamespace' => $nsname, |
319 | 321 | 'wgCanonicalSpecialPageName' => SpecialPage::resolveAlias( $wgTitle->getDBkey() ), |
— | — | @@ -627,7 +629,7 @@ |
628 | 630 | |
629 | 631 | function getCategoryLinks () { |
630 | 632 | global $wgOut, $wgTitle, $wgUseCategoryBrowser; |
631 | | - global $wgContLang; |
| 633 | + global $wgContLang, $wgUser; |
632 | 634 | |
633 | 635 | if( count( $wgOut->mCategoryLinks ) == 0 ) return ''; |
634 | 636 | |
— | — | @@ -639,12 +641,33 @@ |
640 | 642 | $dir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; |
641 | 643 | $embed = "<span dir='$dir'>"; |
642 | 644 | $pop = '</span>'; |
643 | | - $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $wgOut->mCategoryLinks ) . $pop; |
644 | 645 | |
645 | | - $msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escape' ), count( $wgOut->mCategoryLinks ) ); |
646 | | - $s = $this->makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg ) |
647 | | - . ': ' . $t; |
| 646 | + $allCats = $wgOut->getCategoryLinks(); |
| 647 | + $s = ''; |
| 648 | + if ( !empty( $allCats['normal'] ) ) { |
| 649 | + $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $allCats['normal'] ) . $pop; |
| 650 | + |
| 651 | + $msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escape' ), count( $allCats['normal'] ) ); |
| 652 | + $s .= '<div id="mw-normal-catlinks">' . |
| 653 | + $this->makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg ) |
| 654 | + . ': ' . $t . '</div>'; |
| 655 | + } |
648 | 656 | |
| 657 | + # Hidden categories |
| 658 | + if ( isset( $allCats['hidden'] ) ) { |
| 659 | + if ( $wgUser->getBoolOption( 'showhiddencats' ) ) { |
| 660 | + $class ='mw-hidden-cats-user-shown'; |
| 661 | + } elseif ( $wgTitle->getNamespace() == NS_CATEGORY ) { |
| 662 | + $class = 'mw-hidden-cats-ns-shown'; |
| 663 | + } else { |
| 664 | + $class = 'mw-hidden-cats-hidden'; |
| 665 | + } |
| 666 | + $s .= "<div id=\"mw-hidden-catlinks\" class=\"$class\">" . |
| 667 | + wfMsgExt( 'hidden-categories', array( 'parsemag', 'escape' ), count( $allCats['hidden'] ) ) . |
| 668 | + ': ' . $embed . implode( "$pop $sep $embed", $allCats['hidden'] ) . $pop . |
| 669 | + "</div>"; |
| 670 | + } |
| 671 | + |
649 | 672 | # optional 'dmoz-like' category browser. Will be shown under the list |
650 | 673 | # of categories an article belong to |
651 | 674 | if($wgUseCategoryBrowser) { |
— | — | @@ -690,7 +713,7 @@ |
691 | 714 | function getCategories() { |
692 | 715 | $catlinks=$this->getCategoryLinks(); |
693 | 716 | if(!empty($catlinks)) { |
694 | | - return "<p class='catlinks'>{$catlinks}</p>"; |
| 717 | + return "<div class='catlinks'>{$catlinks}</div>"; |
695 | 718 | } |
696 | 719 | } |
697 | 720 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -501,6 +501,7 @@ |
502 | 502 | 'tog-nolangconversion' => 'Disable variants conversion', # only translate this message to other languages if you have to change it |
503 | 503 | 'tog-ccmeonemails' => 'Send me copies of emails I send to other users', |
504 | 504 | 'tog-diffonly' => "Don't show page content below diffs", |
| 505 | +'tog-showhiddencats' => 'Show hidden categories', |
505 | 506 | |
506 | 507 | 'underline-always' => 'Always', |
507 | 508 | 'underline-never' => 'Never', |
— | — | @@ -568,6 +569,8 @@ |
569 | 570 | 'subcategories' => 'Subcategories', |
570 | 571 | 'category-media-header' => 'Media in category "$1"', |
571 | 572 | 'category-empty' => "''This category currently contains no pages or media.''", |
| 573 | +'hidden-categories' => '{{PLURAL:$1|Hidden category|Hidden categories}}', |
| 574 | +'hidden-category-category' => 'Hidden categories', # Name of the category where hidden categories will be listed |
572 | 575 | |
573 | 576 | 'linkprefix' => '/^(.*?)([a-zA-Z\x80-\xff]+)$/sD', # only translate this message to other languages if you have to change it |
574 | 577 | 'mainpagetext' => "<big>'''MediaWiki has been successfully installed.'''</big>", |