Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -116,6 +116,10 @@ |
117 | 117 | width: 0 !important; |
118 | 118 | } |
119 | 119 | |
| 120 | +tr.mw-htmlform-vertical-label td.mw-label { |
| 121 | + text-align: left !important; |
| 122 | +} |
| 123 | + |
120 | 124 | input#wpSummary { |
121 | 125 | width: 80%; |
122 | 126 | } |
Index: trunk/phase3/includes/HTMLForm.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | * through HTMLForm::$typeMappings to get the class name. |
25 | 25 | * 'default' -- default value when the form is displayed |
26 | 26 | * 'id' -- HTML id attribute |
27 | | - * 'cssclass' -- CSS class |
| 27 | + * 'cssclass' -- CSS class |
28 | 28 | * 'options' -- varies according to the specific object. |
29 | 29 | * 'label-message' -- message key for a message to use as the label. |
30 | 30 | * can be an array of msg key and then parameters to |
— | — | @@ -812,6 +812,14 @@ |
813 | 813 | global $wgRequest; |
814 | 814 | |
815 | 815 | $errors = $this->validate( $value, $this->mParent->mFieldData ); |
| 816 | + |
| 817 | + $cellAttributes = array(); |
| 818 | + $verticalLabel = false; |
| 819 | + |
| 820 | + if ( !empty($this->mParams['vertical-label']) ) { |
| 821 | + $cellAttributes['colspan'] = 2; |
| 822 | + $verticalLabel = true; |
| 823 | + } |
816 | 824 | |
817 | 825 | if ( $errors === true || !$wgRequest->wasPosted() ) { |
818 | 826 | $errors = ''; |
— | — | @@ -819,18 +827,30 @@ |
820 | 828 | $errors = Html::rawElement( 'span', array( 'class' => 'error' ), $errors ); |
821 | 829 | } |
822 | 830 | |
823 | | - $html = $this->getLabelHtml(); |
824 | | - $html .= Html::rawElement( |
| 831 | + $label = $this->getLabelHtml( $cellAttributes ); |
| 832 | + $field = Html::rawElement( |
825 | 833 | 'td', |
826 | | - array( 'class' => 'mw-input' ), |
| 834 | + array( 'class' => 'mw-input' ) + $cellAttributes, |
827 | 835 | $this->getInputHTML( $value ) . "\n$errors" |
828 | 836 | ); |
829 | | - |
| 837 | + |
830 | 838 | $fieldType = get_class( $this ); |
| 839 | + |
| 840 | + if ($verticalLabel) { |
| 841 | + $html = Html::rawElement( 'tr', |
| 842 | + array( 'class' => 'mw-htmlform-vertical-label' ), $label ); |
| 843 | + $html .= Html::rawElement( 'tr', |
| 844 | + array( 'class' => "mw-htmlform-field-$fieldType {$this->mClass}" ), |
| 845 | + $field ); |
| 846 | + } else { |
| 847 | + $html = Html::rawElement( 'tr', |
| 848 | + array( 'class' => "mw-htmlform-field-$fieldType {$this->mClass}" ), |
| 849 | + $label . $field ); |
| 850 | + } |
831 | 851 | |
832 | 852 | $html = Html::rawElement( |
833 | 853 | 'tr', |
834 | | - array( 'class' => "mw-htmlform-field-$fieldType {$this->mClass}" ), |
| 854 | + array( ), |
835 | 855 | $html |
836 | 856 | ) . "\n"; |
837 | 857 | |
— | — | @@ -860,7 +880,7 @@ |
861 | 881 | function getLabel() { |
862 | 882 | return $this->mLabel; |
863 | 883 | } |
864 | | - function getLabelHtml() { |
| 884 | + function getLabelHtml( $cellAttributes = array() ) { |
865 | 885 | # Don't output a for= attribute for labels with no associated input. |
866 | 886 | # Kind of hacky here, possibly we don't want these to be <label>s at all. |
867 | 887 | $for = array(); |
— | — | @@ -869,7 +889,7 @@ |
870 | 890 | $for['for'] = $this->mID; |
871 | 891 | } |
872 | 892 | |
873 | | - return Html::rawElement( 'td', array( 'class' => 'mw-label' ), |
| 893 | + return Html::rawElement( 'td', array( 'class' => 'mw-label' ) + $cellAttributes, |
874 | 894 | Html::rawElement( 'label', $for, $this->getLabel() ) |
875 | 895 | ); |
876 | 896 | } |