r89260 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89259‎ | r89260 | r89261 >
Date:13:57, 1 June 2011
Author:freakolowsky
Status:ok (Comments)
Tags:
Comment:
* moved infobox to Html (r88109#c16937)
Modified paths:
  • /trunk/phase3/includes/Html.php (modified) (history)
  • /trunk/phase3/includes/Xml.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Xml.php
@@ -804,48 +804,6 @@
805805 $s .= Xml::closeElement( 'tr' );
806806 return $s;
807807 }
808 -
809 - /**
810 - * Get HTML for an info box with an icon.
811 - *
812 - * @param $text String: wikitext, get this with wfMsgNoTrans()
813 - * @param $icon String: icon name, file in skins/common/images
814 - * @param $alt String: alternate text for the icon
815 - * @param $class String: additional class name to add to the wrapper div
816 - * @param $useStylePath
817 - *
818 - * @return string
819 - */
820 - static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) {
821 - global $wgStylePath;
822 -
823 - if ( $useStylePath ) {
824 - $icon = $wgStylePath.'/common/images/'.$icon;
825 - }
826 -
827 -
828 - $s = Xml::openElement( 'div', array( 'class' => "mw-infobox $class") );
829 -
830 - $s .= Xml::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ).
831 - Html::element( 'img',
832 - array(
833 - 'src' => $icon,
834 - 'alt' => $alt,
835 - )
836 - ).
837 - Xml::closeElement( 'div' );
838 -
839 - $s .= Xml::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ).
840 - $text.
841 - Xml::closeElement( 'div' );
842 - $s .= Xml::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
843 -
844 - $s .= Xml::closeElement( 'div' );
845 -
846 - $s .= Xml::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
847 -
848 - return $s;
849 - }
850808 }
851809
852810 class XmlSelect {
Index: trunk/phase3/includes/Html.php
@@ -653,4 +653,47 @@
654654 return false;
655655 }
656656 }
 657+
 658+ /**
 659+ * Get HTML for an info box with an icon.
 660+ *
 661+ * @param $text String: wikitext, get this with wfMsgNoTrans()
 662+ * @param $icon String: icon name, file in skins/common/images
 663+ * @param $alt String: alternate text for the icon
 664+ * @param $class String: additional class name to add to the wrapper div
 665+ * @param $useStylePath
 666+ *
 667+ * @return string
 668+ */
 669+ static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) {
 670+ global $wgStylePath;
 671+
 672+ if ( $useStylePath ) {
 673+ $icon = $wgStylePath.'/common/images/'.$icon;
 674+ }
 675+
 676+
 677+ $s = Xml::openElement( 'div', array( 'class' => "mw-infobox $class") );
 678+
 679+ $s .= Xml::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ).
 680+ Html::element( 'img',
 681+ array(
 682+ 'src' => $icon,
 683+ 'alt' => $alt,
 684+ )
 685+ ).
 686+ Xml::closeElement( 'div' );
 687+
 688+ $s .= Xml::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ).
 689+ $text.
 690+ Xml::closeElement( 'div' );
 691+ $s .= Xml::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
 692+
 693+ $s .= Xml::closeElement( 'div' );
 694+
 695+ $s .= Xml::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
 696+
 697+ return $s;
 698+ }
 699+
657700 }
Index: trunk/phase3/includes/installer/WebInstaller.php
@@ -615,7 +615,7 @@
616616 $text = $this->parse( $text, true );
617617 $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/'.$icon;
618618 $alt = wfMsg( 'config-information' );
619 - return Xml::infoBox( $text, $icon, $alt, $class, false );
 619+ return Html::infoBox( $text, $icon, $alt, $class, false );
620620 }
621621
622622 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r89262* used Html static functions instead og Xml. (r89260#c17418)freakolowsky14:18, 1 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88109discussion with hashar...freakolowsky16:54, 14 May 2011

Comments

#Comment by Siebrand (talk | contribs)   14:09, 1 June 2011

While you're at it: you should probably use the Html class instead of the Xml class for openElement(), closeElement() and element().

#Comment by Freakolowsky (talk | contribs)   14:18, 1 June 2011

done

Status & tagging log