From 570f0bb4a609b04dab58407a642922dfdf715bd5 Mon Sep 17 00:00:00 2001
From: svncommit <devs@roundcube.net>
Date: Tue, 05 Jun 2007 00:19:43 -0400
Subject: [PATCH] fixed HTML->Plain conversion

---
 CHANGELOG            |    5 +++++
 index.php            |   16 ++++++++++++++++
 program/js/editor.js |    1 -
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 54830f1..e58d643 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,11 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
+2007/06/04 (estadtherr)
+----------
+- Fixed bug in HTML->Plain editor toggling
+
+
 2007/05/28 (thomasb)
 ---------
 - Fixed buggy imap_root settings (closes #1484379)
diff --git a/index.php b/index.php
index 6047499..bde2234 100644
--- a/index.php
+++ b/index.php
@@ -82,6 +82,7 @@
 require_once('include/bugs.inc');
 require_once('include/main.inc');
 require_once('include/cache.inc');
+require_once('lib/html2text.inc');
 require_once('PEAR.php');
 
 
@@ -145,6 +146,21 @@
   raise_error(array('code' => hexdec($_GET['_code'])), FALSE, TRUE);
 
 
+// handle HTML->text conversion
+if ($_action=='html2text')
+{
+    $htmlText = $HTTP_RAW_POST_DATA;
+    $converter = new html2text($htmlText);
+
+  	// TODO possibly replace with rcube_remote_response()
+  	header('Content-Type: text/plain');
+  	$plaintext = $converter->get_text();
+  	print $plaintext;
+
+  	exit;
+}
+
+
 // try to log in
 if ($_action=='login' && $_task=='mail')
 {
diff --git a/program/js/editor.js b/program/js/editor.js
index 536762e..3a191b5 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -100,7 +100,6 @@
   http_request.onerror = function(o) { rcmail_handle_toggle_error(o); };
   http_request.oncomplete = function(o) { rcmail_set_text_value(o); };
   var url=rcmail.env.comm_path+'&_action=html2text';
-  console('HTTP request: ' + url);
   http_request.POST(url, htmlText, 'application/octet-stream');
   }
 

--
Gitblit v1.9.1