From 6605abf00becef8150cfd5a61321c9dece16c493 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 31 Jul 2007 09:40:50 +0000 Subject: [PATCH] * 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 --- includes/SpecialUndelete.php | 63 +++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 630d9208ac..fca464c6e7 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -675,7 +675,7 @@ class UndeleteForm { } /* private */ function showHistory() { - global $wgLang, $wgUser, $wgOut; + global $wgLang, $wgContLang, $wgUser, $wgOut; $sk = $wgUser->getSkin(); if ( $this->mAllowed ) { @@ -701,10 +701,10 @@ class UndeleteForm { # List all stored revisions $revisions = $archive->listRevisions(); $files = $archive->listFiles(); - + $haveRevisions = $revisions && $revisions->numRows() > 0; $haveFiles = $files && $files->numRows() > 0; - + # Batch existence check on user and talk pages if( $haveRevisions ) { $batch = new LinkBatch(); @@ -729,7 +729,7 @@ class UndeleteForm { $titleObj = SpecialPage::getTitleFor( "Undelete" ); $action = $titleObj->getLocalURL( "action=submit" ); # Start the form here - $top = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) ); + $top = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) ); $wgOut->addHtml( $top ); } @@ -746,21 +746,40 @@ class UndeleteForm { ), LogViewer::NO_ACTION_LINK ); $logViewer->showList( $wgOut ); - + if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) { # Format the user-visible controls (comment field, submission button) # in a nice little table - $table = '
'; - $table .= ''; - $table .= ''; - $table .= ''; - $table .= '
' . wfMsgWikiHtml( 'undeleteextrahelp' ) . '
' . wfMsgHtml( 'undeletecomment' ) . '' . wfInput( 'wpComment', 50, $this->mComment ) . '
 '; - $table .= wfSubmitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore' ) ); - $table .= wfElement( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ) ) ); - $table .= '
'; + $align = $wgContLang->isRtl() ? 'left' : 'right'; + $table = + Xml::openElement( 'fieldset' ) . + Xml::openElement( 'table' ) . + " + " . + wfMsgWikiHtml( 'undeleteextrahelp' ) . + " + + + " . + Xml::label( wfMsg( 'undeletecomment' ), 'wpComment' ) . + " + " . + Xml::input( 'wpComment', 50, $this->mComment ) . + " + + +   + " . + Xml::submitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore', 'id' => 'mw-undelete-submit' ) ) . + Xml::element( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ), 'id' => 'mw-undelete-reset' ) ) . + " + " . + Xml::closeElement( 'table' ) . + Xml::closeElement( 'fieldset' ); + $wgOut->addHtml( $table ); } - + $wgOut->addHTML( "

" . htmlspecialchars( wfMsg( "history" ) ) . "

\n" ); if( $haveRevisions ) { @@ -770,7 +789,7 @@ class UndeleteForm { while( $row = $revisions->fetchObject() ) { $ts = wfTimestamp( TS_MW, $row->ar_timestamp ); if ( $this->mAllowed ) { - $checkBox = wfCheck( "ts$ts" ); + $checkBox = Xml::check( "ts$ts" ); $pageLink = $sk->makeKnownLinkObj( $titleObj, $wgLang->timeanddate( $ts, true ), "target=$target×tamp=$ts" ); @@ -789,7 +808,7 @@ class UndeleteForm { } $comment = $sk->commentBlock( $row->ar_comment ); $wgOut->addHTML( "
  • $checkBox $pageLink . . $userLink $stxt $comment
  • \n" ); - + } $revisions->free(); $wgOut->addHTML(""); @@ -797,14 +816,13 @@ class UndeleteForm { $wgOut->addWikiText( wfMsg( "nohistory" ) ); } - if( $haveFiles ) { $wgOut->addHtml( "

    " . wfMsgHtml( 'filehist' ) . "

    \n" ); $wgOut->addHtml( "" ); } - + if ( $this->mAllowed ) { # Slip in the hidden controls here - $misc = wfHidden( 'target', $this->mTarget ); - $misc .= wfHidden( 'wpEditToken', $wgUser->editToken() ); - $wgOut->addHtml( $misc . '' ); + $misc = Xml::hidden( 'target', $this->mTarget ); + $misc .= Xml::hidden( 'wpEditToken', $wgUser->editToken() ); + $misc .= Xml::closeElement( 'form' ); + $wgOut->addHtml( $misc ); } return true; -- 2.20.1