discussion with hashar
authorJure Kajzer <freakolowsky@users.mediawiki.org>
Sat, 14 May 2011 16:54:22 +0000 (16:54 +0000)
committerJure Kajzer <freakolowsky@users.mediawiki.org>
Sat, 14 May 2011 16:54:22 +0000 (16:54 +0000)
* 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

includes/Xml.php
includes/installer/WebInstaller.php
skins/common/config.css
skins/common/shared.css

index 01ceff4..72df1da 100644 (file)
@@ -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 {
index a751d03..db6ff60 100644 (file)
@@ -611,23 +611,11 @@ class WebInstaller extends Installer {
         *
         * @return string
         */
-       public function getInfoBox( $text, $icon = 'info-32.png', $class = false ) {
-               $s =
-                       "<div class=\"config-info $class\">\n" .
-                               "<div class=\"config-info-left\">\n" .
-                               Html::element( 'img',
-                                       array(
-                                               'src' => '../skins/common/images/' . $icon,
-                                               'alt' => wfMsg( 'config-information' ),
-                                       )
-                               ) . "\n" .
-                               "</div>\n" .
-                               "<div class=\"config-info-right\">\n" .
-                                       $this->parse( $text, true ) . "\n" .
-                               "</div>\n" .
-                               "<div style=\"clear: left;\"></div>\n" .
-                       "</div>\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 );
        }
 
        /**
index 292d791..a13ba4f 100644 (file)
        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;
 }
 
 #config-live-log {
        width: 70%;
-}
\ No newline at end of file
+}
index 2d4fb66..28e78ac 100644 (file)
@@ -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;