summaryrefslogtreecommitdiff
path: root/includes/FileDeleteForm.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/FileDeleteForm.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/FileDeleteForm.php')
-rw-r--r--includes/FileDeleteForm.php66
1 files changed, 44 insertions, 22 deletions
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 = "<tr id=\"wpDeleteSuppressRow\" name=\"wpDeleteSuppressRow\"><td></td><td>";
- $suppress .= Xml::checkLabel( wfMsg( 'revdelete-suppress' ), 'wpSuppress', 'wpSuppress', false, array( 'tabindex' => '2' ) );
- $suppress .= "</td></tr>";
+ $suppress = "<tr id=\"wpDeleteSuppressRow\">
+ <td></td>
+ <td class='mw-input'>" .
+ Xml::checkLabel( wfMsg( 'revdelete-suppress' ),
+ 'wpSuppress', 'wpSuppress', false, array( 'tabindex' => '3' ) ) .
+ "</td>
+ </tr>";
} 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' ) ) .
"<tr>
- <td align='$align'>" .
+ <td class='mw-label'>" .
Xml::label( wfMsg( 'filedelete-comment' ), 'wpDeleteReasonList' ) .
"</td>
- <td>" .
+ <td class='mw-input'>" .
Xml::listDropDown( 'wpDeleteReasonList',
wfMsgForContent( 'filedelete-reason-dropdown' ),
wfMsgForContent( 'filedelete-reason-otherlist' ), '', 'wpReasonDropDown', 1 ) .
"</td>
</tr>
<tr>
- <td align='$align'>" .
+ <td class='mw-label'>" .
Xml::label( wfMsg( 'filedelete-otherreason' ), 'wpReason' ) .
"</td>
- <td>" .
- Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ), array( 'type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason' ) ) .
+ <td class='mw-input'>" .
+ Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ),
+ array( 'type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason' ) ) .
"</td>
</tr>
{$suppress}
<tr>
<td></td>
- <td>" .
- Xml::submitButton( wfMsg( 'filedelete-submit' ), array( 'name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit', 'tabindex' => '3' ) ) .
+ <td class='mw-input'>" .
+ Xml::checkLabel( wfMsg( 'watchthis' ),
+ 'wpWatch', 'wpWatch', $checkWatch, array( 'tabindex' => '3' ) ) .
+ "</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class='mw-submit'>" .
+ Xml::submitButton( wfMsg( 'filedelete-submit' ),
+ array( 'name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit', 'tabindex' => '4' ) ) .
"</td>
</tr>" .
Xml::closeElement( 'table' ) .
@@ -175,7 +197,7 @@ class FileDeleteForm {
$form .= '<p class="mw-filedelete-editreasons">' . $link . '</p>';
}
- $wgOut->addHtml( $form );
+ $wgOut->addHTML( $form );
}
/**
@@ -183,7 +205,7 @@ class FileDeleteForm {
*/
private function showLogEntries() {
global $wgOut;
- $wgOut->addHtml( '<h2>' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
+ $wgOut->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
LogEventsList::showLogExtract( $wgOut, 'delete', $this->title->getPrefixedText() );
}