# Placeholders for text injection by hooks (must be HTML)
# extensions should take care to _append_ to the present value
- var $editFormTextTop;
- var $editFormTextAfterWarn;
- var $editFormTextAfterTools;
- var $editFormTextBottom;
+ public $editFormPageTop; // Before even the preview
+ public $editFormTextTop;
+ public $editFormTextAfterWarn;
+ public $editFormTextAfterTools;
+ public $editFormTextBottom;
/**
* @todo document
$this->mTitle =& $wgTitle;
# Placeholders for text injection by hooks (empty per default)
- $this->editFormTextTop = "";
- $this->editFormTextAfterWarn = "";
- $this->editFormTextAfterTools = "";
+ $this->editFormPageTop =
+ $this->editFormTextTop =
+ $this->editFormTextAfterWarn =
+ $this->editFormTextAfterTools =
$this->editFormTextBottom = "";
}
#Undoing a specific edit overrides section editing; section-editing
# doesn't work with undoing.
$undorev = Revision::newFromId($undo);
- $oldrev = $undorev->getPrevious();
#Sanity check, make sure it's the right page.
# Otherwise, $text will be left as-is.
- if ($undorev->getPage() == $this->mArticle->getID()) {
+ if (!is_null($undorev) && $undorev->getPage() == $this->mArticle->getID()) {
+ $oldrev = $undorev->getPrevious();
$undorev_text = $undorev->getText();
$oldrev_text = $oldrev->getText();
$currev_text = $text;
- $result = wfMerge($undorev_text, $oldrev_text, $currev_text, &$text);
+ $result = wfMerge($undorev_text, $oldrev_text, $currev_text, $text);
if (!$result) {
#Undoing failed. Bailing out with regular revision text.
$text = $currev_text;
#Give a warning
- $this->editFormTextTop = "<h2>" . wfMsg('undofailed') . "</h2><br/>\n" .
- wfMsg('explainundofailed');
+ $this->editFormPageTop .= "<h2>" . wfMsg('undofailed') . "</h2>\n" .
+ '<p><strong class="error">'.wfMsg('explainundofailed').'</strong></p>';
+ } else {
+ $this->editFormPageTop .= '<h2>'.wfMsg('undosucceeded')."</h2>\n" .
+ '<p>'.wfMsg('explainundosucceeded').'</p>';
+ $this->summary = wfMsgForContent('undo-summary', $undo, $undorev->getUserText());
}
}
}
*/
function initialiseForm() {
$this->edittime = $this->mArticle->getTimestamp();
- $this->textbox1 = $this->getContent();
$this->summary = '';
+ $this->textbox1 = $this->getContent();
if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI )
$this->textbox1 = wfMsgWeirdKey( $this->mArticle->mTitle->getText() ) ;
wfProxyCheck();
$checkboxhtml = $minoredithtml . $watchhtml;
+ $wgOut->addHTML( $this->editFormPageTop );
+
if ( $wgUser->getOption( 'previewontop' ) ) {
if ( 'preview' == $this->formtype ) {