X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=skins%2FVector.php;h=cea32838c4dcdd5d54bcdd6140595524fa18d0b0;hb=c4012b03bcf5d8c46343c9294260932ec55d6f5b;hp=42fdb39b7ed673f536106e38e838c7c0367d533a;hpb=8819185e28fb1c98fe69c5d72b008a38b782cb95;p=lhc%2Fweb%2Fwiklou.git
diff --git a/skins/Vector.php b/skins/Vector.php
index 42fdb39b7e..cea32838c4 100644
--- a/skins/Vector.php
+++ b/skins/Vector.php
@@ -35,10 +35,15 @@ class SkinVector extends SkinTemplate {
* @param object $out Output page to add styles to
*/
public function setupSkinUserCss( OutputPage $out ) {
- parent::setupSkinUserCss( $out );
-
+ global $wgContLang;
// Append to the default screen common & print styles...
- $out->addStyle( 'vector/main.css', 'screen' );
+ if ( $wgContLang->isRTL() ) {
+ $out->addStyle( 'vector/main-rtl.css', 'screen' );
+ } else {
+ $out->addStyle( 'vector/main-ltr.css', 'screen' );
+ }
+ // Add common styles
+ parent::setupSkinUserCss( $out );
}
/**
@@ -47,7 +52,7 @@ class SkinVector extends SkinTemplate {
* @private
*/
function buildNavigationUrls() {
- global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest;
+ global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle;
global $wgDisableLangConversion;
wfProfileIn( __METHOD__ );
@@ -58,7 +63,7 @@ class SkinVector extends SkinTemplate {
'actions' => array(),
'variants' => array()
);
-
+
// Detects parameters
$action = $wgRequest->getVal( 'action', 'view' );
$section = $wgRequest->getVal( 'section' );
@@ -74,31 +79,35 @@ class SkinVector extends SkinTemplate {
$isTalk = $this->mTitle->isTalkPage();
// Generates XML IDs from namespace names
- $subjectId = $wgContLang->lc( $this->mTitle->getSubjectNsText() );
- if ( $subjectId == '' ) {
- $subjectId = 'main';
+ $subjectId = $this->mTitle->getNamespaceKey( '' );
+
+ if ( $subjectId == 'main' ) {
+ $talkId = 'talk';
+ } else {
+ $talkId = "{$subjectId}_talk";
}
- $talkId = "{$subjectId}_talk";
$currentId = $isTalk ? $talkId : $subjectId;
-
+
// Adds namespace links
$links['namespaces'][$subjectId] = $this->tabAction(
- $subjectPage, 'nstab-' . $subjectId, !$isTalk, '', true
+ $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true
);
+ $links['namespaces'][$subjectId]['context'] = 'subject';
$links['namespaces'][$talkId] = $this->tabAction(
- $talkPage, 'talk', $isTalk, '', true
+ $talkPage, 'vector-namespace-talk', $isTalk, '', true
);
-
+ $links['namespaces'][$talkId]['context'] = 'talk';
+
// Adds view view link
if ( $this->mTitle->exists() ) {
$links['views']['view'] = $this->tabAction(
$isTalk ? $talkPage : $subjectPage,
- 'view', ( $action == 'view' ), '', true
+ 'vector-view-view', ( $action == 'view' ), '', true
);
}
-
+
wfProfileIn( __METHOD__ . '-edit' );
-
+
// Checks if user can...
if (
// edit the current page
@@ -121,20 +130,20 @@ class SkinVector extends SkinTemplate {
$links['views']['edit'] = array(
'class' => ( $selected ? 'selected' : '' ) . $isTalkClass,
'text' => $this->mTitle->exists()
- ? wfMsg( 'edit' )
- : wfMsg( 'create' ),
+ ? wfMsg( 'vector-view-edit' )
+ : wfMsg( 'vector-view-create' ),
'href' =>
$this->mTitle->getLocalUrl( $this->editUrlOptions() )
);
- // Checks if this is a talk page and we should show a new
+ // Checks if this is a current rev of talk page and we should show a new
// section link
- if ( $isTalk || $wgOut->showNewSectionLink() ) {
+ if ( ( $isTalk && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) {
// Checks if we should ever show a new section link
if ( !$wgOut->forceHideNewSectionLink() ) {
// Adds new section link
$links['actions']['addsection'] = array(
'class' => $section == 'new' ? 'selected' : false,
- 'text' => wfMsg( 'addsection' ),
+ 'text' => wfMsg( 'vector-action-addsection' ),
'href' => $this->mTitle->getLocalUrl(
'action=edit§ion=new'
)
@@ -146,7 +155,7 @@ class SkinVector extends SkinTemplate {
// Adds view source view link
$links['views']['viewsource'] = array(
'class' => ( $action == 'edit' ) ? 'selected' : false,
- 'text' => wfMsg( 'viewsource' ),
+ 'text' => wfMsg( 'vector-view-viewsource' ),
'href' =>
$this->mTitle->getLocalUrl( $this->editUrlOptions() )
);
@@ -160,7 +169,7 @@ class SkinVector extends SkinTemplate {
// Adds history view link
$links['views']['history'] = array(
'class' => ($action == 'history') ? 'selected' : false,
- 'text' => wfMsg( 'history_short' ),
+ 'text' => wfMsg( 'vector-view-history' ),
'href' => $this->mTitle->getLocalUrl( 'action=history' ),
'rel' => 'archives',
);
@@ -168,7 +177,7 @@ class SkinVector extends SkinTemplate {
if( $wgUser->isAllowed( 'delete' ) ) {
$links['actions']['delete'] = array(
'class' => ($action == 'delete') ? 'selected' : false,
- 'text' => wfMsg( 'delete' ),
+ 'text' => wfMsg( 'vector-action-delete' ),
'href' => $this->mTitle->getLocalUrl( 'action=delete' )
);
}
@@ -179,7 +188,7 @@ class SkinVector extends SkinTemplate {
$links['actions']['move'] = array(
'class' => $this->mTitle->isSpecial( 'Movepage' ) ?
'selected' : false,
- 'text' => wfMsg( 'move' ),
+ 'text' => wfMsg( 'vector-action-move' ),
'href' => $moveTitle->getLocalUrl()
);
}
@@ -192,7 +201,7 @@ class SkinVector extends SkinTemplate {
$links['actions']['protect'] = array(
'class' => ($action == 'protect') ?
'selected' : false,
- 'text' => wfMsg( 'protect' ),
+ 'text' => wfMsg( 'vector-action-protect' ),
'href' =>
$this->mTitle->getLocalUrl( 'action=protect' )
);
@@ -201,7 +210,7 @@ class SkinVector extends SkinTemplate {
$links['actions']['unprotect'] = array(
'class' => ($action == 'unprotect') ?
'selected' : false,
- 'text' => wfMsg( 'unprotect' ),
+ 'text' => wfMsg( 'vector-action-unprotect' ),
'href' =>
$this->mTitle->getLocalUrl( 'action=unprotect' )
);
@@ -218,7 +227,7 @@ class SkinVector extends SkinTemplate {
$links['actions']['undelete'] = array(
'class' => false,
'text' => wfMsgExt(
- 'undelete_short',
+ 'vector-action-undelete',
array( 'parsemag' ),
$wgLang->formatNum( $n )
),
@@ -237,7 +246,7 @@ class SkinVector extends SkinTemplate {
$links['actions']['protect'] = array(
'class' => ($action == 'protect') ?
'selected' : false,
- 'text' => wfMsg( 'protect' ),
+ 'text' => wfMsg( 'vector-action-protect' ),
'href' =>
$this->mTitle->getLocalUrl( 'action=protect' )
);
@@ -246,7 +255,7 @@ class SkinVector extends SkinTemplate {
$links['actions']['unprotect'] = array(
'class' => ($action == 'unprotect') ?
'selected' : false,
- 'text' => wfMsg( 'unprotect' ),
+ 'text' => wfMsg( 'vector-action-unprotect' ),
'href' =>
$this->mTitle->getLocalUrl( 'action=unprotect' )
);
@@ -254,7 +263,16 @@ class SkinVector extends SkinTemplate {
}
}
wfProfileOut( __METHOD__ . '-live' );
-
+
+ /**
+ * The following actions use messages which, if made particular to
+ * the Vector skin, would break the Ajax code which makes this
+ * action happen entirely inline. Skin::makeGlobalVariablesScript
+ * defines a set of messages in a javascript object - and these
+ * messages are assumed to be global for all skins. Without making
+ * a change to that procedure these messages will have to remain as
+ * the global versions.
+ */
// Checks if the user is logged in
if( $this->loggedin ) {
// Checks if the user is watching this page
@@ -278,12 +296,15 @@ class SkinVector extends SkinTemplate {
);
}
}
-
+
+ // This is instead of SkinTemplateTabs - which uses a flat array
+ wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) );
+
// If it's not content, it's got to be a special page
} else {
$links['namespaces']['special'] = array(
'class' => 'selected',
- 'text' => wfMsg( 'nstab-special' ),
+ 'text' => wfMsg( 'vector-namespace-special' ),
'href' => $wgRequest->getRequestURL()
);
}
@@ -295,7 +316,6 @@ class SkinVector extends SkinTemplate {
// Gets preferred variant
$preferred = $wgContLang->getPreferredVariant();
// Loops over each variant
- $vcount = 0;
foreach( $variants as $code ) {
// Gets variant name from language code
$varname = $wgContLang->getVariantname( $code );
@@ -305,12 +325,11 @@ class SkinVector extends SkinTemplate {
continue;
}
// Appends variant link
- $links['variants'][$vcount] = array(
+ $links['variants'][] = array(
'class' => ( $code == $preferred ) ? 'selected' : false,
'text' => $varname,
'href' => $this->mTitle->getLocalURL( '', $code )
);
- $vcount ++;
}
}
@@ -352,8 +371,16 @@ class VectorTemplate extends QuickTemplate {
$nav = $this->skin->buildNavigationUrls();
foreach ( $nav as $section => $links ) {
foreach ( $links as $key => $link ) {
+ $xmlID = $key;
+ if ( isset( $link['context'] ) && $link['context'] == 'subject' ) {
+ $xmlID = 'ca-nstab-' . $xmlID;
+ } else if ( isset( $link['context'] ) && $link['context'] == 'talk' ) {
+ $xmlID = 'ca-talk';
+ } else {
+ $xmlID = 'ca-' . $xmlID;
+ }
$nav[$section][$key]['attributes'] =
- ' id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
+ ' id="' . Sanitizer::escapeId( $xmlID ) . '"';
if ( $nav[$section][$key]['class'] ) {
$nav[$section][$key]['attributes'] .=
' class="' . htmlspecialchars( $link['class'] ) . '"';
@@ -368,10 +395,10 @@ class VectorTemplate extends QuickTemplate {
in_array( $key, array( 'edit', 'watch', 'unwatch' ) )
) {
$nav[$section][$key]['key'] =
- $this->skin->tooltip( "ca-$key" );
+ $this->skin->tooltip( $xmlID );
} else {
$nav[$section][$key]['key'] =
- $this->skin->tooltipAndAccesskey( "ca-$key" );
+ $this->skin->tooltipAndAccesskey( $xmlID );
}
}
}
@@ -379,7 +406,7 @@ class VectorTemplate extends QuickTemplate {
$this->data['view_urls'] = $nav['views'];
$this->data['action_urls'] = $nav['actions'];
$this->data['variant_urls'] = $nav['variants'];
-
+
// Build additional attributes for personal_urls
foreach ( $this->data['personal_urls'] as $key => $item) {
$this->data['personal_urls'][$key]['attributes'] =
@@ -435,6 +462,7 @@ class VectorTemplate extends QuickTemplate {
+
data ); ?>
@@ -477,219 +505,200 @@ class VectorTemplate extends QuickTemplate {
data['body_ondblclick']): ?> ondblclick="text('body_ondblclick') ?>" data['body_onload']): ?> onload="text('body_onload') ?>" class="mediawiki text('dir') ?> text('pageclass') ?> text('skinnameclass') ?>">
-
-
-
-
-
-
-
-
-
- data['sitenotice']) { ?>
html('sitenotice') ?>
-
-
-
html('title') ?>
-
-
-
-
-
msg('tagline') ?>
-
-
-
html('subtitle') ?>
-
- data['undelete']): ?>
-
-
html('undelete') ?>
-
-
- data['newtalk'] ): ?>
-
-
html('newtalk') ?>
-
-
- data['showjumplinks']): ?>
-
-
-
-
-
- html('bodytext') ?>
-
-
- data['catlinks']) { $this->html('catlinks'); } ?>
-
-
- data['dataAfterContent']) { $this->html('dataAfterContent'); } ?>
-
-
-
-
+
+
+
+
+
+
+
+ data['sitenotice']) { ?>
html('sitenotice') ?>
+
+
+
html('title') ?>
+
+
+
+
+
msg('tagline') ?>
+
+
+
html('subtitle') ?>
+
+ data['undelete']): ?>
+
+
html('undelete') ?>
+
+
+ data['newtalk'] ): ?>
+
+
html('newtalk') ?>
+
+
+ data['showjumplinks']): ?>
+
+
+
+
+
+ html('bodytext') ?>
+
+
+ data['catlinks']) { $this->html('catlinks'); } ?>
+
+
+ data['dataAfterContent']) { $this->html('dataAfterContent'); } ?>
+
+
-
-
-
-
-
-
-
-
-
msg('personaltools') ?>
-
html('userlangattributes') ?>>
- data['personal_urls'] as $key => $item): ?>
- - > class="">
-
-
-
-
-
-
-
-
-
-
msg('namespaces') ?>
-
html('userlangattributes') ?>>
- data['namespace_urls'] as $key => $link ): ?>
- - >>
-
-
-
-
-
- data['variant_urls'] ) > 0 ): ?>
-
-
-
-
-
-
- data['view_urls'] ) > 0 ): ?>
-
-
msg('views') ?>
-
html('userlangattributes') ?>>
- data['view_urls'] as $key => $link ): ?>
- - class="">>
-
-
-
-
-
-
- data['action_urls'] ) > 0 ): ?>
-
-
-
-
-
-
-
html('userlangattributes') ?>>
-
-
-
-
-
-
+
+
+
+
+
+
+
+
msg('personaltools') ?>
+
html('userlangattributes') ?>>
+ data['personal_urls'] as $key => $item): ?>
+ - > class="">
+
+
-
-
-
-
-
-
-
-
- data['sidebar'];
- $sidebar['TOOLBOX'] = ( !isset( $sidebar['TOOLBOX'] ) );
- $sidebar['LANGUAGES'] = ( !isset( $sidebar['LANGUAGES'] ) );
- foreach ( $sidebar as $name => $content ) {
- switch( $name ) {
- case 'SEARCH':
- break;
- case 'TOOLBOX':
- $this->toolBox();
- break;
- case 'LANGUAGES':
- $this->languageBox();
- break;
- default:
- $this->customBox( $name, $content );
- break;
- }
- }
- ?>
-
+
+
+
+
+
msg('namespaces') ?>
+
html('userlangattributes') ?>>
+ data['namespace_urls'] as $key => $link ): ?>
+ - >>
+
+
+
+
+
+ data['variant_urls'] ) > 0 ): ?>
+
+
+
-
-
-
-