From fbf77b4493f1b77c99751d8a86365c712ae3fb1b Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 18 Nov 2005 10:35:15 -0500
Subject: [PATCH] Added Japanese localization

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

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index f707599..9509b49 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -32,6 +32,10 @@
   $_SESSION['compose'] = array('id' => uniqid(rand()));
 
 
+// add some labels to client
+rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'sendingmessage');
+
+
 if ($_GET['_reply_uid'] || $_GET['_forward_uid'])
   {
   $msg_uid = $_GET['_reply_uid'] ? $_GET['_reply_uid'] : $_GET['_forward_uid'];
@@ -46,15 +50,18 @@
   $MESSAGE['structure'] = $mmd->decode(array('include_bodies' => TRUE,
                                              'decode_headers' => TRUE,
                                              'decode_bodies' => FALSE));
-                                             
+
   $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject);
   $MESSAGE['parts'] = $mmd->getMimeNumbers($MESSAGE['structure']);
   
   if ($_GET['_reply_uid'])
     {
-    $REPLY_MESSAGE = $MESSAGE;
+    $REPLY_MESSAGE = &$MESSAGE;
     $_SESSION['compose']['reply_uid'] = $_GET['_reply_uid'];
     $_SESSION['compose']['reply_msgid'] = $REPLY_MESSAGE['headers']->messageID;
+
+    if ($_GET['_all'])
+      $REPLY_MESSAGE['reply_all'] = 1;
     }
   else
     {
@@ -71,6 +78,7 @@
 function rcmail_compose_headers($attrib)
   {
   global $IMAP, $REPLY_MESSAGE, $DB;
+  static $sa_recipients = array();
 
   list($form_start, $form_end) = get_form_tags($attrib);
   
@@ -83,7 +91,7 @@
       // pass the following attributes to the form class
       $field_attrib = array('name' => '_from');
       foreach ($attrib as $attr => $value)
-        if (in_array($attr, array('id', 'class', 'style', 'size')))
+        if (in_array($attr, array('id', 'class', 'style', 'size', 'tabindex')))
           $field_attrib[$attr] = $value;
     
       // get this user's identities
@@ -140,25 +148,25 @@
       if (!$fname)
         {
         $fname = '_cc';
-        //$header = 'cc';
+        $header = 'cc';
         }
     case 'bcc':
       if (!$fname)
         $fname = '_bcc';
         
-      $allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'wrap');
+      $allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'wrap', 'tabindex');
       $field_type = 'textarea';            
       break;
 
     case 'replyto':
     case 'reply-to':
       $fname = '_replyto';
-      $allow_attrib = array('id', 'class', 'style', 'size');
+      $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex');
       $field_type = 'textfield';
       break;
     
     }
-    
+
     
   if ($fname && !empty($_POST[$fname]))
     $fvalue = $_POST[$fname];
@@ -169,14 +177,37 @@
       $fvalue = $IMAP->decode_header($REPLY_MESSAGE['headers']->replyto);
     else if ($header=='to' && $REPLY_MESSAGE['headers']->from)
       $fvalue = $IMAP->decode_header($REPLY_MESSAGE['headers']->from);
-    
+    // add recipent of original message if reply to all
+    else if ($header=='cc' && $REPLY_MESSAGE['reply_all'])
+      {
+      if ($IMAP->decode_header($REPLY_MESSAGE['headers']->to))
+        $fvalue .= $IMAP->decode_header($REPLY_MESSAGE['headers']->to);
+
+      if ($IMAP->decode_header($REPLY_MESSAGE['headers']->cc))
+        {
+        if($fvalue)
+          $fvalue .= ', ';
+
+        $fvalue .= $IMAP->decode_header($REPLY_MESSAGE['headers']->cc);
+        }
+      }
+
     // split recipients and put them back together in a unique way
-    $to_addresses = $IMAP->decode_address_list($fvalue);
-    $fvalue = '';
-    foreach ($to_addresses as $addr_part)
-      $fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string'];
+    if (!empty($fvalue))
+      {
+      $to_addresses = $IMAP->decode_address_list($fvalue);
+      $fvalue = '';
+      foreach ($to_addresses as $addr_part)
+        {
+        if (!in_array($addr_part['mailto'], $sa_recipients))
+          {
+          $fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string'];
+          $sa_recipients[] = $addr_part['mailto'];
+          }
+        }
+      }
     }
-    
+
         
   if ($fname && $field_type)
     {
@@ -552,6 +583,15 @@
   }
 
 
+function rcmail_charset_pulldown($selected='ISO-8859-1')
+  {
+  $select = new select();
+  
+  
+  return $select->show($selected);
+  }
+
+
 /****** get contacts for this user and add them to client scripts ********/
 
 $sql_result = $DB->query("SELECT name, email

--
Gitblit v1.9.1