r68915 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68914‎ | r68915 | r68916 >
Date:21:41, 2 July 2010
Author:werdna
Status:deferred (Comments)
Tags:
Comment:
Merge r68909, r68914
Modified paths:
  • /branches/wmf/1.16wmf4/includes/HTMLForm.php (modified) (history)
  • /branches/wmf/1.16wmf4/skins/common/shared.css (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/skins/common/shared.css
@@ -109,6 +109,10 @@
110110
111111 table.mw-htmlform-nolabel td.mw-label { width: 0 !important; }
112112
 113+tr.mw-htmlform-vertical-label td.mw-label {
 114+ text-align: left !important;
 115+}
 116+
113117 input#wpSummary {
114118 width: 80%;
115119 }
Property changes on: branches/wmf/1.16wmf4/skins/common/shared.css
___________________________________________________________________
Added: svn:mergeinfo
116120 Merged /trunk/phase3/skins/common/shared.css:r63545-63546,63549,63643,63764,63897-63901,65015,65387,65391,65555,65590,65774,67836,68909
117121 Merged /branches/wmf-deployment/skins/common/shared.css:r60970
Index: branches/wmf/1.16wmf4/includes/HTMLForm.php
@@ -769,21 +769,42 @@
770770 global $wgRequest;
771771
772772 $errors = $this->validate( $value, $this->mParent->mFieldData );
 773+
 774+ $cellAttributes = array();
 775+ $verticalLabel = false;
 776+
 777+ if ( !empty($this->mParams['vertical-label']) ) {
 778+ $cellAttributes['colspan'] = 2;
 779+ $verticalLabel = true;
 780+ }
 781+
773782 if ( $errors === true || !$wgRequest->wasPosted() ) {
774783 $errors = '';
775784 } else {
776785 $errors = Html::rawElement( 'span', array( 'class' => 'error' ), $errors );
777786 }
778 -
779 - $html = $this->getLabelHtml();
780 - $html .= Html::rawElement( 'td', array( 'class' => 'mw-input' ),
781 - $this->getInputHTML( $value ) ."\n$errors" );
782 -
 787+
 788+ $label = $this->getLabelHtml( $cellAttributes );
 789+ $field = Html::rawElement(
 790+ 'td',
 791+ array( 'class' => 'mw-input' ) + $cellAttributes,
 792+ $this->getInputHTML( $value ) . "\n$errors"
 793+ );
 794+
783795 $fieldType = get_class( $this );
 796+
 797+ if ($verticalLabel) {
 798+ $html = Html::rawElement( 'tr',
 799+ array( 'class' => 'mw-htmlform-vertical-label' ), $label );
 800+ $html .= Html::rawElement( 'tr',
 801+ array( 'class' => "mw-htmlform-field-$fieldType {$this->mClass}" ),
 802+ $field );
 803+ } else {
 804+ $html = Html::rawElement( 'tr',
 805+ array( 'class' => "mw-htmlform-field-$fieldType {$this->mClass}" ),
 806+ $label . $field );
 807+ }
784808
785 - $html = Html::rawElement( 'tr', array( 'class' => "mw-htmlform-field-$fieldType" ),
786 - $html ) . "\n";
787 -
788809 $helptext = null;
789810 if ( isset( $this->mParams['help-message'] ) ) {
790811 $msg = $this->mParams['help-message'];
@@ -809,14 +830,14 @@
810831 function getLabel() {
811832 return $this->mLabel;
812833 }
813 - function getLabelHtml() {
 834+ function getLabelHtml( $cellAttributes = array() ) {
814835 # Don't output a for= attribute for labels with no associated input.
815836 # Kind of hacky here, possibly we don't want these to be <label>s at all.
816837 $for = array();
817838 if ( $this->needsLabel() ) {
818839 $for['for'] = $this->mID;
819840 }
820 - return Html::rawElement( 'td', array( 'class' => 'mw-label' ),
 841+ return Html::rawElement( 'td', array( 'class' => 'mw-label' ) + $cellAttributes,
821842 Html::rawElement( 'label', $for, $this->getLabel() )
822843 );
823844 }
Property changes on: branches/wmf/1.16wmf4/includes/HTMLForm.php
___________________________________________________________________
Added: svn:mergeinfo
824845 Merged /branches/wmf-deployment/includes/HTMLForm.php:r53381,60970
825846 Merged /branches/REL1_15/phase3/includes/HTMLForm.php:r51646
826847 Merged /branches/wmf/1.16wmf4/includes/HTMLForm.php:r68909
827848 Merged /branches/sqlite/includes/HTMLForm.php:r58211-58321
828849 Merged /trunk/phase3/includes/HTMLForm.php:r63549,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,68909

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68909Add vertical-label option to HTMLForm, for CommunityHiringwerdna21:20, 2 July 2010
r68914Remove double-wrapping in trswerdna21:40, 2 July 2010

Comments

#Comment by Tim Starling (talk | contribs)   06:31, 25 August 2010
PHP Strict Standards:  Declaration of UploadSourceField::getLabelHtml() should be compatible with that of HTMLFormField::getLabelHtml() in /home/tstarling/src/mediawiki/branches/wmf/1.16wmf4/includes/specials/SpecialUpload.php on line 1025
PHP Notice:  Undefined property: UploadSourceField::$mClass in /home/tstarling/src/mediawiki/branches/wmf/1.16wmf4/includes/HTMLForm.php on line 804
PHP Notice:  Undefined property: HTMLInfoField::$mClass in /home/tstarling/src/mediawiki/branches/wmf/1.16wmf4/includes/HTMLForm.php on line 804
PHP Notice:  Undefined property: HTMLTextField::$mClass in /home/tstarling/src/mediawiki/branches/wmf/1.16wmf4/includes/HTMLForm.php on line 804
PHP Notice:  Undefined property: HTMLTextAreaField::$mClass in /home/tstarling/src/mediawiki/branches/wmf/1.16wmf4/includes/HTMLForm.php on line 804
PHP Notice:  Undefined property: Licenses::$mClass in /home/tstarling/src/mediawiki/branches/wmf/1.16wmf4/includes/HTMLForm.php on line 804
PHP Notice:  Undefined property: HTMLCheckField::$mClass in /home/tstarling/src/mediawiki/branches/wmf/1.16wmf4/includes/HTMLForm.php on line 804
PHP Notice:  Undefined property: HTMLCheckField::$mClass in /home/tstarling/src/mediawiki/branches/wmf/1.16wmf4/includes/HTMLForm.php on line 804
#Comment by Bryan (talk | contribs)   13:23, 30 October 2010

Note that the trunk revision which fix this are r68944 for the Strict Standards and r64866 for the notice. r64866 in particular looks too much trouble to merge in. Is this still fixme?

#Comment by Tim Starling (talk | contribs)   04:29, 3 November 2010

Yes it's still fixme. It's not necessary to merge r64866, it's just necessary to fix this revision so that it doesn't access non-existent member variables.

#Comment by Werdna (talk | contribs)   18:40, 18 January 2011

A fix was merged in later on.

#Comment by Bryan (talk | contribs)   12:08, 26 March 2011

Marking deferred, all fixes should be in 1.17wmf1.

Status & tagging log