r109215 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109214‎ | r109215 | r109216 >
Date:21:21, 17 January 2012
Author:hashar
Status:ok
Tags:
Comment:
Fix HTML tables for Sen./H.R.

OpenElement / CloseElement were mixed up.
Chain them instead using:

Html::element( 'tr', $attribs,
Html::element( 'td', ... )
);
Modified paths:
  • /trunk/extensions/CongressLookup/SpecialCongressLookup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php
@@ -168,56 +168,67 @@
169169 $congressTable .= Html::element( 'h4', array(), 'Your Representatives:' );
170170
171171 if ( $myRepresentative ) {
172 - $congressTable .= Html::openElement( 'table', array (
 172+
 173+ $congressTable .= "\n" . Html::openElement( 'table', array (
173174 'class' => 'person', 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0
174175 ) );
175 - $congressTable .= Html::openElement( 'tr' );
176 - $congressTable .= Html::element( 'td', array ( 'class' => 'name' ), $myRepresentative[0]['name'] );
177 - $congressTable .= Html::openElement( 'tr' );
178 - $congressTable .= Html::closeElement( 'tr' );
179 - $congressTable .= Html::element( 'td', array(), wfMsg( 'congresslookup-phone', $myRepresentative[0]['phone'] ) );
180 - $congressTable .= Html::openElement( 'tr' );
181 - $congressTable .= Html::closeElement( 'tr' );
182 - $congressTable .= Html::element( 'td', array(), wfMsg( 'congresslookup-fax', $myRepresentative[0]['fax'] ) );
183 - $congressTable .= Html::openElement( 'tr' );
184 - $congressTable .= Html::closeElement( 'tr' );
185 - $congressTable .= Html::openElement( 'td' );
186 - $congressTable .= Html::element( 'a', array (
187 - 'href' => $myRepresentative[0]['contactform'],
188 - 'target' => '_blank',
189 - ),
190 - wfMsg( 'congresslookup-contact-form' )
 176+
 177+ $congressTable .= "\n" . Html::rawElement( 'tr', array(),
 178+ Html::element( 'td', array ( 'class' => 'name' ), $myRepresentative[0]['name'] )
 179+ );
 180+
 181+ $congressTable .= "\n" . Html::rawElement( 'tr', array(),
 182+ Html::element( 'td', array(), wfMsg( 'congresslookup-phone', $myRepresentative[0]['phone'] ) )
 183+ );
 184+
 185+ $congressTable .= "\n" . Html::rawElement( 'tr', array(),
 186+ Html::element( 'td', array(), wfMsg( 'congresslookup-fax', $myRepresentative[0]['fax'] ) )
191187 );
192 - $congressTable .= Html::closeElement( 'td' );
193 - $congressTable .= Html::closeElement( 'tr' );
194 - $congressTable .= Html::closeElement( 'table' );
 188+
 189+ $congressTable .= "\n" . Html::rawElement( 'tr', array(),
 190+ Html::rawElement( 'td', array(),
 191+ Html::element( 'a', array (
 192+ 'href' => $myRepresentative[0]['contactform'],
 193+ 'target' => '_blank',
 194+ ),
 195+ wfMsg( 'congresslookup-contact-form' )
 196+ )
 197+ )
 198+ );
 199+
 200+ $congressTable .= "\n" . Html::closeElement( 'table' );
195201 } else {
196202 $congressTable .= Html::element( 'p', array(), wfMsg( 'congresslookup-no-house-rep' ) );
197203 }
198204 foreach ( $mySenators as $senator ) {
199 - $congressTable .= Html::openElement( 'table', array (
 205+ $congressTable .= "\n" . Html::openElement( 'table', array (
200206 'class' => 'person', 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0
201207 ) );
202 - $congressTable .= Html::openElement( 'tr' );
203 - $congressTable .= Html::element( 'td', array ( 'class' => 'name' ), $senator['name'] );
204 - $congressTable .= Html::openElement( 'tr' );
205 - $congressTable .= Html::closeElement( 'tr' );
206 - $congressTable .= Html::element( 'td', array(), wfMsg( 'congresslookup-phone', $senator['phone'] ) );
207 - $congressTable .= Html::openElement( 'tr' );
208 - $congressTable .= Html::closeElement( 'tr' );
209 - $congressTable .= Html::element( 'td', array(), wfMsg( 'congresslookup-fax', $senator['fax'] ) );
210 - $congressTable .= Html::openElement( 'tr' );
211 - $congressTable .= Html::closeElement( 'tr' );
212 - $congressTable .= Html::openElement( 'td' );
213 - $congressTable .= Html::element( 'a', array (
214 - 'href' => $senator['contactform'],
215 - 'target' => '_blank',
216 - ),
217 - wfMsg( 'congresslookup-contact-form' )
 208+
 209+ $congressTable .= "\n" . Html::rawElement( 'tr', array(),
 210+ Html::element( 'td', array ( 'class' => 'name' ), $senator['name'] )
218211 );
219 - $congressTable .= Html::closeElement( 'td' );
220 - $congressTable .= Html::closeElement( 'tr' );
221 - $congressTable .= Html::closeElement( 'table' );
 212+
 213+ $congressTable .= "\n" . Html::rawElement( 'tr', array(),
 214+ Html::element( 'td', array(), wfMsg( 'congresslookup-phone', $senator['phone'] ) )
 215+ );
 216+
 217+ $congressTable .= "\n" . Html::rawElement( 'tr', array(),
 218+ Html::element( 'td', array(), wfMsg( 'congresslookup-fax', $senator['fax'] ) )
 219+ );
 220+
 221+ $congressTable .= "\n" . Html::rawElement( 'tr', array(),
 222+ Html::rawElement( 'td', array(),
 223+ Html::element( 'a', array (
 224+ 'href' => $senator['contactform'],
 225+ 'target' => '_blank',
 226+ ),
 227+ wfMsg( 'congresslookup-contact-form' )
 228+ )
 229+ )
 230+ );
 231+
 232+ $congressTable .= "\n" . Html::closeElement( 'table' );
222233 }
223234 if ( count( $mySenators ) == 0 ) {
224235 $congressTable .= Html::element( 'p', array(), wfMsg( 'congresslookup-no-senators' ) );

Status & tagging log