From 62a12d2454a3827eba94a6540b23a36a8ce19fea Mon Sep 17 00:00:00 2001 From: Jure Kajzer Date: Wed, 1 Jun 2011 13:57:50 +0000 Subject: [PATCH] * moved infobox to Html (r88109#c16937) --- includes/Html.php | 43 +++++++++++++++++++++++++++++ includes/Xml.php | 42 ---------------------------- includes/installer/WebInstaller.php | 2 +- 3 files changed, 44 insertions(+), 43 deletions(-) diff --git a/includes/Html.php b/includes/Html.php index ce90a44fd7..aca539268e 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -653,4 +653,47 @@ class Html { return false; } } + + /** + * 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 + * @param $useStylePath + * + * @return string + */ + static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) { + global $wgStylePath; + + if ( $useStylePath ) { + $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; + } + } diff --git a/includes/Xml.php b/includes/Xml.php index f9655164fb..e25d436f81 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -804,48 +804,6 @@ 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 - * @param $useStylePath - * - * @return string - */ - static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) { - global $wgStylePath; - - if ( $useStylePath ) { - $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 ebea68be58..d79e33857d 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -615,7 +615,7 @@ class WebInstaller extends Installer { $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 ); + return Html::infoBox( $text, $icon, $alt, $class, false ); } /** -- 2.20.1