4 * Output class modelled on OutputPage.
6 * I've opted to use a distinct class rather than derive from OutputPage here in
7 * the interests of separation of concerns: if we used a subclass, there would be
8 * quite a lot of things you could do in OutputPage that would break the installer,
9 * that wouldn't be immediately obvious.
11 class WebInstallerOutput
{
15 var $headerDone = false;
18 var $useShortHeader = false;
20 function __construct( $parent ) {
21 $this->parent
= $parent;
24 function addHTML( $html ) {
25 $this->contents
.= $html;
29 function addWikiText( $text ) {
30 $this->addHTML( $this->parent
->parse( $text ) );
33 function addHTMLNoFlush( $html ) {
34 $this->contents
.= $html;
37 function addWarning( $msg ) {
38 $this->warnings
.= "<p>$msg</p>\n";
41 function addWarningMsg( $msg /*, ... */ ) {
42 $params = func_get_args();
43 array_shift( $params );
44 $this->addWarning( wfMsg( $msg, $params ) );
47 function redirect( $url ) {
48 if ( $this->headerDone
) {
49 throw new MWException( __METHOD__
. ' called after sending headers' );
51 $this->redirectTarget
= $url;
56 $this->outputFooter();
59 function useShortHeader( $use = true ) {
60 $this->useShortHeader
= $use;
64 if ( !$this->headerDone
) {
65 $this->outputHeader();
67 if ( !$this->redirectTarget
&& strlen( $this->contents
) ) {
76 if( !is_object( $wgLang ) ||
!$wgLang->isRtl() )
82 function headerDone() {
83 return $this->headerDone
;
86 function outputHeader() {
87 $this->headerDone
= true;
88 $dbTypes = $this->parent
->getDBTypes();
90 $this->parent
->request
->response()->header("Content-Type: text/html; charset=utf-8");
91 if ( $this->redirectTarget
) {
92 $this->parent
->request
->response()->header( 'Location: '.$this->redirectTarget
);
96 if ( $this->useShortHeader
) {
97 $this->outputShortHeader();
102 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
103 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en" lang
="en" dir
="ltr">
105 <meta name
="robots" content
="noindex, nofollow" />
106 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
107 <title
><?php
$this->outputTitle(); ?
></title
>
108 <link rel
="stylesheet" type
="text/css" href
="../skins/common/shared.css"/>
109 <link rel
="stylesheet" type
="text/css" href
="../skins/monobook/main.css"/>
110 <link rel
="stylesheet" type
="text/css" href
="../skins/common/config.css"/>
111 <script type
="text/javascript"><!--
112 <?php
echo "var dbTypes = " . Xml
::encodeJsVar( $dbTypes ) . ";\n"; ?
>
115 <?php
$this->outputJQuery(); ?
>
116 <script type
="text/javascript" src
="../skins/common/config.js"></script
>
119 <body
class="<?php print $this->getDir(); ?>">
121 <style type
="text/css">
122 .config
-help
-message
{ display
: block
; }
123 .config
-show
-help
{ display
: none
; }
126 <div id
="globalWrapper">
127 <div id
="column-content">
129 <div id
="bodyContent">
131 <h1
><?php
$this->outputTitle(); ?
></h1
>
135 function outputFooter() {
136 $this->outputWarnings();
138 if ( $this->useShortHeader
) {
149 <div id
="column-one">
150 <div
class="portlet" id
="p-logo">
151 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
152 href
="http://www.mediawiki.org/"
153 title
="Main Page"></a
>
155 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
156 <div
class='portlet'><div
class='pBody'>
158 echo $this->parent
->parse( wfMsgNoTrans( 'config-sidebar' ), true );
170 function outputShortHeader() {
173 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
174 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en" lang
="en" dir
="ltr">
176 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
177 <meta name
="robots" content
="noindex, nofollow" />
178 <title
><?php
$this->outputTitle(); ?
></title
>
179 <link rel
="stylesheet" type
="text/css" href
="../skins/monobook/main.css"/>
180 <link rel
="stylesheet" type
="text/css" href
="../skins/common/config.css"/>
181 <?php
$this->outputJQuery(); ?
>
182 <script type
="text/javascript" src
="../skins/common/config.js"></script
>
185 <body style
="background-image: none">
189 function outputTitle() {
191 echo htmlspecialchars( wfMsg( 'config-title', $wgVersion ) );
194 function outputJQuery() {
195 global $wgJQueryVersion;
196 echo '<script type="text/javascript" src="../skins/common/jquery-' .
197 $wgJQueryVersion . '.min.js"></script>';
200 function outputWarnings() {
201 $this->addHTML( $this->warnings
);
202 $this->warnings
= '';