From bd24bf4fb491e36cbb786b8a3fd9c0f5d09ad2db Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Wed, 31 May 2006 20:39:14 +0000 Subject: [PATCH] * Reverting BiDi changes because there were some problems left --- RELEASE-NOTES | 1 - includes/Article.php | 4 +- includes/EditPage.php | 5 +- includes/GlobalFunctions.php | 38 +----------- includes/OutputPage.php | 9 +-- includes/Skin.php | 23 ++++--- includes/SkinTemplate.php | 25 ++------ includes/SpecialImagelist.php | 2 +- includes/SpecialNewpages.php | 2 +- includes/SpecialShortpages.php | 2 +- includes/SpecialUnusedimages.php | 2 +- skins/CologneBlue.php | 7 +-- skins/MonoBook.php | 7 +-- skins/Standard.php | 14 ++--- skins/common/common_content_rtl.css | 1 - skins/monobook/content_rtl.css | 93 ----------------------------- skins/monobook/main.css | 6 +- skins/monobook/rtl.css | 75 +++++++++++++---------- 18 files changed, 86 insertions(+), 230 deletions(-) delete mode 100644 skins/common/common_content_rtl.css delete mode 100644 skins/monobook/content_rtl.css diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7d65490d92..44700dfcd3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -391,7 +391,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 6126) Allow fallback to customized primary language when user language message contains '-'; fixes licenses selector on Commons configuration after recent addition of the message to Messages.php -* (bug 6100) BiDi: different directionality for user interface and wiki content == Compatibility == diff --git a/includes/Article.php b/includes/Article.php index d970a20aee..d4a3cdef44 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -734,7 +734,7 @@ class Article { * the given title. */ function view() { - global $wgUser, $wgOut, $wgRequest, $wgLang; + global $wgUser, $wgOut, $wgRequest, $wgContLang; global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser; global $wgUseTrackbacks; $sk = $wgUser->getSkin(); @@ -891,7 +891,7 @@ class Article { $wgOut->addHTML( '
'.htmlspecialchars($this->mContent)."\n
" ); } else if ( $rt = Title::newFromRedirect( $text ) ) { # Display redirect - $imageDir = $wgLang->isRTL() ? 'rtl' : 'ltr'; + $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; $imageUrl = $wgStylePath.'/common/images/redirect' . $imageDir . '.png'; # Don't overwrite the subtitle if this was an old revision if( !$wasRedirected && $this->isCurrent() ) { diff --git a/includes/EditPage.php b/includes/EditPage.php index 30ed522591..341427b63a 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1313,10 +1313,7 @@ END $wgOut->addParserOutputNoText( $parserOutput ); wfProfileOut( $fname ); - return $previewhead . - '
' . - $previewHTML . - '
'; + return $previewhead . $previewHTML; } } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 992499bae2..f8ef126ace 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1634,12 +1634,8 @@ function in_string( $needle, $str ) { } function wfSpecialList( $page, $details ) { - global $wgLang, $wgContLang; - - if ($wgLang->isRTL() != $wgContLang->isRTL()) { - $page = "$page"; - } - $details = $details ? ' ' . $wgLang->getDirMark() . "($details)" : ""; + global $wgContLang; + $details = $details ? ' ' . $wgContLang->getDirMark() . "($details)" : ""; return $page . $details; } @@ -1854,36 +1850,6 @@ function wfExplodeMarkup( $separator, $text ) { return $items; } -/** @todo document */ -/* returns a dir="rtl" or dir="ltr" for the layout (eg: uselang) */ -function layoutdir() { - global $wgLang, $wgLanguageCode, $wgContLang, $wgContLanguageCode; - $lang = ""; - $dir = ""; - if ( $wgLanguageCode != $wgContLanguageCode ) { - $lang = " lang='$wgLanguageCode'"; - } - if ( $wgLang->isRTL() != $wgContLang->isRTL() ) { - $dir = $wgLang->isRTL() ? " dir='rtl'" : " dir='ltr'"; - } - return $lang . $dir; -} - -/** @todo document */ -/* returns a dir="rtl" or dir="ltr" for the content (wiki lang) */ -function contentdir() { - global $wgLang, $wgLanguageCode, $wgContLang, $wgContLanguageCode; - $lang = ""; - $dir = ""; - if ( $wgLanguageCode != $wgContLanguageCode ) { - $lang = " lang='$wgContLanguageCode'"; - } - if ( $wgLang->isRTL() != $wgContLang->isRTL() ) { - $dir = $wgContLang->isRTL() ? " dir='rtl'" : " dir='ltr'"; - } - return $lang . $dir; -} - class ReplacerCallback { function ReplacerCallback( $from, $to ) { $this->from = $from; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 98977e4a79..c155d380c4 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -332,9 +332,7 @@ class OutputPage { $text = $parserOutput->getText(); wfRunHooks( 'OutputPageBeforeHTML',array( &$this, &$text ) ); $parserOutput->setText( $text ); - $this->addHTML( '
'); $this->addHTML( $parserOutput->getText() ); - $this->addHTML( '
'); } /** @@ -387,9 +385,7 @@ class OutputPage { $this->mNewSectionLink = $parserOutput->getNewSection(); $text = $parserOutput->getText(); wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) ); - $this->addHTML( '
'); $this->addHTML( $text ); - $this->addHTML( '
'); $t = $parserOutput->getTitleText(); if( !empty( $t ) ) { $this->setPageTitle( $t ); @@ -952,7 +948,6 @@ class OutputPage { function headElement() { global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType; global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle; - global $wgLang, $wgLanguageCode; if( $wgMimeType == 'text/xml' || $wgMimeType == 'application/xhtml+xml' || $wgMimeType == 'application/xml' ) { $ret = "\n"; @@ -966,8 +961,8 @@ class OutputPage { $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() )); } - $rtl = $wgLang->isRTL() ? " dir='RTL'" : ''; - $ret .= "\n"; + $rtl = $wgContLang->isRTL() ? " dir='RTL'" : ''; + $ret .= "\n"; $ret .= "\n" . htmlspecialchars( $this->getHTMLTitle() ) . "\n"; array_push( $this->mMetatags, array( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" ) ); diff --git a/includes/Skin.php b/includes/Skin.php index a66fe2ec31..5bf36abec4 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -297,12 +297,11 @@ class Skin extends Linker { # get the user/site-specific stylesheet, SkinTemplate loads via RawPage.php (settings are cached that way) function getUserStylesheet() { - global $wgStylePath, $wgRequest, $wgLang, $wgContLang, $wgSquidMaxage; + global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage; $sheet = $this->getStylesheet(); $action = $wgRequest->getText('action'); $s = "@import \"$wgStylePath/$sheet\";\n"; - if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n"; - if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_content_rtl.css\";\n"; + if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n"; $query = "action=raw&ctype=text/css&smaxage=$wgSquidMaxage"; $s .= '@import "' . $this->makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) . "\";\n" . @@ -435,7 +434,7 @@ END; } function doBeforeContent() { - global $wgLang; + global $wgContLang; $fname = 'Skin::doBeforeContent'; wfProfileIn( $fname ); @@ -456,7 +455,7 @@ END; $shove = ($qb != 0); $left = ($qb == 1 || $qb == 3); - if($wgLang->isRTL()) $left = !$left; + if($wgContLang->isRTL()) $left = !$left; if ( !$shove ) { $s .= "\n" . @@ -464,13 +463,13 @@ END; } elseif( $left ) { $s .= $this->getQuickbarCompensator( $rows ); } - $l = $wgLang->isRTL() ? 'right' : 'left'; + $l = $wgContLang->isRTL() ? 'right' : 'left'; $s .= "\n"; $s .= $this->topLinks() ; $s .= "

" . $this->pageTitleLinks() . "

\n"; - $r = $wgLang->isRTL() ? "left" : "right"; + $r = $wgContLang->isRTL() ? "left" : "right"; $s .= "\n"; $s .= $this->nameAndLogin(); $s .= "\n
" . $this->searchForm() . ""; @@ -997,7 +996,7 @@ END; if ( '' != $align ) { $a = " align='{$align}'"; } else { $a = ''; } - $mp = wfMsgForContent( 'mainpage' ); + $mp = wfMsg( 'mainpage' ); $titleObj = Title::newFromText( $mp ); if ( is_object( $titleObj ) ) { $url = $titleObj->escapeLocalURL(); @@ -1252,7 +1251,7 @@ END; } function otherLanguages() { - global $wgOut, $wgLang, $wgHideInterlanguageLinks; + global $wgOut, $wgContLang, $wgHideInterlanguageLinks; if ( $wgHideInterlanguageLinks ) { return ''; @@ -1265,20 +1264,20 @@ END; $s = wfMsg( 'otherlanguages' ) . ': '; $first = true; - if($wgLang->isRTL()) $s .= ''; + if($wgContLang->isRTL()) $s .= ''; foreach( $a as $l ) { if ( ! $first ) { $s .= ' | '; } $first = false; $nt = Title::newFromText( $l ); $url = $nt->escapeFullURL(); - $text = $wgLang->getLanguageName( $nt->getInterwiki() ); + $text = $wgContLang->getLanguageName( $nt->getInterwiki() ); if ( '' == $text ) { $text = $l; } $style = $this->getExternalLinkAttributes( $l, $text ); $s .= "{$text}"; } - if($wgLang->isRTL()) $s .= ''; + if($wgContLang->isRTL()) $s .= ''; return $s; } diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 5b86d02197..f054153ada 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -134,7 +134,7 @@ class SkinTemplate extends Skin { */ function outputPage( &$out ) { global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut; - global $wgScript, $wgStylePath, $wgLanguageCode, $wgContLanguageCode; + global $wgScript, $wgStylePath, $wgContLanguageCode; global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest; global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgHideInterlanguageLinks; global $wgMaxCredits, $wgShowCreditsIfMax; @@ -247,20 +247,8 @@ class SkinTemplate extends Skin { $tpl->setRef( 'stylepath', $wgStylePath ); $tpl->setRef( 'logopath', $wgLogo ); $tpl->setRef( "lang", $wgContLanguageCode ); - $tpl->setRef( 'uselang', $wgLanguageCode ); - $tpl->set( 'dir', $wgLang->isRTL() ? "rtl" : "ltr" ); - $tpl->set( 'rtl', $wgLang->isRTL() ); - /* display, if needed, dir=ltr or dir=rtl for the - firstHeading title. This is when the title is - content, eg a site-localized string; - that is the case for all the pages not in Special: - when action is view or history - */ - $tpl->set( 'titledir', - ($this->mTitle->getNamespace() != NS_SPECIAL && - ($action == 'view' || $action == 'history')) ? - contentdir() : "" - ); + $tpl->set( 'dir', $wgContLang->isRTL() ? "rtl" : "ltr" ); + $tpl->set( 'rtl', $wgContLang->isRTL() ); $tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) ); $tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) ); $tpl->setRef( 'username', $this->username ); @@ -404,7 +392,7 @@ class SkinTemplate extends Skin { $nt = Title::newFromText( $l ); $language_urls[] = array( 'href' => $nt->getFullURL(), - 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l), + 'text' => ($wgContLang->getLanguageName( $nt->getInterwiki()) != ''?$wgContLang->getLanguageName( $nt->getInterwiki()) : $l), 'class' => $class ); } @@ -899,7 +887,7 @@ class SkinTemplate extends Skin { $fname = 'SkinTemplate::setupUserCss'; wfProfileIn( $fname ); - global $wgRequest, $wgAllowUserCss, $wgUseSiteCss, $wgLang, $wgContLang, $wgSquidMaxage, $wgStylePath, $wgUser; + global $wgRequest, $wgAllowUserCss, $wgUseSiteCss, $wgContLang, $wgSquidMaxage, $wgStylePath, $wgUser; $sitecss = ''; $usercss = ''; @@ -923,8 +911,7 @@ class SkinTemplate extends Skin { $siteargs .= '&ts=' . $wgUser->mTouched; } - if ($wgLang->isRTL()) $sitecss .= '@import "' . $wgStylePath . '/' . $this->stylename . '/rtl.css";' . "\n"; - if ($wgContLang->isRTL()) $sitecss .= '@import "' . $wgStylePath . '/' . $this->stylename . '/content_rtl.css";' . "\n"; + if ($wgContLang->isRTL()) $sitecss .= '@import "' . $wgStylePath . '/' . $this->stylename . '/rtl.css";' . "\n"; # If we use the site's dynamic CSS, throw that in, too if ( $wgUseSiteCss ) { diff --git a/includes/SpecialImagelist.php b/includes/SpecialImagelist.php index f9b0ca3944..b7972166b6 100644 --- a/includes/SpecialImagelist.php +++ b/includes/SpecialImagelist.php @@ -95,7 +95,7 @@ function wfSpecialImagelist() { $ul = $sk->makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut ); } - $dirmark = $wgLang->getDirMark(); // to keep text in correct direction + $dirmark = $wgContLang->getDirMark(); // to keep text in correct direction $ilink = "" . strtr(htmlspecialchars( $name ), '_', ' ') . ""; diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index cc1a22115d..3f72352f61 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -75,7 +75,7 @@ class NewPagesPage extends QueryPage { global $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol; $u = $result->user; $ut = $result->user_text; - $dirmark = $wgLang->getDirMark(); // To keep text in correct order + $dirmark = $wgContLang->getDirMark(); // To keep text in correct order $length = wfMsgExt( 'nbytes', array('parsemag', 'escape'), $wgLang->formatNum( $result->length ) ); diff --git a/includes/SpecialShortpages.php b/includes/SpecialShortpages.php index b4ca18ad59..5381e2f3a5 100644 --- a/includes/SpecialShortpages.php +++ b/includes/SpecialShortpages.php @@ -58,7 +58,7 @@ class ShortPagesPage extends QueryPage { $title = Title::makeTitle( $result->namespace, $result->title ); $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) ); $histlink = $skin->makeKnownLinkObj( $title, wfMsgHtml('hist'), 'action=history' ); - $dirmark = $wgLang->getDirMark(); + $dirmark = $wgContLang->getDirMark(); return "({$histlink}) {$dirmark}$link {$dirmark}({$nb})"; } diff --git a/includes/SpecialUnusedimages.php b/includes/SpecialUnusedimages.php index 380e1004fe..fa76c57dbb 100644 --- a/includes/SpecialUnusedimages.php +++ b/includes/SpecialUnusedimages.php @@ -48,7 +48,7 @@ class UnusedimagesPage extends QueryPage { $title = Title::makeTitle( NS_IMAGE, $result->title ); $imageUrl = htmlspecialchars( Image::imageUrl( $result->title ) ); - $dirmark = $wgLang->getDirMark(); // To keep text in correct order + $dirmark = $wgContLang->getDirMark(); // To keep text in correct order $return = # The 'desc' linking to the image page diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index d08bbbe0d6..9cb3ef32dd 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -98,15 +98,14 @@ class SkinCologneBlue extends Skin { } function doGetUserStyles() { - global $wgOut, $wgLang, $wgUser; + global $wgOut; $s = parent::doGetUserStyles(); $qb = $this->qbSetting(); - if ( (!$wgUser->isLoggedIn() && $wgLang->isRTL() ) || - ( 2 == $qb ) ) { # Right + if ( 2 == $qb ) { # Right $s .= "#quickbar { position: absolute; right: 4px; }\n" . "#article { margin-left: 4px; margin-right: 148px; }\n"; - } else if ( (!$wgUser->isLoggedIn()) || ( 1 == $qb ) ) { + } else if ( 1 == $qb ) { $s .= "#quickbar { position: absolute; left: 4px; }\n" . "#article { margin-left: 148px; margin-right: 4px; }\n"; } else if ( 3 == $qb ) { # Floating left diff --git a/skins/MonoBook.php b/skins/MonoBook.php index 024c126097..d4c6638519 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -51,7 +51,7 @@ class MonoBookTemplate extends QuickTemplate { wfSuppressWarnings(); ?> - + html('headlinks') ?> @@ -93,7 +93,7 @@ class MonoBookTemplate extends QuickTemplate {
data['sitenotice']) { ?>
html('sitenotice') ?>
-

text('titledir') ?>>data['displaytitle']!=""?$this->text('title'):$this->html('title') ?>

+

data['displaytitle']!=""?$this->text('title'):$this->html('title') ?>

msg('tagline') ?>

html('subtitle') ?>
@@ -124,9 +124,6 @@ class MonoBookTemplate extends QuickTemplate {
msg('personaltools') ?>