From 77c28206a14b5bee3f3091f10cffd531bce5649c Mon Sep 17 00:00:00 2001
From: yllar <yllar.pajus@gmail.com>
Date: Sat, 16 Dec 2006 13:25:16 -0500
Subject: [PATCH] updated ja and fr translations

---
 program/steps/mail/compose.inc |   53 ++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 9b759e6..e671b4c 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -20,6 +20,7 @@
 */
 
 require_once('Mail/mimeDecode.php');
+require_once('lib/html2text.inc');
 
 // define constants for message compose mode
 define('RCUBE_COMPOSE_REPLY', 0x0106);
@@ -76,7 +77,7 @@
   $MESSAGE['structure'] = &$IMAP->get_structure($msg_uid);  
   $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject);
   $MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']);
-
+  
   if ($compose_mode == RCUBE_COMPOSE_REPLY)
     {
     $_SESSION['compose']['reply_uid'] = $msg_uid;
@@ -171,18 +172,18 @@
     {
     // get recipent address(es) out of the message headers
     if ($header=='to' && !empty($MESSAGE['headers']->replyto))
-      $fvalue = $IMAP->decode_header($MESSAGE['headers']->replyto);
+      $fvalue = $MESSAGE['headers']->replyto;
 
     else if ($header=='to' && !empty($MESSAGE['headers']->from))
-      $fvalue = $IMAP->decode_header($MESSAGE['headers']->from);
+      $fvalue = $MESSAGE['headers']->from;
 
     // add recipent of original message if reply to all
     else if ($header=='cc' && !empty($MESSAGE['reply_all']))
       {
-      if ($v = $IMAP->decode_header($MESSAGE['headers']->to))
+      if ($v = $MESSAGE['headers']->to)
         $fvalue .= $v;
 
-      if ($v = $IMAP->decode_header($MESSAGE['headers']->cc))
+      if ($v = $MESSAGE['headers']->cc)
         $fvalue .= (!empty($fvalue) ? ', ' : '') . $v;
       }
 
@@ -212,7 +213,6 @@
 
     if ($header=='bcc' && !empty($MESSAGE['headers']->bcc))
       $fvalue = $IMAP->decode_header($MESSAGE['headers']->bcc);
-
     }
 
         
@@ -253,7 +253,7 @@
     {
     $MESSAGE['FROM'] = array();
 
-    $a_to = $IMAP->decode_address_list($MESSAGE['headers']->to);        
+    $a_to = $IMAP->decode_address_list($MESSAGE['headers']->to);
     foreach ($a_to as $addr)
       {
       if (!empty($addr['mailto']))
@@ -297,6 +297,12 @@
         {
         $a_signatures[$identity_id]['text'] = $sql_arr['signature'];
         $a_signatures[$identity_id]['is_html'] = ($sql_arr['html_signature'] == 1) ? true : false;
+        if ($a_signatures[$identity_id]['is_html'])
+          {
+            $h2t = new html2text($a_signatures[$identity_id]['text'], false, false);
+            $plainTextPart = $h2t->get_text();
+            $a_signatures[$identity_id]['plain_text'] = trim($plainTextPart);
+          }
         }
 
       // set identity if it's one of the reply-message recipients
@@ -414,7 +420,7 @@
 
   $out = $form_start ? "$form_start\n" : '';
 
-  $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => str_replace(array('<','>'),"",$MESSAGE['headers']->messageID) ));
+  $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => $compose_mode==RCUBE_COMPOSE_DRAFT ? str_replace(array('<','>'), "", $MESSAGE['headers']->messageID) : ''));
   $out .= $saveid->show();
 
   $drafttoggle = new hiddenfield(array('name' => '_draft', 'value' => 'yes'));
@@ -543,10 +549,10 @@
         "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">From: </th><td>%s</td></tr>" .
         "<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">To: </th><td>%s</td></tr>" .
         "</tbody></table><br>",
-                     $MESSAGE['subject'],
-                     $MESSAGE['headers']->date,
-                     $IMAP->decode_header($MESSAGE['headers']->from),
-                     $IMAP->decode_header($MESSAGE['headers']->to));
+                     rep_specialchars_output($MESSAGE['subject']),
+                     rep_specialchars_output($MESSAGE['headers']->date),
+                     rep_specialchars_output($IMAP->decode_header($MESSAGE['headers']->from)),
+                     rep_specialchars_output($IMAP->decode_header($MESSAGE['headers']->to)));
   }
 
   // add attachments
@@ -787,8 +793,8 @@
   global $CONFIG, $MESSAGE, $compose_mode;
 
   $choices = array(
-    'html'  => 'HTML',
-    'plain' => 'Plain text'
+    'html'  => 'htmltoggle',
+    'plain' => 'plaintoggle'
   );
 
   // determine whether HTML or plain text should be checked 
@@ -806,15 +812,24 @@
     }
 
   $selector = '';
+  
+  $attrib['name'] = '_editorSelect';
+  $attrib['onchange'] = 'return rcmail_toggle_editor(this)';
   foreach ($choices as $value => $text)
     {
     $checked = '';
-    if ((($text == 'HTML') && $useHtml) ||
-        (($text != 'HTML') && !$useHtml))
-      $checked = 'checked';
+    if ((($value == 'html') && $useHtml) ||
+        (($value != 'html') && !$useHtml))
+      $attrib['checked'] = 'true';
+    else
+      unset($attrib['checked']);
 
-    $selector .= sprintf("<input type='radio' name='_editorSelect' value='%s' %s onclick='return rcmail_toggle_editor(this)'>%s</input>\n",
-                          $value, $checked, $text);
+    $attrib['id'] = '_' . $value;
+    $rb = new radiobutton($attrib);
+    $selector .= sprintf("<td>%s</td><td class=\"title\"><label for=\"%s\">%s</label></td>",
+                         $rb->show($value),
+                         $attrib['id'],
+                         rcube_label($text));
     }
 
   return $selector;

--
Gitblit v1.9.1