* @return string Raw HTML
*/
public static function rawElement( $element, $attribs = array(), $contents = '' ) {
+ global $wgWellFormedXml;
+ $start = self::openElement( $element, $attribs );
+ if ( in_array( $element, self::$voidElements ) ) {
+ if ( $wgWellFormedXml ) {
+ # Silly XML.
+ return substr( $start, 0, -1 ) . ' />';
+ }
+ return $start;
+ } else {
+ return "$start$contents</$element>";
+ }
+ }
+
+ /**
+ * Identical to rawElement(), but HTML-escapes $contents (like
+ * Xml::element()).
+ */
+ public static function element( $element, $attribs = array(), $contents = '' ) {
+ return self::rawElement( $element, $attribs, strtr( $contents, array(
+ # There's no point in escaping quotes, >, etc. in the contents of
+ # elements.
+ '&' => '&',
+ '<' => '<'
+ ) ) );
+ }
+
+ /**
+ * Identical to rawElement(), but has no third parameter and omits the end
+ * tag (and the self-closing / in XML mode for empty elements).
+ */
+ public static function openElement( $element, $attribs = array() ) {
global $wgHtml5, $wgWellFormedXml;
$attribs = (array)$attribs;
# This is not required in HTML5, but let's do it anyway, for
}
}
- $start = "<$element" . self::expandAttributes(
- self::dropDefaults( $element, $attribs ) );
- if ( in_array( $element, self::$voidElements ) ) {
- if ( $wgWellFormedXml ) {
- return "$start />";
- }
- return "$start>";
- } else {
- return "$start>$contents</$element>";
- }
- }
-
- /**
- * Identical to rawElement(), but HTML-escapes $contents (like
- * Xml::element()).
- */
- public static function element( $element, $attribs = array(), $contents = '' ) {
- return self::rawElement( $element, $attribs, strtr( $contents, array(
- # There's no point in escaping quotes, >, etc. in the contents of
- # elements.
- '&' => '&',
- '<' => '<'
- ) ) );
+ return "<$element" . self::expandAttributes(
+ self::dropDefaults( $element, $attribs ) ) . '>';
}
/**
global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5, $wgWellFormedXml;
+ global $wgUser, $wgRequest, $wgLang;
$this->addMeta( "http:Content-Type", "$wgMimeType; charset={$wgOutputEncoding}" );
if ( $sk->commonPrintStylesheet() ) {
$ret .= $this->getTitle()->trackbackRDF();
$ret .= "</head>\n";
+
+ $bodyAttrs = array();
+
+ # Crazy edit-on-double-click stuff
+ $action = $wgRequest->getVal( 'action', 'view' );
+
+ if ( $this->mTitle->getNamespace() != NS_SPECIAL
+ && !in_array( $action, array( 'edit', 'submit' ) )
+ && $wgUser->getOption( 'editondblclick' ) ) {
+ $bodyAttrs['ondblclick'] = "document.location = '" . Xml::escapeJsString( $this->mTitle->getEditURL() ) . "'";
+ }
+
+ # Class bloat
+ $bodyAttrs['class'] = "mediawiki $dir";
+
+ if ( $wgLang->capitalizeAllNouns() ) {
+ # A <body> class is probably not the best way to do this . . .
+ $bodyAttrs['class'] .= ' capitalize-all-nouns';
+ }
+ $bodyAttrs['class'] .= ' ns-' . $this->mTitle->getNamespace();
+ if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
+ $bodyAttrs['class'] .= ' ns-special';
+ } elseif ( $this->mTitle->isTalkPage() ) {
+ $bodyAttrs['class'] .= ' ns-talk';
+ } else {
+ $bodyAttrs['class'] .= ' ns-subject';
+ }
+ $bodyAttrs['class'] .= ' ' . Sanitizer::escapeClass( 'page-' . $this->mTitle->getPrefixedText() );
+ $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass( $wgUser->getSkin()->getSkinName() );
+
+ $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
+
return $ret;
}
$out->out( $out->headElement( $this ) );
- $out->out( "\n<body" );
- $ops = $this->getBodyOptions();
- foreach ( $ops as $name => $val ) {
- $out->out( " $name='$val'" );
- }
- $out->out( ">\n" );
if ( $wgDebugComments ) {
$out->out( "<!-- Wiki debugging output:\n" .
$out->mDebugtext . "-->\n" );
$out->addStyle( 'common/common_rtl.css', '', '', 'rtl' );
}
- function getBodyOptions() {
- global $wgUser, $wgOut, $wgRequest, $wgContLang;
-
- extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
-
- if ( 0 != $this->mTitle->getNamespace() ) {
- $a = array( 'bgcolor' => '#ffffec' );
- }
- else $a = array( 'bgcolor' => '#FFFFFF' );
- if( $wgOut->isArticle() && $wgUser->getOption( 'editondblclick' ) &&
- $this->mTitle->quickUserCan( 'edit' ) ) {
- $s = $this->mTitle->getFullURL( $this->editUrlOptions() );
- $s = 'document.location = "' .Xml::escapeJsString( $s ) .'";';
- $a += array( 'ondblclick' => $s );
- }
- $a['class'] =
- 'mediawiki' .
- ' '.( $wgContLang->getDir() ).
- ' '.$this->getPageClasses( $this->mTitle ) .
- ' skin-'. Sanitizer::escapeClass( $this->getSkinName() );
- return $a;
- }
-
function getPageClasses( $title ) {
$numeric = 'ns-'.$title->getNamespace();
if( $title->getNamespace() == NS_SPECIAL ) {
$content_actions = $this->buildContentActionUrls();
$tpl->setRef( 'content_actions', $content_actions );
- // XXX: attach this from javascript, same with section editing
- if( $this->iseditable && $wgUser->getOption( 'editondblclick' ) ){
- $encEditUrl = Xml::escapeJsString( $this->mTitle->getLocalUrl( $this->editUrlOptions() ) );
- $tpl->set( 'body_ondblclick', 'document.location = "' . $encEditUrl . '";' );
- } else {
- $tpl->set( 'body_ondblclick', false );
- }
$tpl->set( 'sidebar', $this->buildSidebar() );
$tpl->set( 'nav_urls', $this->buildNavUrls() );
wfSuppressWarnings();
$this->html( 'headelement' );
-?><body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
- class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
+?>
<!-- heading -->
<div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
wfSuppressWarnings();
$this->html( 'headelement' );
-?><body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
- class="mediawiki <?php $this->text('dir'); $this->text('capitalizeallnouns') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
- <div id="globalWrapper">
+?> <div id="globalWrapper">
<div id="column-content">
<div id="content" <?php $this->html("specialpageattributes") ?>>
<a id="top"></a>
return $s;
}
- /**
- *
- */
- function getBodyOptions() {
- $a = parent::getBodyOptions();
-
- if ( 3 == $this->qbSetting() ) { # Floating left
- $qb = "setup(\"quickbar\")";
- if( $a['onload'] ) {
- $a['onload'] .= ";$qb";
- } else {
- $a['onload'] = $qb;
- }
- }
- return $a;
- }
-
function doAfterContent() {
global $wgContLang, $wgLang;
wfProfileIn( __METHOD__ );
// Output HTML Page
$this->html( 'headelement' );
?>
- <body<?php if ( $this->data['body_ondblclick'] ): ?> ondblclick="<?php $this->text( 'body_ondblclick' ) ?>"<?php endif; ?> class="mediawiki <?php $this->text( 'dir' ) ?> <?php $this->text( 'pageclass' ) ?> <?php $this->text( 'skinnameclass' ) ?>" dir="<?php $this->text( 'dir' ) ?>">
<div id="page-base" class="noprint"></div>
<div id="head-base" class="noprint"></div>
<!-- content -->
form#specialpages {
display: inline;
}
+
+body {
+ background-color: #ffffec;
+}
+body.ns-0 {
+ background-color: white;
+}
//mySticky.css.visibility="visible";
}
+hookEvent( 'load', function() { setup( 'quickbar' ); } );
+
// -------------------------
// emulate css 'position: fixed' in IE5+ Win