$wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' );
return;
} elseif( !$wgUser->isAllowed( 'delete' ) ) {
- $wgOut->permissionError( 'delete' );
+ $wgOut->permissionRequired( 'delete' );
return;
} elseif( $wgUser->isBlocked() ) {
$wgOut->blockedPage();
// Perform the deletion if appropriate
if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->oldimage ) ) {
- $comment = $wgRequest->getText( 'wpComment' );
+ $comment = $wgRequest->getText( 'wpReason' );
if( $this->oldimage ) {
$status = $this->file->deleteOld( $this->oldimage, $comment );
if( $status->ok ) {
// Need to do a log item
$log = new LogPage( 'delete' );
- $log->addEntry( 'delete', $this->title, wfMsg( 'deletedrevision' , $this->oldimage ) );
+ $logComment = wfMsg( 'deletedrevision', $this->oldimage );
+ if( trim( $comment ) != '' )
+ $logComment .= ": {$comment}";
+ $log->addEntry( 'delete', $this->title, $logComment );
}
} else {
$status = $this->file->delete( $comment );
if( !$status->isGood() )
$wgOut->addWikiText( $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) );
if( $status->ok ) {
+ $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
$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
return;
}
- // Show the form
- $this->showForm();
+ $this->showForm();
+ $this->showLogEntries();
}
-
+
/**
* Show the confirmation form
*/
private function showForm() {
- global $wgOut, $wgUser;
-
+ global $wgOut, $wgUser, $wgRequest;
+
$form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction() ) );
$form .= Xml::hidden( 'wpEditToken', $wgUser->editToken( $this->oldimage ) );
$form .= '<fieldset><legend>' . wfMsgHtml( 'filedelete-legend' ) . '</legend>';
$form .= $this->prepareMessage( 'filedelete-intro' );
-
- $form .= '<p>' . Xml::inputLabel( wfMsg( 'filedelete-comment' ), 'wpComment', 'wpComment', 60 ) . '</p>';
- $form .= '<p>' . Xml::submitButton( wfMsg( 'filedelete-submit' ) ) . '</p>';
+
+ $form .= '<p>' . Xml::inputLabel( wfMsg( 'filedelete-comment' ), 'wpReason', 'wpReason',
+ 60, $wgRequest->getText( 'wpReason' ) ) . '</p>';
+ $form .= '<p>' . Xml::submitButton( wfMsg( 'filedelete-submit' ), array( 'name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit' ) ) . '</p>';
$form .= '</fieldset>';
$form .= '</form>';
-
+
$wgOut->addHtml( $form );
}
+
+ /**
+ * Show deletion log fragments pertaining to the current file
+ */
+ private function showLogEntries() {
+ global $wgOut;
+ $wgOut->addHtml( '<h2>' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
+ $reader = new LogViewer(
+ new LogReader(
+ new FauxRequest(
+ array(
+ 'type' => 'delete',
+ 'page' => $this->title->getPrefixedText(),
+ )
+ )
+ )
+ );
+ $reader->showList( $wgOut );
+ }
/**
* Prepare a message referring to the file being deleted,