var $mMetaData = '';
var $isConflict = false;
var $isCssJsSubpage = false;
+ var $isCssSubpage = false;
+ var $isJsSubpage = false;
var $deletedSinceEdit = false;
var $formtype;
var $firsttime;
$this->editFormTextBeforeContent =
$this->editFormTextAfterWarn =
$this->editFormTextAfterTools =
- $this->editFormTextBottom = "";
+ $this->editFormTextBottom =
+ $this->mPreloadText = "";
}
function getArticle() {
return $this->mArticle;
}
+
/**
* Fetch initial editing page content.
* @private
wfProfileOut( __METHOD__ );
return $text;
}
+
+ /** Use this method before edit() to preload some text into the edit box */
+ public function setPreloadedText( $text ) {
+ $this->mPreloadText = $text;
+ }
/**
* Get the contents of a page from its title and remove includeonly tags
* @return string The contents of the page.
*/
protected function getPreloadedText( $preload ) {
- if ( $preload === '' ) {
+ if ( !empty($this->mPreloadText) ) {
+ return $this->mPreloadText;
+ } elseif ( $preload === '' ) {
return '';
} else {
$preloadTitle = Title::newFromText( $preload );
protected function wasDeletedSinceLastEdit() {
if ( $this->deletedSinceEdit )
return true;
- if ( $this->mTitle->isDeleted() ) {
+ if ( $this->mTitle->isDeletedQuick() ) {
$this->lastDelete = $this->getLastDelete();
if ( $this->lastDelete ) {
$deleteTime = wfTimestamp( TS_MW, $this->lastDelete->log_timestamp );
* the newly-edited page.
*/
function edit() {
- global $wgOut, $wgUser, $wgRequest;
+ global $wgOut, $wgRequest, $wgEnableJS2system;
// Allow extensions to modify/prevent this form or submission
- if ( !wfRunHooks( 'AlternateEdit', array( &$this ) ) ) {
+ if ( !wfRunHooks( 'AlternateEdit', array( $this ) ) ) {
return;
}
}
$wgOut->addScriptFile( 'edit.js' );
+
+ if($wgEnableJS2system)
+ $wgOut->addScriptClass( 'editPage' );
+
$permErrors = $this->getEditPermissionErrors();
if ( $permErrors ) {
wfDebug( __METHOD__.": User can't edit\n" );
}
}
}
+
+ // If they used redlink=1 and the page exists, redirect to the main article
+ if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) {
+ $wgOut->redirect( $this->mTitle->getFullURL() );
+ }
wfProfileIn( __METHOD__."-business-end" );
$this->isConflict = false;
// css / js subpages of user pages get a special treatment
$this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
+ $this->isCssSubpage = $this->mTitle->isCssSubpage();
+ $this->isJsSubpage = $this->mTitle->isJsSubpage();
$this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
# Show applicable editing introductions
# Optional notices on a per-namespace and per-page basis
$editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace();
- $editnotice_page = $editnotice_ns.'-'.$this->mTitle->getDBkey();
if ( !wfEmptyMsg( $editnotice_ns, wfMsgForContent( $editnotice_ns ) ) ) {
$wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) );
}
$wgOut->addWikiText( wfMsgForContent( $editnotice_base ) );
}
}
- } else if ( !wfEmptyMsg( $editnotice_page, wfMsgForContent( $editnotice_page ) ) ) {
- $wgOut->addWikiText( wfMsgForContent( $editnotice_page ) );
}
# Attempt submission here. This will check for edit conflicts,
} elseif ( $this->section == 'new' ) {
// Nothing *to* preview for new sections
return false;
- } elseif ( ( $wgRequest->getVal( 'preload' ) !== '' || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) {
+ } elseif ( ( $wgRequest->getVal( 'preload' ) !== null || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) {
// Standard preference behaviour
return true;
} elseif ( !$this->mTitle->exists() && $this->mTitle->getNamespace() == NS_CATEGORY ) {
$this->textbox2 = $this->safeUnicodeInput( $request, 'wpTextbox2' );
$this->mMetaData = rtrim( $request->getText( 'metadata' ) );
# Truncate for whole multibyte characters. +5 bytes for ellipsis
- $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250 );
+ $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250, '' );
# Remove extra headings from summaries and new sections.
$this->summary = preg_replace('/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->summary);
}
}
+ // FIXME: unused variable?
$this->oldid = $request->getInt( 'oldid' );
$this->live = $request->getCheck( 'live' );
$this->editintro = $request->getText( 'editintro' );
wfProfileOut( $fname );
+
+ // Allow extensions to modify form data
+ wfRunHooks( 'EditPage::importFormData', array( $this, $request ) );
}
/**
if ( $this->suppressIntro ) {
return;
}
+
+ $namespace = $this->mTitle->getNamespace();
+
+ if ( $namespace == NS_MEDIAWIKI ) {
+ # Show a warning if editing an interface message
+ $wgOut->wrapWikiMsg( "<div class='mw-editinginterface'>\n$1</div>", 'editinginterface' );
+ }
+
# Show a warning message when someone creates/edits a user (talk) page but the user does not exists
- if ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) {
+ if ( $namespace == NS_USER || $namespace == NS_USER_TALK ) {
$parts = explode( '/', $this->mTitle->getText(), 2 );
$username = $parts[0];
$id = User::idFromName( $username );
$wgOut->wrapWikiMsg( '<div class="mw-newarticletextanon">$1</div>', 'newarticletextanon' );
}
}
- # Give a notice if the user is editing a deleted page...
+ # Give a notice if the user is editing a deleted/moved page...
if ( !$this->mTitle->exists() ) {
- $this->showDeletionLog( $wgOut );
+ $this->showLogs( $wgOut );
}
}
wfProfileIn( $fname );
wfProfileIn( "$fname-checks" );
- if ( !wfRunHooks( 'EditPage::attemptSave', array( &$this ) ) )
+ if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) )
{
wfDebug( "Hook 'EditPage::attemptSave' aborted article saving\n" );
return self::AS_HOOK_ERROR;
$this->mMetaData = '' ;
# Check for spam
- $match = self::matchSpamRegex( $this->summary );
+ $match = self::matchSummarySpamRegex( $this->summary );
if ( $match === false ) {
$match = self::matchSpamRegex( $this->textbox1 );
}
# Error messages etc. could be handled within the hook...
wfProfileOut( $fname );
return self::AS_HOOK_ERROR;
+ } elseif ( $this->hookError != '' ) {
+ # ...or the hook could be expecting us to produce an error
+ wfProfileOut( $fname );
+ return self::AS_HOOK_ERROR_EXPECTED;
}
# Handle the user preference to force summaries here. Check if it's not a redirect.
# Error messages etc. could be handled within the hook...
wfProfileOut( $fname );
return self::AS_HOOK_ERROR;
+ } elseif ( $this->hookError != '' ) {
+ # ...or the hook could be expecting us to produce an error
+ wfProfileOut( $fname );
+ return self::AS_HOOK_ERROR_EXPECTED;
}
# Handle the user preference to force summaries here, but not for null edits
}
return true;
}
-
+
/**
* Check given input text against $wgSpamRegex, and return the text of the first match.
* @return mixed -- matching string or false
*/
public static function matchSpamRegex( $text ) {
global $wgSpamRegex;
- if ( $wgSpamRegex ) {
- // For back compatibility, $wgSpamRegex may be a single string or an array of regexes.
- $regexes = (array)$wgSpamRegex;
- foreach( $regexes as $regex ) {
- $matches = array();
- if ( preg_match( $regex, $text, $matches ) ) {
- return $matches[0];
- }
+ // For back compatibility, $wgSpamRegex may be a single string or an array of regexes.
+ $regexes = (array)$wgSpamRegex;
+ return self::matchSpamRegexInternal( $text, $regexes );
+ }
+
+ /**
+ * Check given input text against $wgSpamRegex, and return the text of the first match.
+ * @return mixed -- matching string or false
+ */
+ public static function matchSummarySpamRegex( $text ) {
+ global $wgSummarySpamRegex;
+ $regexes = (array)$wgSummarySpamRegex;
+ return self::matchSpamRegexInternal( $text, $regexes );
+ }
+
+ protected static function matchSpamRegexInternal( $text, $regexes ) {
+ foreach( $regexes as $regex ) {
+ $matches = array();
+ if( preg_match( $regex, $text, $matches ) ) {
+ return $matches[0];
}
}
return false;
$sk = $wgUser->getSkin();
- wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
-
#need to parse the preview early so that we know which templates are used,
#otherwise users with "show preview after edit box" will get a blank list
#we parse this near the beginning so that setHeaders can do the title
if ( $this->formtype == 'preview' ) {
$previewOutput = $this->getPreviewText();
}
+
+ wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
$this->setHeaders();
$wgOut->setArticleRelated( true );
if ( $this->isConflict ) {
- $wgOut->addWikiMsg( 'explainconflict' );
+ $wgOut->wrapWikiMsg( "<div class='mw-explainconflict'>\n$1</div>", 'explainconflict' );
$this->textbox2 = $this->textbox1;
$this->textbox1 = $this->getContent();
}
if ( $this->missingComment ) {
- $wgOut->wrapWikiMsg( '<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext' );
+ $wgOut->wrapWikiMsg( '<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext' );
}
if ( $this->missingSummary && $this->section != 'new' ) {
// Let sysop know that this will make private content public if saved
if ( !$this->mArticle->mRevision->userCan( Revision::DELETED_TEXT ) ) {
- $wgOut->addWikiMsg( 'rev-deleted-text-permission' );
+ $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n", 'rev-deleted-text-permission' );
} else if ( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
- $wgOut->addWikiMsg( 'rev-deleted-text-view' );
+ $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n", 'rev-deleted-text-view' );
}
if ( !$this->mArticle->mRevision->isCurrent() ) {
} else {
if ( $this->isCssJsSubpage ) {
# Check the skin exists
- if ( $this->isValidCssJsSubpage ) {
- if ( $this->formtype !== 'preview' ) {
- $wgOut->addWikiMsg( 'usercssjsyoucanpreview' );
- }
- } else {
+ if ( !$this->isValidCssJsSubpage ) {
$wgOut->addWikiMsg( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() );
}
+ if ( $this->formtype !== 'preview' ) {
+ if ( $this->isCssSubpage )
+ $wgOut->addWikiMsg( 'usercssyoucanpreview' );
+ if ( $this->isJsSubpage )
+ $wgOut->addWikiMsg( 'userjsyoucanpreview' );
+ }
}
}
$classes = array(); // Textarea CSS
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
- # Show a warning if editing an interface message
- $wgOut->addWikiMsg( 'editinginterface' );
} elseif ( $this->mTitle->isProtected( 'edit' ) ) {
# Is the title semi-protected?
if ( $this->mTitle->isSemiProtected() ) {
$wgOut->addHTML( "</div>\n" );
}
- $q = 'action='.$this->action;
- #if ( "no" == $redirect ) { $q .= "&redirect=no"; }
- $action = $wgTitle->escapeLocalURL( $q );
+ $action = $wgTitle->escapeLocalURL( array( 'action' => $this->action ) );
- $summary = wfMsg( 'summary' );
- $subject = wfMsg( 'subject' );
+ $summary = wfMsgExt( 'summary', 'parseinline' );
+ $subject = wfMsgExt( 'subject', 'parseinline' );
- $cancel = $sk->makeKnownLink( $wgTitle->getPrefixedText(),
- wfMsgExt('cancel', array('parseinline')) );
+ $cancel = $sk->link(
+ $wgTitle,
+ wfMsgExt( 'cancel', array( 'parseinline' ) ),
+ array( 'id' => 'mw-editform-cancel' ),
+ array(),
+ array( 'known', 'noclasses' )
+ );
$separator = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
$edithelpurl = Skin::makeInternalOrExternalUrl( wfMsgForContent( 'edithelppage' ));
$edithelp = '<a target="helpwindow" href="'.$edithelpurl.'">'.
$copywarnMsg = array( 'copyrightwarning2',
'[[' . wfMsgForContent( 'copyrightpage' ) . ']]' );
}
+ // Allow for site and per-namespace customization of contribution/copyright notice.
+ wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) );
if ( $wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage ) {
# prepare toolbar for edit buttons
$toolbar = '';
}
+
// activate checkboxes if user wants them to be always active
if ( !$this->preview && !$this->diff ) {
# Sort out the "watch" checkbox
# Already watched
$this->watchthis = true;
}
-
+
# May be overriden by request parameters
if( $wgRequest->getBool( 'watchthis' ) ) {
$this->watchthis = true;
# if this is a comment, show a subject line at the top, which is also the edit summary.
# Otherwise, show a summary field at the bottom
- $summarytext = htmlspecialchars( $wgContLang->recodeForEdit( $this->summary ) ); # FIXME
+ $summarytext = $wgContLang->recodeForEdit( $this->summary );
# If a blank edit summary was previously provided, and the appropriate
# user preference is active, pass a hidden tag as wpIgnoreBlankSummary. This will stop the
if ( $this->section == 'new' ) {
$commentsubject = '';
if ( !$wgRequest->getBool( 'nosummary' ) ) {
+ # Add a class if 'missingsummary' is triggered to allow styling of the summary line
+ $summaryClass = $this->missingSummary ? 'mw-summarymissed' : 'mw-summary';
+
$commentsubject =
- Xml::label( $subject, 'wpSummary' );
+ Xml::tags( 'label', array( 'for' => 'wpSummary' ), $subject );
$commentsubject =
- Xml::tags( 'span', array( 'id' => 'wpSummaryLabel' ), $commentsubject );
+ Xml::tags( 'span', array( 'class' => $summaryClass, 'id' => "wpSummaryLabel" ),
+ $commentsubject );
$commentsubject .= ' ';
$commentsubject .= Xml::input( 'wpSummary',
60,
'maxlength' => '200',
'tabindex' => '1'
) );
+ } else {
+ $summaryhiddens .= Xml::hidden( 'wpIgnoreBlankSummary', true ); # bug 18699
}
$editsummary = "<div class='editOptions'>\n";
global $wgParser;
$formattedSummary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $this->summary ) );
- $subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">". wfMsg('subject-preview') . $sk->commentBlock( $formattedSummary, $this->mTitle, true )."</div>\n" : '';
+ $subjectpreview = $summarytext && ( $this->preview || $this->diff ) ?
+ "<div class=\"mw-summary-preview\">". wfMsgExt('subject-preview', 'parseinline') . $sk->commentBlock( $formattedSummary, $this->mTitle, true )."</div>\n" : '';
$summarypreview = '';
} else {
$commentsubject = '';
- $editsummary = Xml::label( $summary, 'wpSummary' );
- $editsummary =
- Xml::tags( 'span', array( 'id' => 'wpSummaryLabel' ), $editsummary );
-
+ # Add a class if 'missingsummary' is triggered to allow styling of the summary line
+ $summaryClass = $this->missingSummary ? 'mw-summarymissed' : 'mw-summary';
+
+ $editsummary = Xml::tags( 'label', array( 'for' => 'wpSummary' ), $summary );
+ $editsummary = Xml::tags( 'span', array( 'class' => $summaryClass, 'id' => "wpSummaryLabel" ),
+ $editsummary ) . ' ';
+
$editsummary .= Xml::input( 'wpSummary',
60,
$summarytext,
'maxlength' => '200',
'tabindex' => '1'
) );
-
+
// No idea where this is closed.
$editsummary = Xml::openElement( 'div', array( 'class' => 'editOptions' ) )
. $editsummary . '<br/>';
-
+
$summarypreview = '';
- if ( $summarytext && $this->preview ) {
+ if ( $summarytext && ( $this->preview || $this->diff ) ) {
$summarypreview =
Xml::tags( 'div',
array( 'class' => 'mw-summary-preview' ),
- wfMsg( 'summary-preview' ) .
+ wfMsgExt( 'summary-preview', 'parseinline' ) .
$sk->commentBlock( $this->summary, $this->mTitle )
);
}
$subjectpreview = '';
}
+ $commentsubject .= $summaryhiddens;
# Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
if ( !$this->preview && !$this->diff ) {
if ( $this->wasDeletedSinceLastEdit() ) {
if ( 'save' != $this->formtype ) {
$wgOut->wrapWikiMsg(
- '<div class="error mw-deleted-while-editing">$1</div>',
+ "<div class='error mw-deleted-while-editing'>\n$1</div>",
'deletedwhileediting' );
} else {
// Hide the toolbar and edit area, user can click preview to get it back
$token = htmlspecialchars( $wgUser->editToken() );
$wgOut->addHTML( "\n<input type='hidden' value=\"$token\" name=\"wpEditToken\" />\n" );
+ $this->showTosSummary();
$this->showEditTools();
$wgOut->addHTML( <<<END
END
);
+ if (!$this->preview) {
+ $wgOut->addHTML( Xml::tags( 'div',
+ array( 'class' => 'catlinks catlinks-allhidden',
+ 'id' => 'catlinks' ), ' ' ) );
+ }
+
if ( $this->isConflict && wfRunHooks( 'EditPageBeforeConflictDiff', array( &$this, &$wgOut ) ) ) {
$wgOut->wrapWikiMsg( '==$1==', "yourdiff" );
function doLivePreviewScript() {
global $wgOut, $wgTitle;
$wgOut->addScriptFile( 'preview.js' );
- $liveAction = $wgTitle->getLocalUrl( "action={$this->action}&wpPreview=true&live=true" );
- return "return !lpDoPreview(" .
- "editform.wpTextbox1.value," .
- '"' . $liveAction . '"' . ")";
+ return "";
+ }
+
+ protected function showTosSummary() {
+ $msg = 'editpage-tos-summary';
+ // Give a chance for site and per-namespace customizations of
+ // terms of service summary link that might exist separately
+ // from the copyright notice.
+ //
+ // This will display between the save button and the edit tools,
+ // so should remain short!
+ wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) );
+ $text = wfMsg( $msg );
+ if( !wfEmptyMsg( $msg, $text ) && $text !== '-' ) {
+ global $wgOut;
+ $wgOut->addHTML( '<div class="mw-tos-summary">' );
+ $wgOut->addWikiMsgArray( $msg, array() );
+ $wgOut->addHTML( '</div>' );
+ }
}
protected function showEditTools() {
$wgOut->addHTML( '</div>' );
}
- function getLastDelete() {
+ protected function getLastDelete() {
$dbr = wfGetDB( DB_SLAVE );
$data = $dbr->selectRow(
array( 'logging', 'user' ),
'log_title',
'log_comment',
'log_params',
- 'user_name', ),
+ 'log_deleted',
+ 'user_name' ),
array( 'log_namespace' => $this->mTitle->getNamespace(),
'log_title' => $this->mTitle->getDBkey(),
'log_type' => 'delete',
'log_action' => 'delete',
'user_id=log_user' ),
__METHOD__,
- array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' ) );
-
+ array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' )
+ );
+ // Quick paranoid permission checks...
+ if( is_object($data) ) {
+ if( $data->log_deleted & LogPage::DELETED_USER )
+ $data->user_name = wfMsgHtml('rev-deleted-user');
+ if( $data->log_deleted & LogPage::DELETED_COMMENT )
+ $data->log_comment = wfMsgHtml('rev-deleted-comment');
+ }
return $data;
}
}
}
- $previewhead = '<h2>' . htmlspecialchars( wfMsg( 'preview' ) ) . "</h2>\n" .
- "<div class='previewnote'>" . $wgOut->parse( $note ) . "</div>\n";
- if ( $this->isConflict ) {
- $previewhead .='<h2>' . htmlspecialchars( wfMsg( 'previewconflict' ) ) . "</h2>\n";
+ if( $this->isConflict ) {
+ $conflict = '<h2 id="mw-previewconflict">' . htmlspecialchars( wfMsg( 'previewconflict' ) ) . "</h2>\n";
+ } else {
+ $conflict = '<hr />';
}
+ $previewhead = "<div class='previewnote'>\n" .
+ '<h2 id="mw-previewheader">' . htmlspecialchars( wfMsg( 'preview' ) ) . "</h2>" .
+ $wgOut->parse( $note ) . $conflict . "</div>\n";
+
wfProfileOut( __METHOD__ );
return $previewhead . $previewHTML;
}
$skin = $wgUser->getSkin();
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
- $loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
+ $loginLink = $skin->link(
+ $loginTitle,
+ wfMsgHtml( 'loginreqlink' ),
+ array(),
+ array( 'returnto' => $wgTitle->getPrefixedText() ),
+ array( 'known', 'noclasses' )
+ );
$wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
* @return string
*/
static function getEditToolbar() {
- global $wgStylePath, $wgContLang, $wgLang, $wgJsMimeType;
+ global $wgStylePath, $wgContLang, $wgLang;
/**
* toolarray an array of arrays which each include the filename of
)
);
$toolbar = "<div id='toolbar'>\n";
- $toolbar.="<script type='$wgJsMimeType'>\n/*<![CDATA[*/\n";
- foreach($toolarray as $tool) {
+ $script = '';
+ foreach ( $toolarray as $tool ) {
$params = array(
$image = $wgStylePath.'/common/images/'.$tool['image'],
// Note that we use the tip both for the ALT tag and the TITLE tag of the image.
$paramList = implode( ',',
array_map( array( 'Xml', 'encodeJsVar' ), $params ) );
- $toolbar.="addButton($paramList);\n";
+ $script .= "addButton($paramList);\n";
}
+ $toolbar .= Html::inlineScript( "\n$script\n" );
+
+ $toolbar .= "\n</div>";
+
+ wfRunHooks( 'EditPageBeforeEditToolbar', array( &$toolbar ) );
- $toolbar.="/*]]>*/\n</script>";
- $toolbar.="\n</div>";
return $toolbar;
}
++$tabindex; // use the same for preview and live preview
if ( $wgLivePreview && $wgUser->getOption( 'uselivepreview' ) ) {
+ $this->doLivePreviewScript(); // Add to output
+
$temp = array(
'id' => 'wpPreview',
'name' => 'wpPreview',
'value' => wfMsg('showlivepreview'),
'accesskey' => wfMsg('accesskey-preview'),
'title' => '',
- 'onclick' => $this->doLivePreviewScript(),
);
+
$buttons['live'] = Xml::element('input', $temp, '');
} else {
$temp = array(
return $buttons;
}
- /**
- * Output preview text only. This can be sucked into the edit page
- * via JavaScript, and saves the server time rendering the skin as
- * well as theoretically being more robust on the client (doesn't
- * disturb the edit box's undo history, won't eat your text on
- * failure, etc).
- *
- * @todo This doesn't include category or interlanguage links.
- * Would need to enhance it a bit, <s>maybe wrap them in XML
- * or something...</s> that might also require more skin
- * initialization, so check whether that's a problem.
- */
- function livePreview() {
- global $wgOut;
- $wgOut->disable();
- header( 'Content-type: text/xml; charset=utf-8' );
- header( 'Cache-control: no-cache' );
-
- $previewText = $this->getPreviewText();
- #$categories = $skin->getCategoryLinks();
-
- $s =
- '<?xml version="1.0" encoding="UTF-8" ?>' . "\n" .
- Xml::tags( 'livepreview', null,
- Xml::element( 'preview', null, $previewText )
- #. Xml::element( 'category', null, $categories )
- );
- echo $s;
- }
-
/**
* Get a diff between the current contents of the edit box and the
}
/**
- * If there are rows in the deletion log for this page, show them,
+ * If there are rows in the deletion/move log for this page, show them,
* along with a nice little note for the user
*
* @param OutputPage $out
*/
- protected function showDeletionLog( $out ) {
+ protected function showLogs( $out ) {
global $wgUser;
$loglist = new LogEventsList( $wgUser->getSkin(), $out );
- $pager = new LogPager( $loglist, 'delete', false, $this->mTitle->getPrefixedText() );
+ $pager = new LogPager( $loglist, array('move', 'delete'), false,
+ $this->mTitle->getPrefixedText(), '', array( "log_action != 'revision'" ) );
+
$count = $pager->getNumRows();
if ( $count > 0 ) {
$pager->mLimit = 10;
$out->addHTML( '<div class="mw-warning-with-logexcerpt">' );
- $out->addWikiMsg( 'recreate-deleted-warn' );
+ $out->addWikiMsg( 'recreate-moveddeleted-warn' );
$out->addHTML(
$loglist->beginLogEventsList() .
$pager->getBody() .
if($count > 10){
$out->addHTML( $wgUser->getSkin()->link(
SpecialPage::getTitleFor( 'Log' ),
- wfMsgHtml( 'deletelog-fulllog' ),
+ wfMsgHtml( 'log-fulllog' ),
array(),
- array(
- 'type' => 'delete',
- 'page' => $this->mTitle->getPrefixedText() ) ) );
+ array( 'page' => $this->mTitle->getPrefixedText() ) ) );
}
$out->addHTML( '</div>' );
return true;