From: Brion Vibber Date: Sun, 10 Aug 2008 20:10:37 +0000 (+0000) Subject: More style cleanup -- encapsulate the page name class along with the naemspace classes. X-Git-Tag: 1.31.0-rc.0~45963 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=28fa2922fcfbb92dc5131fe4952a39eeda4c3e85;p=lhc%2Fweb%2Fwiklou.git More style cleanup -- encapsulate the page name class along with the naemspace classes. * Reduce code duplication * Fix Modern class since my last commit * Update offline skin for DumpHTML --- diff --git a/includes/Skin.php b/includes/Skin.php index abf2bb7e1a..68b179878e 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -589,14 +589,13 @@ END; $a['onload'] = $wgOut->getOnloadHandler(); $a['class'] = 'mediawiki' . - ' '.$this->getNamespaceClasses( $wgTitle ) . ' '.( $wgContLang->isRTL() ? "rtl" : "ltr" ). - ' '.Sanitizer::escapeClass( 'page-'.$wgTitle->getPrefixedText() ). + ' '.$this->getPageClasses( $wgTitle ) . ' skin-'. Sanitizer::escapeClass( $this->getSkinName( ) ); return $a; } - function getNamespaceClasses( $title ) { + function getPageClasses( $title ) { $numeric = 'ns-'.$title->getNamespace(); if( $title->getNamespace() == NS_SPECIAL ) { $type = "ns-special"; @@ -605,7 +604,8 @@ END; } else { $type = "ns-subject"; } - return "$numeric $type"; + $name = Sanitizer::escapeClass( 'page-'.$title->getPrefixedText() ); + return "$numeric $type $name"; } /** diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index c1b7cf9b3f..53f99a4847 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -191,7 +191,7 @@ class SkinTemplate extends Skin { $tpl->set( 'title', $wgOut->getPageTitle() ); $tpl->set( 'pagetitle', $wgOut->getHTMLTitle() ); $tpl->set( 'displaytitle', $wgOut->mPageLinkTitle ); - $tpl->set( 'pageclass', Sanitizer::escapeClass( 'page-'.$this->mTitle->getPrefixedText() ) ); + $tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) ); $tpl->set( 'skinnameclass', ( "skin-" . Sanitizer::escapeClass( $this->getSkinName ( ) ) ) ); $nsname = isset( $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] ) ? @@ -254,7 +254,6 @@ class SkinTemplate extends Skin { $tpl->set( 'handheld', $wgRequest->getBool( 'handheld' ) ); $tpl->set( 'csslinks', $this->buildCssLinks() ); $tpl->setRef( 'loggedin', $this->loggedin ); - $tpl->set( 'nsclass', $this->getNamespaceClasses( $this->mTitle ) ); $tpl->set('notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL); /* XXX currently unused, might get useful later $tpl->set( "editable", ($this->mTitle->getNamespace() != NS_SPECIAL ) ); diff --git a/skins/Modern.php b/skins/Modern.php index 381de4e77b..d37086cc0e 100644 --- a/skins/Modern.php +++ b/skins/Modern.php @@ -95,7 +95,7 @@ class ModernTemplate extends QuickTemplate { data['body_ondblclick']) { ?> ondblclick="text('body_ondblclick') ?>" data['body_onload' ]) { ?> onload="text('body_onload') ?>" - class="mediawiki text('nsclass') ?> text('dir') ?> text('pageclass') ?> text('talkclass') ?> text('skinnameclass') ?>"> + class="mediawiki text('dir') ?> text('pageclass') ?> text('skinnameclass') ?>">

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

diff --git a/skins/MonoBook.php b/skins/MonoBook.php index 00399b16ab..2c02d684a0 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -104,7 +104,7 @@ class MonoBookTemplate extends QuickTemplate { data['body_ondblclick']) { ?> ondblclick="text('body_ondblclick') ?>" data['body_onload']) { ?> onload="text('body_onload') ?>" - class="mediawiki text('nsclass') ?> text('dir') ?> text('pageclass') ?> text('skinnameclass') ?>"> + class="mediawiki text('dir') ?> text('pageclass') ?> text('skinnameclass') ?>">