http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88109

Revision: 88109
Author:   freakolowsky
Date:     2011-05-14 16:54:22 +0000 (Sat, 14 May 2011)
Log Message:
-----------
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

Modified Paths:
--------------
    trunk/phase3/includes/Xml.php
    trunk/phase3/includes/installer/WebInstaller.php
    trunk/phase3/skins/common/config.css
    trunk/phase3/skins/common/shared.css

Modified: trunk/phase3/includes/Xml.php
===================================================================
--- trunk/phase3/includes/Xml.php       2011-05-14 16:51:08 UTC (rev 88108)
+++ trunk/phase3/includes/Xml.php       2011-05-14 16:54:22 UTC (rev 88109)
@@ -765,6 +765,47 @@
                $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 {

Modified: trunk/phase3/includes/installer/WebInstaller.php
===================================================================
--- trunk/phase3/includes/installer/WebInstaller.php    2011-05-14 16:51:08 UTC 
(rev 88108)
+++ trunk/phase3/includes/installer/WebInstaller.php    2011-05-14 16:54:22 UTC 
(rev 88109)
@@ -611,23 +611,11 @@
         *
         * @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 );
        }
 
        /**

Modified: trunk/phase3/skins/common/config.css
===================================================================
--- trunk/phase3/skins/common/config.css        2011-05-14 16:51:08 UTC (rev 
88108)
+++ trunk/phase3/skins/common/config.css        2011-05-14 16:54:22 UTC (rev 
88109)
@@ -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
+}

Modified: trunk/phase3/skins/common/shared.css
===================================================================
--- trunk/phase3/skins/common/shared.css        2011-05-14 16:51:08 UTC (rev 
88108)
+++ trunk/phase3/skins/common/shared.css        2011-05-14 16:54:22 UTC (rev 
88109)
@@ -361,6 +361,23 @@
        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;


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to