From b9b85843572bf283f48285001e276ba7e61b63f6 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 22 Feb 2009 13:37:51 +0100 Subject: updated to MediaWiki 1.14.0 --- includes/FileDeleteForm.php | 66 ++++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 22 deletions(-) (limited to 'includes/FileDeleteForm.php') diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index bc80c2b2..66086b0f 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -55,7 +55,7 @@ class FileDeleteForm { $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage ); if( !self::haveDeletableFile($this->file, $this->oldfile, $this->oldimage) ) { - $wgOut->addHtml( $this->prepareMessage( 'filedelete-nofile' ) ); + $wgOut->addHTML( $this->prepareMessage( 'filedelete-nofile' ) ); $wgOut->addReturnTo( $this->title ); return; } @@ -78,7 +78,7 @@ class FileDeleteForm { $wgOut->addWikiText( $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) ); if( $status->ok ) { $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); - $wgOut->addHtml( $this->prepareMessage( 'filedelete-success' ) ); + $wgOut->addHTML( $this->prepareMessage( 'filedelete-success' ) ); // Return to the main page if we just deleted all versions of the // file, otherwise go back to the description page $wgOut->addReturnTo( $this->oldimage ? $this->title : Title::newMainPage() ); @@ -105,16 +105,24 @@ class FileDeleteForm { } else { $status = $file->delete( $reason, $suppress ); if( $status->ok ) { + $id = $title->getArticleID( GAID_FOR_UPDATE ); // Need to delete the associated article $article = new Article( $title ); if( wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason)) ) { - if( $article->doDeleteArticle( $reason, $suppress ) ) - wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason)); + if( $article->doDeleteArticle( $reason, $suppress, $id ) ) { + global $wgRequest; + if( $wgRequest->getCheck( 'wpWatch' ) ) { + $article->doWatch(); + } elseif( $title->userIsWatching() ) { + $article->doUnwatch(); + } + wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason, $id)); + } } } } - if( $status->isGood() ) wfRunHooks('FileDeleteComplete', array( - &$file, &$oldimage, &$article, &$wgUser, &$reason)); + if( $status->isGood() ) + wfRunHooks('FileDeleteComplete', array( &$file, &$oldimage, &$article, &$wgUser, &$reason)); return $status; } @@ -123,46 +131,60 @@ class FileDeleteForm { * Show the confirmation form */ private function showForm() { - global $wgOut, $wgUser, $wgRequest, $wgContLang; - $align = $wgContLang->isRtl() ? 'left' : 'right'; + global $wgOut, $wgUser, $wgRequest; if( $wgUser->isAllowed( 'suppressrevision' ) ) { - $suppress = ""; - $suppress .= Xml::checkLabel( wfMsg( 'revdelete-suppress' ), 'wpSuppress', 'wpSuppress', false, array( 'tabindex' => '2' ) ); - $suppress .= ""; + $suppress = " + + " . + Xml::checkLabel( wfMsg( 'revdelete-suppress' ), + 'wpSuppress', 'wpSuppress', false, array( 'tabindex' => '3' ) ) . + " + "; } else { $suppress = ''; } - $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction() ) ) . + $checkWatch = $wgUser->getBoolOption( 'watchdeletion' ) || $this->title->userIsWatching(); + $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction(), + 'id' => 'mw-img-deleteconfirm' ) ) . Xml::openElement( 'fieldset' ) . Xml::element( 'legend', null, wfMsg( 'filedelete-legend' ) ) . Xml::hidden( 'wpEditToken', $wgUser->editToken( $this->oldimage ) ) . $this->prepareMessage( 'filedelete-intro' ) . - Xml::openElement( 'table' ) . + Xml::openElement( 'table', array( 'id' => 'mw-img-deleteconfirm-table' ) ) . " - " . + " . Xml::label( wfMsg( 'filedelete-comment' ), 'wpDeleteReasonList' ) . " - " . + " . Xml::listDropDown( 'wpDeleteReasonList', wfMsgForContent( 'filedelete-reason-dropdown' ), wfMsgForContent( 'filedelete-reason-otherlist' ), '', 'wpReasonDropDown', 1 ) . " - " . + " . Xml::label( wfMsg( 'filedelete-otherreason' ), 'wpReason' ) . " - " . - Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ), array( 'type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason' ) ) . + " . + Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ), + array( 'type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason' ) ) . " {$suppress} - " . - Xml::submitButton( wfMsg( 'filedelete-submit' ), array( 'name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit', 'tabindex' => '3' ) ) . + " . + Xml::checkLabel( wfMsg( 'watchthis' ), + 'wpWatch', 'wpWatch', $checkWatch, array( 'tabindex' => '3' ) ) . + " + + + + " . + Xml::submitButton( wfMsg( 'filedelete-submit' ), + array( 'name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit', 'tabindex' => '4' ) ) . " " . Xml::closeElement( 'table' ) . @@ -175,7 +197,7 @@ class FileDeleteForm { $form .= '

' . $link . '

'; } - $wgOut->addHtml( $form ); + $wgOut->addHTML( $form ); } /** @@ -183,7 +205,7 @@ class FileDeleteForm { */ private function showLogEntries() { global $wgOut; - $wgOut->addHtml( '

' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

\n" ); + $wgOut->addHTML( '

' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

\n" ); LogEventsList::showLogExtract( $wgOut, 'delete', $this->title->getPrefixedText() ); } -- cgit v1.2.3-54-g00ecf