Index: trunk/phase3/skins/Vector.php |
— | — | @@ -79,11 +79,8 @@ |
80 | 80 | $isTalk = $this->mTitle->isTalkPage(); |
81 | 81 | |
82 | 82 | // Generates XML IDs from namespace names |
83 | | - $subjectId = $wgContLang->lc($wgCanonicalNamespaceNames[MWNamespace::getSubject($this->mTitle->getNamespace())]); |
| 83 | + $subjectId = $this->mTitle->getNamespaceKey( '' ); |
84 | 84 | |
85 | | - if ( $subjectId == '' ) { |
86 | | - $subjectId = 'main'; |
87 | | - } |
88 | 85 | if ( $subjectId == 'main' ) { |
89 | 86 | $talkId = 'talk'; |
90 | 87 | } else { |
— | — | @@ -95,9 +92,11 @@ |
96 | 93 | $links['namespaces'][$subjectId] = $this->tabAction( |
97 | 94 | $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true |
98 | 95 | ); |
| 96 | + $links['namespaces'][$subjectId]['context'] = 'subject'; |
99 | 97 | $links['namespaces'][$talkId] = $this->tabAction( |
100 | 98 | $talkPage, 'vector-namespace-talk', $isTalk, '', true |
101 | 99 | ); |
| 100 | + $links['namespaces'][$talkId]['context'] = 'talk'; |
102 | 101 | |
103 | 102 | // Adds view view link |
104 | 103 | if ( $this->mTitle->exists() ) { |
— | — | @@ -374,8 +373,12 @@ |
375 | 374 | $nav = $this->skin->buildNavigationUrls(); |
376 | 375 | foreach ( $nav as $section => $links ) { |
377 | 376 | foreach ( $links as $key => $link ) { |
| 377 | + $insert = ''; |
| 378 | + if ( isset( $link['context'] ) && $link['context'] == 'subject' ) { |
| 379 | + $insert = 'nstab-'; |
| 380 | + } |
378 | 381 | $nav[$section][$key]['attributes'] = |
379 | | - ' id="' . Sanitizer::escapeId( "ca-$key" ) . '"'; |
| 382 | + ' id="' . Sanitizer::escapeId( "ca-{$insert}{$key}" ) . '"'; |
380 | 383 | if ( $nav[$section][$key]['class'] ) { |
381 | 384 | $nav[$section][$key]['attributes'] .= |
382 | 385 | ' class="' . htmlspecialchars( $link['class'] ) . '"'; |
— | — | @@ -390,10 +393,10 @@ |
391 | 394 | in_array( $key, array( 'edit', 'watch', 'unwatch' ) ) |
392 | 395 | ) { |
393 | 396 | $nav[$section][$key]['key'] = |
394 | | - $this->skin->tooltip( "ca-$key" ); |
| 397 | + $this->skin->tooltip( "ca-{$insert}{$key}" ); |
395 | 398 | } else { |
396 | 399 | $nav[$section][$key]['key'] = |
397 | | - $this->skin->tooltipAndAccesskey( "ca-$key" ); |
| 400 | + $this->skin->tooltipAndAccesskey( "ca-{$insert}{$key}" ); |
398 | 401 | } |
399 | 402 | } |
400 | 403 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -3521,40 +3521,29 @@ |
3522 | 3522 | * Generate strings used for xml 'id' names in monobook tabs |
3523 | 3523 | * @return \type{\string} XML 'id' name |
3524 | 3524 | */ |
3525 | | - public function getNamespaceKey() { |
3526 | | - global $wgContLang; |
3527 | | - switch ($this->getNamespace()) { |
3528 | | - case NS_MAIN: |
3529 | | - case NS_TALK: |
3530 | | - return 'nstab-main'; |
3531 | | - case NS_USER: |
3532 | | - case NS_USER_TALK: |
3533 | | - return 'nstab-user'; |
3534 | | - case NS_MEDIA: |
3535 | | - return 'nstab-media'; |
3536 | | - case NS_SPECIAL: |
3537 | | - return 'nstab-special'; |
3538 | | - case NS_PROJECT: |
3539 | | - case NS_PROJECT_TALK: |
3540 | | - return 'nstab-project'; |
3541 | | - case NS_FILE: |
3542 | | - case NS_FILE_TALK: |
3543 | | - return 'nstab-image'; |
3544 | | - case NS_MEDIAWIKI: |
3545 | | - case NS_MEDIAWIKI_TALK: |
3546 | | - return 'nstab-mediawiki'; |
3547 | | - case NS_TEMPLATE: |
3548 | | - case NS_TEMPLATE_TALK: |
3549 | | - return 'nstab-template'; |
3550 | | - case NS_HELP: |
3551 | | - case NS_HELP_TALK: |
3552 | | - return 'nstab-help'; |
3553 | | - case NS_CATEGORY: |
3554 | | - case NS_CATEGORY_TALK: |
3555 | | - return 'nstab-category'; |
3556 | | - default: |
3557 | | - return 'nstab-' . $wgContLang->lc( $this->getSubjectNsText() ); |
| 3525 | + public function getNamespaceKey( $prepend = 'nstab-' ) { |
| 3526 | + global $wgContLang, $wgCanonicalNamespaceNames; |
| 3527 | + // Gets the subject namespace if this title |
| 3528 | + $namespace = MWNamespace::getSubject( $this->getNamespace() ); |
| 3529 | + // Checks if cononical namespace name exists for namespace |
| 3530 | + if ( isset( $wgCanonicalNamespaceNames[$namespace] ) ) { |
| 3531 | + // Uses canonical namespace name |
| 3532 | + $namespaceKey = $wgCanonicalNamespaceNames[$namespace]; |
| 3533 | + } else { |
| 3534 | + // Uses text of namespace |
| 3535 | + $namespaceKey = $this->getSubjectNsText(); |
3558 | 3536 | } |
| 3537 | + // Makes namespace key lowercase |
| 3538 | + $namespaceKey = $wgContLang->lc( $namespaceKey ); |
| 3539 | + // Uses main |
| 3540 | + if ( $namespaceKey == '' ) { |
| 3541 | + $namespaceKey = 'main'; |
| 3542 | + } |
| 3543 | + // Changes file to image for backwards compatibility |
| 3544 | + if ( $namespaceKey == 'file' ) { |
| 3545 | + $namespaceKey = 'image'; |
| 3546 | + } |
| 3547 | + return $prepend . $namespaceKey; |
3559 | 3548 | } |
3560 | 3549 | |
3561 | 3550 | /** |