r32155 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32154‎ | r32155 | r32156 >
Date:08:14, 19 March 2008
Author:raymond
Status:old
Tags:
Comment:
* Add some CSS ids to forms and tables
* Use proper XML functions
* Fix double escaping
* Fix indention
Modified paths:
  • /trunk/phase3/includes/SpecialUserrights.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialUserrights.php
@@ -279,14 +279,16 @@
280280 */
281281 function switchForm() {
282282 global $wgOut, $wgScript;
283 - $form = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'name' => 'uluser' ) );
284 - $form .= Xml::hidden( 'title', 'Special:Userrights' );
285 - $form .= '<fieldset><legend>' . wfMsgHtml( 'userrights-lookup-user' ) . '</legend>';
286 - $form .= '<p>' . Xml::inputLabel( wfMsg( 'userrights-user-editname' ), 'user', 'username', 30, $this->mTarget ) . '</p>';
287 - $form .= '<p>' . Xml::submitButton( wfMsg( 'editusergroup' ) ) . '</p>';
288 - $form .= '</fieldset>';
289 - $form .= '</form>';
290 - $wgOut->addHTML( $form );
 283+ $wgOut->addHTML(
 284+ Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1' ) ) .
 285+ Xml::hidden( 'title', 'Special:Userrights' ) .
 286+ Xml::openElement( 'fieldset' ) .
 287+ Xml::element( 'legend', array(), wfMsg( 'userrights-lookup-user' ) ) .
 288+ Xml::inputLabel( wfMsg( 'userrights-user-editname' ), 'user', 'username', 30, $this->mTarget ) . ' ' .
 289+ Xml::submitButton( wfMsg( 'editusergroup' ) ) .
 290+ Xml::closeElement( 'fieldset' ) .
 291+ Xml::closeElement( 'form' ) . "\n"
 292+ );
291293 }
292294
293295 /**
@@ -314,7 +316,6 @@
315317 /**
316318 * Show the form to edit group memberships.
317319 *
318 - * @todo make all CSS-y and semantic
319320 * @param $user User or UserRightsProxy you're editing
320321 * @param $groups Array: Array of groups the user is in
321322 */
@@ -332,51 +333,54 @@
333334 $grouplist = '<p>' . wfMsgHtml( 'userrights-groupsmember' ) . ' ' . implode( ', ', $list ) . '</p>';
334335 }
335336 $wgOut->addHTML(
336 - Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->escapeLocalURL(), 'name' => 'editGroup' ) ) .
 337+ Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL(), 'name' => 'editGroup', 'id' => 'mw-userrights-form2' ) ) .
337338 Xml::hidden( 'user', $this->mTarget ) .
338339 Xml::hidden( 'wpEditToken', $wgUser->editToken( $this->mTarget ) ) .
339340 Xml::openElement( 'fieldset' ) .
340341 Xml::element( 'legend', array(), wfMsg( 'userrights-editusergroup' ) ) .
341 - wfMsgExt( 'editinguser', array( 'parse' ),
342 - wfEscapeWikiText( $user->getName() ) ) .
 342+ wfMsgExt( 'editinguser', array( 'parse' ), wfEscapeWikiText( $user->getName() ) ) .
343343 $grouplist .
344344 $this->explainRights() .
345 - "<table border='0'>
346 - <tr>
347 - <td></td>
348 - <td>
349 - <table width='400'>
350 - <tr>
351 - <td width='50%'>" . $this->removeSelect( $removable ) . "</td>
352 - <td width='50%'>" . $this->addSelect( $addable ) . "</td>
353 - </tr>
354 - </table>
355 - </tr>
356 - <tr>
357 - <td colspan='2'>" .
358 - $wgOut->parse( wfMsg('userrights-groupshelp') ) .
359 - "</td>
360 - </tr>
361 - <tr>
362 - <td>" .
363 - Xml::label( wfMsg( 'userrights-reason' ), 'wpReason' ) .
364 - "</td>
365 - <td>" .
366 - Xml::input( 'user-reason', 60, false, array( 'id' => 'wpReason', 'maxlength' => 255 ) ) .
367 - "</td>
368 - </tr>
369 - <tr>
370 - <td></td>
371 - <td>" .
372 - Xml::submitButton( wfMsg( 'saveusergroups' ), array( 'name' => 'saveusergroups' ) ) .
373 - "</td>
374 - </tr>
375 - </table>\n" .
 345+ Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-userrights-table-outer' ) ) .
 346+ "<tr>
 347+ <td></td>
 348+ <td>" .
 349+ Xml::openElement( 'table', array( 'style' => 'width:400px;', 'id' => 'mw-userrights-table-inner' ) ) .
 350+ "<tr>
 351+ <td style='width:50%;'>" .
 352+ $this->removeSelect( $removable ) .
 353+ "</td>
 354+ <td style='width:50%;'>" .
 355+ $this->addSelect( $addable ) .
 356+ "</td>
 357+ </tr>" .
 358+ Xml::closeElement( 'table' ) .
 359+ "</tr>
 360+ <tr>
 361+ <td colspan='2'>" .
 362+ $wgOut->parse( wfMsg( 'userrights-groupshelp' ) ) .
 363+ "</td>
 364+ </tr>
 365+ <tr>
 366+ <td>" .
 367+ Xml::label( wfMsg( 'userrights-reason' ), 'wpReason' ) .
 368+ "</td>
 369+ <td>" .
 370+ Xml::input( 'user-reason', 60, false, array( 'id' => 'wpReason', 'maxlength' => 255 ) ) .
 371+ "</td>
 372+ </tr>
 373+ <tr>
 374+ <td></td>
 375+ <td>" .
 376+ Xml::submitButton( wfMsg( 'saveusergroups' ), array( 'name' => 'saveusergroups' ) ) .
 377+ "</td>
 378+ </tr>" .
 379+ Xml::closeElement( 'table' ) . "\n" .
376380 Xml::closeElement( 'fieldset' ) .
377381 Xml::closeElement( 'form' ) . "\n"
378382 );
379383 }
380 -
 384+
381385 /**
382386 * Format a link to a group description page
383387 *
@@ -568,8 +572,7 @@
569573 )
570574 )
571575 );
572 - $output->addHtml( "<h2>" . htmlspecialchars( LogPage::logName( 'rights' ) ) . "</h2>\n" );
 576+ $output->addHtml( Xml::element( 'h2', null, LogPage::logName( 'rights' ) . "\n" ) );
573577 $viewer->showList( $output );
574578 }
575 -
576579 }

Status & tagging log