r24480 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24479‎ | r24480 | r24481 >
Date:09:40, 31 July 2007
Author:raymond
Status:old
Tags:
Comment:
* Adding IDs to submit and reset buttons (this was my initial intent)
* Use proper Xml::functions
* Make the form for RTL wikis a bit nicer
* Whitespaces
Modified paths:
  • /trunk/phase3/includes/SpecialUndelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialUndelete.php
@@ -675,7 +675,7 @@
676676 }
677677
678678 /* private */ function showHistory() {
679 - global $wgLang, $wgUser, $wgOut;
 679+ global $wgLang, $wgContLang, $wgUser, $wgOut;
680680
681681 $sk = $wgUser->getSkin();
682682 if ( $this->mAllowed ) {
@@ -701,10 +701,10 @@
702702 # List all stored revisions
703703 $revisions = $archive->listRevisions();
704704 $files = $archive->listFiles();
705 -
 705+
706706 $haveRevisions = $revisions && $revisions->numRows() > 0;
707707 $haveFiles = $files && $files->numRows() > 0;
708 -
 708+
709709 # Batch existence check on user and talk pages
710710 if( $haveRevisions ) {
711711 $batch = new LinkBatch();
@@ -729,7 +729,7 @@
730730 $titleObj = SpecialPage::getTitleFor( "Undelete" );
731731 $action = $titleObj->getLocalURL( "action=submit" );
732732 # Start the form here
733 - $top = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) );
 733+ $top = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) );
734734 $wgOut->addHtml( $top );
735735 }
736736
@@ -746,21 +746,40 @@
747747 ), LogViewer::NO_ACTION_LINK
748748 );
749749 $logViewer->showList( $wgOut );
750 -
 750+
751751 if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
752752 # Format the user-visible controls (comment field, submission button)
753753 # in a nice little table
754 - $table = '<fieldset><table><tr>';
755 - $table .= '<td colspan="2">' . wfMsgWikiHtml( 'undeleteextrahelp' ) . '</td></tr><tr>';
756 - $table .= '<td align="right"><strong>' . wfMsgHtml( 'undeletecomment' ) . '</strong></td>';
757 - $table .= '<td>' . wfInput( 'wpComment', 50, $this->mComment ) . '</td>';
758 - $table .= '</tr><tr><td>&nbsp;</td><td>';
759 - $table .= wfSubmitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore' ) );
760 - $table .= wfElement( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ) ) );
761 - $table .= '</td></tr></table></fieldset>';
 754+ $align = $wgContLang->isRtl() ? 'left' : 'right';
 755+ $table =
 756+ Xml::openElement( 'fieldset' ) .
 757+ Xml::openElement( 'table' ) .
 758+ "<tr>
 759+ <td colspan='2'>" .
 760+ wfMsgWikiHtml( 'undeleteextrahelp' ) .
 761+ "</td>
 762+ </tr>
 763+ <tr>
 764+ <td align='$align'>" .
 765+ Xml::label( wfMsg( 'undeletecomment' ), 'wpComment' ) .
 766+ "</td>
 767+ <td>" .
 768+ Xml::input( 'wpComment', 50, $this->mComment ) .
 769+ "</td>
 770+ </tr>
 771+ <tr>
 772+ <td>&nbsp;</td>
 773+ <td>" .
 774+ Xml::submitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore', 'id' => 'mw-undelete-submit' ) ) .
 775+ Xml::element( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ), 'id' => 'mw-undelete-reset' ) ) .
 776+ "</td>
 777+ </tr>" .
 778+ Xml::closeElement( 'table' ) .
 779+ Xml::closeElement( 'fieldset' );
 780+
762781 $wgOut->addHtml( $table );
763782 }
764 -
 783+
765784 $wgOut->addHTML( "<h2>" . htmlspecialchars( wfMsg( "history" ) ) . "</h2>\n" );
766785
767786 if( $haveRevisions ) {
@@ -770,7 +789,7 @@
771790 while( $row = $revisions->fetchObject() ) {
772791 $ts = wfTimestamp( TS_MW, $row->ar_timestamp );
773792 if ( $this->mAllowed ) {
774 - $checkBox = wfCheck( "ts$ts" );
 793+ $checkBox = Xml::check( "ts$ts" );
775794 $pageLink = $sk->makeKnownLinkObj( $titleObj,
776795 $wgLang->timeanddate( $ts, true ),
777796 "target=$target&timestamp=$ts" );
@@ -789,7 +808,7 @@
790809 }
791810 $comment = $sk->commentBlock( $row->ar_comment );
792811 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $stxt $comment</li>\n" );
793 -
 812+
794813 }
795814 $revisions->free();
796815 $wgOut->addHTML("</ul>");
@@ -797,14 +816,13 @@
798817 $wgOut->addWikiText( wfMsg( "nohistory" ) );
799818 }
800819
801 -
802820 if( $haveFiles ) {
803821 $wgOut->addHtml( "<h2>" . wfMsgHtml( 'filehist' ) . "</h2>\n" );
804822 $wgOut->addHtml( "<ul>" );
805823 while( $row = $files->fetchObject() ) {
806824 $ts = wfTimestamp( TS_MW, $row->fa_timestamp );
807825 if ( $this->mAllowed && $row->fa_storage_key ) {
808 - $checkBox = wfCheck( "fileid" . $row->fa_id );
 826+ $checkBox = Xml::check( "fileid" . $row->fa_id );
809827 $key = urlencode( $row->fa_storage_key );
810828 $target = urlencode( $this->mTarget );
811829 $pageLink = $sk->makeKnownLinkObj( $titleObj,
@@ -828,12 +846,13 @@
829847 $files->free();
830848 $wgOut->addHTML( "</ul>" );
831849 }
832 -
 850+
833851 if ( $this->mAllowed ) {
834852 # Slip in the hidden controls here
835 - $misc = wfHidden( 'target', $this->mTarget );
836 - $misc .= wfHidden( 'wpEditToken', $wgUser->editToken() );
837 - $wgOut->addHtml( $misc . '</form>' );
 853+ $misc = Xml::hidden( 'target', $this->mTarget );
 854+ $misc .= Xml::hidden( 'wpEditToken', $wgUser->editToken() );
 855+ $misc .= Xml::closeElement( 'form' );
 856+ $wgOut->addHtml( $misc );
838857 }
839858
840859 return true;

Follow-up revisions

RevisionCommit summaryAuthorDate
r24631Merged revisions 24480-24600 via svnmerge from...david18:39, 6 August 2007

Status & tagging log