r55573 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55572‎ | r55573 | r55574 >
Date:15:09, 25 August 2009
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Fix live preview copying of existing category links
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/skins/common/preview.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/preview.js
@@ -33,7 +33,10 @@
3434 // with the content of the loaded page
3535 var copyContent = page.find( copyElements[i] ).contents();
3636 $j(copyElements[i]).empty().append( copyContent );
 37+ var newClasses = page.find( copyElements[i] ).attr('class');
 38+ $j(copyElements[i]).attr( 'class', newClasses );
3739 }
 40+
3841 $j('#wikiPreview').slideDown();
3942 } );
4043 }
Index: trunk/phase3/includes/Article.php
@@ -2604,6 +2604,8 @@
26052605 $wgOut->setSubtitle( wfMsgHtml( 'delete-backlink', $deleteBackLink ) );
26062606 $wgOut->setRobotPolicy( 'noindex,nofollow' );
26072607 $wgOut->addWikiMsg( 'confirmdeletetext' );
 2608+
 2609+ wfRunHooks( 'ArticleConfirmDelete', array( $this, $wgOut, &$reason ) );
26082610
26092611 if( $wgUser->isAllowed( 'suppressrevision' ) ) {
26102612 $suppress = "<tr id=\"wpDeleteSuppressRow\" name=\"wpDeleteSuppressRow\">
@@ -2703,14 +2705,14 @@
27042706 $wgOut->addWikiMsg( 'deletedtext', $deleted, $loglink );
27052707 $wgOut->returnToMain( false );
27062708 wfRunHooks('ArticleDeleteComplete', array(&$this, &$wgUser, $reason, $id));
 2709+ }
 2710+ } else {
 2711+ if( $error == '' ) {
 2712+ $wgOut->showFatalError( wfMsgExt( 'cannotdelete', array( 'parse' ) ) );
 2713+ $wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
 2714+ LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTitle->getPrefixedText() );
27072715 } else {
2708 - if( $error == '' ) {
2709 - $wgOut->showFatalError( wfMsgExt( 'cannotdelete', array( 'parse' ) ) );
2710 - $wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
2711 - LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTitle->getPrefixedText() );
2712 - } else {
2713 - $wgOut->showFatalError( $error );
2714 - }
 2716+ $wgOut->showFatalError( $error );
27152717 }
27162718 }
27172719 }
Index: trunk/phase3/includes/EditPage.php
@@ -1581,6 +1581,12 @@
15821582 END
15831583 );
15841584
 1585+ if (!$this->preview) {
 1586+ $wgOut->addHTML( Xml::tags( 'div',
 1587+ array( 'class' => 'catlinks catlinks-allhidden',
 1588+ 'id' => 'catlinks' ), ' ' ) );
 1589+ }
 1590+
15851591 if ( $this->isConflict && wfRunHooks( 'EditPageBeforeConflictDiff', array( &$this, &$wgOut ) ) ) {
15861592 $wgOut->wrapWikiMsg( '==$1==', "yourdiff" );
15871593
@@ -2318,37 +2324,7 @@
23192325 return $buttons;
23202326 }
23212327
2322 - /**
2323 - * Output preview text only. This can be sucked into the edit page
2324 - * via JavaScript, and saves the server time rendering the skin as
2325 - * well as theoretically being more robust on the client (doesn't
2326 - * disturb the edit box's undo history, won't eat your text on
2327 - * failure, etc).
2328 - *
2329 - * @todo This doesn't include category or interlanguage links.
2330 - * Would need to enhance it a bit, <s>maybe wrap them in XML
2331 - * or something...</s> that might also require more skin
2332 - * initialization, so check whether that's a problem.
2333 - */
2334 - function livePreview() {
2335 - global $wgOut;
2336 - $wgOut->disable();
2337 - header( 'Content-type: text/xml; charset=utf-8' );
2338 - header( 'Cache-control: no-cache' );
23392328
2340 - $previewText = $this->getPreviewText();
2341 - #$categories = $skin->getCategoryLinks();
2342 -
2343 - $s =
2344 - '<?xml version="1.0" encoding="UTF-8" ?>' . "\n" .
2345 - Xml::tags( 'livepreview', null,
2346 - Xml::element( 'preview', null, $previewText )
2347 - #. Xml::element( 'category', null, $categories )
2348 - );
2349 - echo $s;
2350 - }
2351 -
2352 -
23532329 /**
23542330 * Get a diff between the current contents of the edit box and the
23552331 * version of the page we're editing from.
Index: trunk/phase3/includes/Skin.php
@@ -902,14 +902,11 @@
903903
904904 $classes = 'catlinks';
905905
906 - if( strpos( $catlinks, '<div id="mw-normal-catlinks">' ) === false &&
907 - strpos( $catlinks, '<div id="mw-hidden-catlinks" class="mw-hidden-cats-hidden">' ) !== false ) {
 906+ if( strpos( $catlinks, '<div id="mw-normal-catlinks">' ) === false ) {
908907 $classes .= ' catlinks-allhidden';
909908 }
910909
911 - if( !empty( $catlinks ) ){
912 - return "<div id='catlinks' class='$classes'>{$catlinks}</div>";
913 - }
 910+ return "<div id='catlinks' class='$classes'>{$catlinks}</div>";
914911 }
915912
916913 function getQuickbarCompensator( $rows = 1 ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r56478partial revert on r55573; livePreview() is still usedaaron01:14, 17 September 2009
r56523Fix bug 20688 (Hidden categories still hidden if there are no non-hidden cate...werdna15:24, 17 September 2009

Comments

#Comment by Catrope (talk | contribs)   22:07, 27 August 2009

This adds a new hook (ArticleConfirmDelete) which not only seems to be unused but is also not documented in hooks.txt

Status & tagging log