http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100551
Revision: 100551 Author: johnduhart Date: 2011-10-23 16:57:53 +0000 (Sun, 23 Oct 2011) Log Message: ----------- Adding flatlists to HTMLRadioField, sort of like HTMLMultiSelect Modified Paths: -------------- trunk/phase3/includes/HTMLForm.php trunk/phase3/skins/common/shared.css Modified: trunk/phase3/includes/HTMLForm.php =================================================================== --- trunk/phase3/includes/HTMLForm.php 2011-10-23 16:56:31 UTC (rev 100550) +++ trunk/phase3/includes/HTMLForm.php 2011-10-23 16:57:53 UTC (rev 100551) @@ -1768,6 +1768,14 @@ * Radio checkbox fields. */ class HTMLRadioField extends HTMLFormField { + function __construct( $params ) { + parent::__construct( $params ); + if ( isset( $params['flatlist'] ) ) { + $this->mClass .= ' mw-htmlform-radio-flatlist'; + } + } + + function validate( $value, $alldata ) { $p = parent::validate( $value, $alldata ); @@ -1815,16 +1823,16 @@ $html .= $this->formatOptions( $info, $value ); } else { $id = Sanitizer::escapeId( $this->mID . "-$info" ); - $html .= Xml::radio( + $radio = Xml::radio( $this->mName, $info, $info == $value, $attribs + array( 'id' => $id ) ); - $html .= ' ' . + $radio .= ' ' . Html::rawElement( 'label', array( 'for' => $id ), $label ); - $html .= "<br />\n"; + $html .= ' ' . Html::rawElement( 'div', array( 'class' => 'mw-htmlform-radio-item' ), $radio ); } } Modified: trunk/phase3/skins/common/shared.css =================================================================== --- trunk/phase3/skins/common/shared.css 2011-10-23 16:56:31 UTC (rev 100550) +++ trunk/phase3/skins/common/shared.css 2011-10-23 16:57:53 UTC (rev 100551) @@ -259,6 +259,7 @@ .mw-htmlform-invalid-input td.mw-input input { border-color: red; } +.mw-htmlform-radio-flatlist div.mw-htmlform-radio-item, .mw-htmlform-multiselect-flatlist div.mw-htmlform-multiselect-item { display: inline; margin-right: 1em; _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs