From: Jure Kajzer Date: Sat, 14 May 2011 16:54:22 +0000 (+0000) Subject: discussion with hashar X-Git-Tag: 1.31.0-rc.0~30190 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=a069d8bde08c996836333107426c411366cfeb7e;p=lhc%2Fweb%2Fwiklou.git discussion with hashar * moved getInfoBox into Xml.php as infoBox static method * moved config-infobox* css classes from config to mw-infobox* in shared * left getInfoBox as a wrapper in the installer --- diff --git a/includes/Xml.php b/includes/Xml.php index 01ceff470a..72df1daa00 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -765,6 +765,47 @@ class Xml { $s .= Xml::closeElement( 'tr' ); return $s; } + + /** + * Get HTML for an info box with an icon. + * + * @param $text String: wikitext, get this with wfMsgNoTrans() + * @param $icon String: icon name, file in skins/common/images + * @param $alt String: alternate text for the icon + * @param $class String: additional class name to add to the wrapper div + * + * @return string + */ + static function infoBox( $text, $icon, $alt, $class = false, $useStypePath = true ) { + global $wgStylePath; + + if ( $useStypePath ) { + $icon = $wgStylePath.'/common/images/'.$icon; + } + + + $s = Xml::openElement( 'div', array( 'class' => "mw-infobox $class") ); + + $s .= Xml::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ). + Html::element( 'img', + array( + 'src' => $icon, + 'alt' => $alt, + ) + ). + Xml::closeElement( 'div' ); + + $s .= Xml::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ). + $text. + Xml::closeElement( 'div' ); + $s .= Xml::element( 'div', array( 'style' => 'clear: left;' ), ' ' ); + + $s .= Xml::closeElement( 'div' ); + + $s .= Xml::element( 'div', array( 'style' => 'clear: left;' ), ' ' ); + + return $s; + } } class XmlSelect { diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index a751d03d99..db6ff60cd4 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -611,23 +611,11 @@ class WebInstaller extends Installer { * * @return string */ - public function getInfoBox( $text, $icon = 'info-32.png', $class = false ) { - $s = - "
\n" . - "
\n" . - Html::element( 'img', - array( - 'src' => '../skins/common/images/' . $icon, - 'alt' => wfMsg( 'config-information' ), - ) - ) . "\n" . - "
\n" . - "
\n" . - $this->parse( $text, true ) . "\n" . - "
\n" . - "
\n" . - "
\n"; - return $s; + public function getInfoBox( $text, $icon = false, $class = false ) { + $text = $this->parse( $text, true ); + $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/'.$icon; + $alt = wfMsg( 'config-information' ); + return Xml::infoBox( $text, $icon, $alt, $class, false ); } /** diff --git a/skins/common/config.css b/skins/common/config.css index 292d791865..a13ba4f890 100644 --- a/skins/common/config.css +++ b/skins/common/config.css @@ -72,22 +72,6 @@ clear: left; } -.config-warning-box { - border: 2px solid #ff7f00; - margin: 0.4em; - clear: left; -} - -.config-info-left { - margin: 7px; - float: left; - width: 35px; -} - -.config-info-right { - margin: 0.5em 0.5em 0.5em 49px; -} - .config-page-current { font-weight: bold; } @@ -161,4 +145,4 @@ #config-live-log { width: 70%; -} \ No newline at end of file +} diff --git a/skins/common/shared.css b/skins/common/shared.css index 2d4fb66473..28e78acc28 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -361,6 +361,23 @@ table.collapsed tr.collapsable { border: none; } +/* general info/warning box for SP */ +.mw-infobox { + border: 2px solid #ff7f00; + margin: 0.4em; + clear: left; +} + +.mw-infobox-left { + margin: 7px; + float: left; + width: 35px; +} + +.mw-infobox-right { + margin: 0.5em 0.5em 0.5em 49px; +} + /* Note on preview page */ .previewnote { color: #c00;