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 getLanguageCode() {
84 if( !is_object( $wgLang ) )
87 return $wgLang->getCode();
90 function getHeadAttribs() {
92 'dir' => $this->getDir(),
93 'lang' => $this->getLanguageCode(),
97 function headerDone() {
98 return $this->headerDone
;
101 function outputHeader() {
102 $this->headerDone
= true;
103 $dbTypes = $this->parent
->getDBTypes();
105 $this->parent
->request
->response()->header("Content-Type: text/html; charset=utf-8");
106 if ( $this->redirectTarget
) {
107 $this->parent
->request
->response()->header( 'Location: '.$this->redirectTarget
);
111 if ( $this->useShortHeader
) {
112 $this->outputShortHeader();
117 <?php
echo Html
::htmlHeader( $this->getHeadAttribs() ); ?
>
119 <meta name
="robots" content
="noindex, nofollow" />
120 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
121 <title
><?php
$this->outputTitle(); ?
></title
>
122 <?php
echo Html
::linkedStyle( '../skins/common/shared.css' ) . "\n"; ?
>
123 <?php
echo Html
::linkedStyle( '../skins/monobook/main.css' ) . "\n"; ?
>
124 <?php
echo Html
::linkedStyle( '../skins/common/config.css' ) . "\n"; ?
>
125 <?php
echo Html
::inlineScript( "var dbTypes = " . Xml
::encodeJsVar( $dbTypes ) ) . "\n"; ?
>
126 <?php
$this->outputJQuery() . "\n"; ?
>
127 <?php
echo Html
::linkedScript( '../skins/common/config.js' ) . "\n"; ?
>
130 <?php
echo Html
::openElement( 'body', array( 'class' => $this->getDir() ) ) . "\n"; ?
>
132 <style type
="text/css">
133 .config
-help
-message
{ display
: block
; }
134 .config
-show
-help
{ display
: none
; }
137 <div id
="globalWrapper">
138 <div id
="column-content">
140 <div id
="bodyContent">
142 <h1
><?php
$this->outputTitle(); ?
></h1
>
146 function outputFooter() {
147 $this->outputWarnings();
149 if ( $this->useShortHeader
) {
160 <div id
="column-one">
161 <div
class="portlet" id
="p-logo">
162 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
163 href
="http://www.mediawiki.org/"
164 title
="Main Page"></a
>
166 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
167 <div
class='portlet'><div
class='pBody'>
169 echo $this->parent
->parse( wfMsgNoTrans( 'config-sidebar' ), true );
181 function outputShortHeader() {
183 <?php
echo Html
::htmlHeader( $this->getHeadAttribs() ); ?
>
185 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
186 <meta name
="robots" content
="noindex, nofollow" />
187 <title
><?php
$this->outputTitle(); ?
></title
>
188 <?php
echo Html
::linkedStyle( '../skins/monobook/main.css' ) . "\n"; ?
>
189 <?php
echo Html
::linkedStyle( '../skins/common/config.css' ) . "\n"; ?
>
190 <?php
$this->outputJQuery(); ?
>
191 <?php
echo Html
::linkedScript( '../skins/common/config.js' ); ?
>
194 <body style
="background-image: none">
198 function outputTitle() {
200 echo htmlspecialchars( wfMsg( 'config-title', $wgVersion ) );
203 function outputJQuery() {
204 global $wgJQueryVersion;
205 echo Html
::linkedScript( "../skins/common/jquery-$wgJQueryVersion.min.js" );
208 function outputWarnings() {
209 $this->addHTML( $this->warnings
);
210 $this->warnings
= '';