diff options
author | Alexandre Emsenhuber <ialex.wiki@gmail.com> | 2012-03-27 12:51:16 +0200 |
---|---|---|
committer | Alexandre Emsenhuber <ialex.wiki@gmail.com> | 2012-03-27 12:51:16 +0200 |
commit | 4540a164b5e7c351e463540d140463f3bc6cd50b (patch) | |
tree | 54e8709b011d5976ebb474d4759d49de9a2d6acf /includes/actions/RevertAction.php | |
parent | bcf1ca69988e2ee2a0a19f886a6eede1edb37af1 (diff) | |
download | mediawikicore-4540a164b5e7c351e463540d140463f3bc6cd50b.tar.gz mediawikicore-4540a164b5e7c351e463540d140463f3bc6cd50b.zip |
Use local context to get messages
Change-Id: I2c6fad30e2c4eaebf1223d94820dae917231e882
Diffstat (limited to 'includes/actions/RevertAction.php')
-rw-r--r-- | includes/actions/RevertAction.php | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/includes/actions/RevertAction.php b/includes/actions/RevertAction.php index f9497f4bc788..774343842ade 100644 --- a/includes/actions/RevertAction.php +++ b/includes/actions/RevertAction.php @@ -75,8 +75,8 @@ class RevertFileAction extends FormAction { } protected function alterForm( HTMLForm $form ) { - $form->setWrapperLegend( wfMsgHtml( 'filerevert-legend' ) ); - $form->setSubmitText( wfMsg( 'filerevert-submit' ) ); + $form->setWrapperLegendMsg( 'filerevert-legend' ); + $form->setSubmitTextMsg( 'filerevert-submit' ); $form->addHiddenField( 'oldimage', $this->getRequest()->getText( 'oldimage' ) ); } @@ -85,22 +85,28 @@ class RevertFileAction extends FormAction { $timestamp = $this->oldFile->getTimestamp(); + $user = $this->getUser(); + $lang = $this->getLanguage(); + $userDate = $lang->userDate( $timestamp, $user ); + $userTime = $lang->userTime( $timestamp, $user ); + $siteDate = $wgContLang->date( $timestamp, false, false ); + $siteTime = $wgContLang->time( $timestamp, false, false ); + return array( 'intro' => array( 'type' => 'info', 'vertical-label' => true, 'raw' => true, - 'default' => wfMsgExt( 'filerevert-intro', 'parse', $this->getTitle()->getText(), - $this->getLanguage()->date( $timestamp, true ), $this->getLanguage()->time( $timestamp, true ), + 'default' => $this->msg( 'filerevert-intro', + $this->getTitle()->getText(), $userDate, $userTime, wfExpandUrl( $this->page->getFile()->getArchiveUrl( $this->getRequest()->getText( 'oldimage' ) ), - PROTO_CURRENT - ) ) + PROTO_CURRENT ) )->parseAsBlock() ), 'comment' => array( 'type' => 'text', 'label-message' => 'filerevert-comment', - 'default' => wfMsgForContent( 'filerevert-defaultcomment', - $wgContLang->date( $timestamp, false, false ), $wgContLang->time( $timestamp, false, false ) ), + 'default' => $this->msg( 'filerevert-defaultcomment', $siteDate, $siteTime + )->inContentLanguage()->text() ) ); } @@ -114,17 +120,21 @@ class RevertFileAction extends FormAction { public function onSuccess() { $timestamp = $this->oldFile->getTimestamp(); - $this->getOutput()->addHTML( wfMsgExt( 'filerevert-success', 'parse', $this->getTitle()->getText(), - $this->getLanguage()->date( $timestamp, true ), - $this->getLanguage()->time( $timestamp, true ), + $user = $this->getUser(); + $lang = $this->getLanguage(); + $userDate = $lang->userDate( $timestamp, $user ); + $userTime = $lang->userTime( $timestamp, $user ); + + $this->getOutput()->addWikiMsg( 'filerevert-success', $this->getTitle()->getText(), + $userDate, $userTime, wfExpandUrl( $this->page->getFile()->getArchiveUrl( $this->getRequest()->getText( 'oldimage' ) ), PROTO_CURRENT - ) ) ); + ) ); $this->getOutput()->returnToMain( false, $this->getTitle() ); } protected function getPageTitle() { - return wfMsg( 'filerevert', $this->getTitle()->getText() ); + return $this->msg( 'filerevert', $this->getTitle()->getText() ); } protected function getDescription() { |