From 79af0bb1ba370bd5f194afb692e7ed59a26b02af Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 03 Nov 2008 09:26:23 -0500
Subject: [PATCH] - Add warning when switching editor mode from html to plain (#1485488) - Unified editor switching functions

---
 program/steps/mail/compose.inc |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index df6f1ff..758069a 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -81,7 +81,9 @@
 }
 
 // add some labels to client
-$OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting');
+$OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning',
+    'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved',
+    'converting', 'editorwarning');
 
 // add config parameters to client script
 if (!empty($CONFIG['drafts_mbox'])) {
@@ -848,9 +850,13 @@
   if ($compose_mode)
     $useHtml = ($useHtml && $MESSAGE->has_html_part());
 
+  $editorid = empty($attrib['editorid']) ? 'rcmComposeMessage' : $attrib['editorid'];
+
   $selector = '';
   $chosenvalue = $useHtml ? 'html' : 'plain';
-  $radio = new html_radiobutton(array('name' => '_editorSelect', 'onclick' => 'return rcmail_toggle_editor(this)'));
+  $radio = new html_radiobutton(array('name' => '_editorSelect',
+    'onclick' => "return rcmail.toggle_editor(this.value=='html', '$editorid', '_is_html')"));
+
   foreach ($choices as $value => $text)
   {
     $attrib['id'] = '_' . $value;

--
Gitblit v1.9.1