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

Revision: 56478
Author:   aaron
Date:     2009-09-17 01:14:00 +0000 (Thu, 17 Sep 2009)

Log Message:
-----------
partial revert on r55573; livePreview() is still used

Modified Paths:
--------------
    trunk/phase3/includes/EditPage.php

Modified: trunk/phase3/includes/EditPage.php
===================================================================
--- trunk/phase3/includes/EditPage.php  2009-09-17 01:09:45 UTC (rev 56477)
+++ trunk/phase3/includes/EditPage.php  2009-09-17 01:14:00 UTC (rev 56478)
@@ -2338,7 +2338,37 @@
                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
         * version of the page we're editing from.



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to