From f0c8fd6e94dc4e62f9bccdc1eacced953d610093 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Tue, 25 Aug 2009 15:09:40 +0000 Subject: [PATCH] Fix live preview copying of existing category links --- includes/Article.php | 16 +++++++++------- includes/EditPage.php | 36 ++++++------------------------------ includes/Skin.php | 7 ++----- skins/common/preview.js | 3 +++ 4 files changed, 20 insertions(+), 42 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index eca3883b73..eead44ff42 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2604,6 +2604,8 @@ class Article { $wgOut->setSubtitle( wfMsgHtml( 'delete-backlink', $deleteBackLink ) ); $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->addWikiMsg( 'confirmdeletetext' ); + + wfRunHooks( 'ArticleConfirmDelete', array( $this, $wgOut, &$reason ) ); if( $wgUser->isAllowed( 'suppressrevision' ) ) { $suppress = " @@ -2703,14 +2705,14 @@ class Article { $wgOut->addWikiMsg( 'deletedtext', $deleted, $loglink ); $wgOut->returnToMain( false ); wfRunHooks('ArticleDeleteComplete', array(&$this, &$wgUser, $reason, $id)); + } + } else { + if( $error == '' ) { + $wgOut->showFatalError( wfMsgExt( 'cannotdelete', array( 'parse' ) ) ); + $wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) ); + LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTitle->getPrefixedText() ); } else { - if( $error == '' ) { - $wgOut->showFatalError( wfMsgExt( 'cannotdelete', array( 'parse' ) ) ); - $wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) ); - LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTitle->getPrefixedText() ); - } else { - $wgOut->showFatalError( $error ); - } + $wgOut->showFatalError( $error ); } } } diff --git a/includes/EditPage.php b/includes/EditPage.php index 456152f9f8..d66f0c3ff4 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1581,6 +1581,12 @@ 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" ); @@ -2318,36 +2324,6 @@ END 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, maybe wrap them in XML - * or something... 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 = - '' . "\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 diff --git a/includes/Skin.php b/includes/Skin.php index ab41d29212..c4c7c33196 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -902,14 +902,11 @@ END; $classes = 'catlinks'; - if( strpos( $catlinks, '