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
) ) {
77 if( !is_object( $wgLang ) ||
!$wgLang->isRtl() )
83 function getLanguageCode() {
85 if( !is_object( $wgLang ) )
88 return $wgLang->getCode();
91 function getHeadAttribs() {
93 'dir' => $this->getDir(),
94 'lang' => $this->getLanguageCode(),
98 function headerDone() {
99 return $this->headerDone
;
102 function outputHeader() {
103 $this->headerDone
= true;
104 $dbTypes = $this->parent
->getDBTypes();
106 $this->parent
->request
->response()->header("Content-Type: text/html; charset=utf-8");
107 if ( $this->redirectTarget
) {
108 $this->parent
->request
->response()->header( 'Location: '.$this->redirectTarget
);
112 if ( $this->useShortHeader
) {
113 $this->outputShortHeader();
118 <?php
echo Html
::htmlHeader( $this->getHeadAttribs() ); ?
>
120 <meta name
="robots" content
="noindex, nofollow" />
121 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
122 <title
><?php
$this->outputTitle(); ?
></title
>
123 <?php
echo Html
::linkedStyle( '../skins/common/shared.css' ) . "\n"; ?
>
124 <?php
echo Html
::linkedStyle( '../skins/monobook/main.css' ) . "\n"; ?
>
125 <?php
echo Html
::linkedStyle( '../skins/common/config.css' ) . "\n"; ?
>
126 <?php
echo Html
::inlineScript( "var dbTypes = " . Xml
::encodeJsVar( $dbTypes ) ) . "\n"; ?
>
127 <?php
$this->outputJQuery() . "\n"; ?
>
128 <?php
echo Html
::linkedScript( '../skins/common/config.js' ) . "\n"; ?
>
131 <?php
echo Html
::openElement( 'body', array( 'class' => $this->getDir() ) ) . "\n"; ?
>
133 <style type
="text/css">
134 .config
-help
-message
{ display
: block
; }
135 .config
-show
-help
{ display
: none
; }
138 <div id
="globalWrapper">
139 <div id
="column-content">
141 <div id
="bodyContent">
143 <h1
><?php
$this->outputTitle(); ?
></h1
>
147 function outputFooter() {
148 $this->outputWarnings();
150 if ( $this->useShortHeader
) {
161 <div id
="column-one">
162 <div
class="portlet" id
="p-logo">
163 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
164 href
="http://www.mediawiki.org/"
165 title
="Main Page"></a
>
167 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
168 <div
class='portlet'><div
class='pBody'>
170 echo $this->parent
->parse( wfMsgNoTrans( 'config-sidebar' ), true );
182 function outputShortHeader() {
184 <?php
echo Html
::htmlHeader( $this->getHeadAttribs() ); ?
>
186 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
187 <meta name
="robots" content
="noindex, nofollow" />
188 <title
><?php
$this->outputTitle(); ?
></title
>
189 <?php
echo Html
::linkedStyle( '../skins/monobook/main.css' ) . "\n"; ?
>
190 <?php
echo Html
::linkedStyle( '../skins/common/config.css' ) . "\n"; ?
>
191 <?php
$this->outputJQuery(); ?
>
192 <?php
echo Html
::linkedScript( '../skins/common/config.js' ); ?
>
195 <body style
="background-image: none">
199 function outputTitle() {
201 echo htmlspecialchars( wfMsg( 'config-title', $wgVersion ) );
204 function outputJQuery() {
205 global $wgJQueryVersion;
206 echo Html
::linkedScript( "../skins/common/jquery-$wgJQueryVersion.min.js" );
209 function outputWarnings() {
210 $this->addHTML( $this->warnings
);
211 $this->warnings
= '';