http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88639

Revision: 88639
Author:   aaron
Date:     2011-05-23 14:09:15 +0000 (Mon, 23 May 2011)
Log Message:
-----------
(bug 27756, bug 26328) Removed AJAX preview (on diff) loading: causes more 
trouble than it's worth. If any reincarnation is added it must handle these 
problems (which involve rethinking the page loading model). Also, diffs use the 
current page cache when possible. The focus should be on avoiding 
fragmentation. Additionally, diffonly=0 in review links could be altered (we 
already enumerate template/file changes).

Modified Paths:
--------------
    trunk/extensions/FlaggedRevs/FlaggedRevs.php
    trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php
    trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php
    trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.js

Modified: trunk/extensions/FlaggedRevs/FlaggedRevs.php
===================================================================
--- trunk/extensions/FlaggedRevs/FlaggedRevs.php        2011-05-23 13:47:03 UTC 
(rev 88638)
+++ trunk/extensions/FlaggedRevs/FlaggedRevs.php        2011-05-23 14:09:15 UTC 
(rev 88639)
@@ -517,9 +517,6 @@
 # Database schema changes
 $wgHooks['LoadExtensionSchemaUpdates'][] = 
'FlaggedRevsUpdaterHooks::addSchemaUpdates';
 
-# Performance Don't show content on diff
-$wgHooks['ArticleContentOnDiff'][] = 
'FlaggedRevsUIHooks::onArticleContentOnDiff';
-
 # ########
 
 function efSetFlaggedRevsConditionalHooks() {

Modified: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php
===================================================================
--- trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php       
2011-05-23 13:47:03 UTC (rev 88638)
+++ trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php       
2011-05-23 14:09:15 UTC (rev 88639)
@@ -1844,19 +1844,4 @@
                }
                return true;
        }
-       
-       /*
-        * If this is a diff page then replace the article contents with a link
-        * to the specific revision. This will be replaced with article content
-        * using javascript and an api call.
-        */
-       public function addCustomContentHtml( OutputPage $out, $newRevId ) {
-               $this->load();
-               if ( $newRevId ) {
-                       $out->addHTML( "<div id='mw-fr-revisioncontents'><span 
class='plainlinks'>" );
-                       $out->addWikiMsg( 'revcontents-getcontents',
-                               $this->article->getTitle()->getPrefixedDBKey(), 
$newRevId );
-                       $out->addHTML( "</span></div>" );
-               }
-       }
 }

Modified: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php
===================================================================
--- trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php   
2011-05-23 13:47:03 UTC (rev 88638)
+++ trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php   
2011-05-23 14:09:15 UTC (rev 88639)
@@ -609,19 +609,6 @@
                $view->addToDiffView( $diff, $oldRev, $newRev );
                return true;
        }
-       
-       /*
-        * If an article is reviewable, get custom article contents from the 
FlaggedPageView
-        */
-       public static function onArticleContentOnDiff( $diffEngine, $out ) {
-               $fa = FlaggedPage::getTitleInstance( $out->getTitle() );
-               if ( !$fa->isReviewable() ) {
-                       return true; // nothing to do
-               }
-               $view = FlaggedPageView::singleton();
-               $view->addCustomContentHtml( $out, $diffEngine->getNewid() );
-               return false;
-       }
 
        public static function addRevisionIDField( $editPage, $out ) {
                $view = FlaggedPageView::singleton();

Modified: trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.js
===================================================================
--- trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.js    
2011-05-23 13:47:03 UTC (rev 88638)
+++ trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.js    
2011-05-23 14:09:15 UTC (rev 88639)
@@ -197,78 +197,6 @@
        }
 };
 
-
-// Get the revisioncontents div and replace it with actual parsed article 
contents via an API call
-FlaggedRevs.getRevisionContents = function() {
-       var revContent = mw.config.get( 'wgRevContents' );
-       var $frRevContents = $( '#mw-fr-revisioncontents' );
-       var $prevLink = $( '#differences-prevlink' );
-       var $nextLink = $( '#differences-nextlink' );
-
-       if ( $frRevContents.size() ) {
-               var diffUIParams = document.getElementById( 
'mw-fr-diff-dataform' );
-               var oldRevId = diffUIParams.getElementsByTagName( 'input' 
)[1].value;
-               var origContents = $frRevContents.html();
-               $frRevContents.html( '<span class="loading mw-small-spinner 
spinner"></span>'
-                       + '<span class="loading">' + mw.html.escape( 
revContent.waiting ) + '</span>' );
-               var queryParams = {
-                       format: 'json',
-                       action: 'parse',
-                       prop: 'text|categorieshtml|languageshtml|headitems'
-               };
-               if ( mw.config.get( 'wgCurRevisionId' ) == oldRevId
-                       && mw.config.exists( 'wgPageName' ) )
-               {
-                       queryParams.page = mw.config.get( 'wgPageName' );
-               } else {
-                       queryParams.oldid = oldRevId;
-               }
-
-               var call = $.ajax({
-                       url: mw.config.get( 'wgScriptPath' ) + '/api.php',
-                       data: queryParams,
-                       dataType: 'json',
-                       success: function( result ) {
-                               if ( !result || !result.parse ) {
-                                       return;
-                               }
-                               // Get data
-                               var     parse = result.parse,
-                                       text = parse.text,
-                                       languageshtml = parse.languageshtml,
-                                       categoryhtml = parse.categorieshtml;
-                               // Insert data into page
-                               if ( text && text['*'] ) {
-                                       $frRevContents.empty().append( 
text['*'] );
-                               } else {
-                                       $frRevContents.empty().append( 
revContent.error + ' ' + origContents );
-                               }
-                               if ( languageshtml && languageshtml['*'] ) {
-                                       $frRevContents.append( '<div 
class="langlinks" >' +
-                                               languageshtml['*'] + '</div>' );
-                               }
-                               if ( categoryhtml && categoryhtml['*'] ) {
-                                       $('#catlinks').replaceWith( 
$(categoryhtml['*']) );
-                               }
-                       },
-                       error: function(xhttp, status, error) {
-                               $frRevContents.html( revContent.error + ' ' + 
origContents );
-                       }
-               });
-       }
-       $prevLink.click( function() {
-               if ( call ) {
-                       call.abort();
-               }
-       } );
-       $nextLink.click( function() {
-               if ( call ) {
-                       call.abort();
-               }
-       } );
-};
-
 // Perform some onload (which is when this script is included) events:
 FlaggedRevs.enableShowhide();
 FlaggedRevs.setCheckTrigger();
-FlaggedRevs.getRevisionContents();


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to