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/js/app.js |  194 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 146 insertions(+), 48 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index ae68ea8..d47f427 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -32,7 +32,7 @@
   this.ref = 'rcube_webmail_client';
  
   // webmail client settings
-  this.dblclick_time = 600;
+  this.dblclick_time = 500;
   this.message_time = 5000;
   
   this.mbox_expression = new RegExp('[^0-9a-z\-_]', 'gi');
@@ -137,16 +137,30 @@
         // enable mail commands
         this.enable_command('list', 'checkmail', 'compose', 'add-contact', 'search', 'reset-search', true);
         
-        if (this.env.action=='show')
+        if (this.env.action=='show' || this.env.action=='preview')
           {
           this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'viewsource', 'print', 'load-attachment', true);
           if (this.env.next_uid)
+            {
             this.enable_command('nextmessage', true);
+            this.enable_command('lastmessage', true);
+            }
           if (this.env.prev_uid)
+            {
             this.enable_command('previousmessage', true);
+            this.enable_command('firstmessage', true);
+            }
+          }
+        
+        // make preview/message frame visible
+        if (this.env.action == 'preview' && this.env.framed && parent.rcmail)
+          {
+          this.enable_command('compose', 'add-contact', false);
+          parent.rcmail.show_messageframe(true);
+          parent.rcmail.mark_message('read', this.uid);
           }
 
-        if (this.env.action=='show' && this.env.blockedobjects)
+        if ((this.env.action=='show' || this.env.action=='preview') && this.env.blockedobjects)
           {
           if (this.gui_objects.remoteobjectsmsg)
             this.gui_objects.remoteobjectsmsg.style.display = 'block';
@@ -285,9 +299,9 @@
   // start interval for keep-alive/recent_check signal
   this.start_keepalive = function()
     {
-    if (this.env.keep_alive && this.task=='mail' && this.gui_objects.messagelist)
+    if (this.env.keep_alive && !this.env.framed && this.task=='mail' && this.gui_objects.messagelist)
       this._int = setInterval(this.ref+'.check_for_recent()', this.env.keep_alive * 1000);
-    else if (this.env.keep_alive && this.task!='login')
+    else if (this.env.keep_alive && !this.env.framed && this.task!='login')
       this._int = setInterval(this.ref+'.send_keep_alive()', this.env.keep_alive * 1000);    
     }
 
@@ -478,8 +492,16 @@
         this.list_page('next');
         break;
 
+      case 'lastpage':
+        this.list_page('last');
+        break;
+
       case 'previouspage':
         this.list_page('prev');
+        break;
+
+      case 'firstpage':
+        this.list_page('first');
         break;
 
       case 'expunge':
@@ -623,7 +645,7 @@
         
       case 'load-images':
         if (this.env.uid)
-          this.show_message(this.env.uid, true);
+          this.show_message(this.env.uid, true, this.env.action=='preview');
         break;
 
       case 'load-attachment':
@@ -632,7 +654,7 @@
         // open attachment in frame if it's of a supported mimetype
         if (this.env.uid && props.mimetype && find_in_array(props.mimetype, this.mimetypes)>=0)
           {
-          this.attachment_win = window.open(this.env.comm_path+'&_action=get'+url+'&_frame=1', 'rcubemailattachment');
+          this.attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment');
           if (this.attachment_win)
             {
             setTimeout(this.ref+'.attachment_win.focus()', 10);
@@ -653,12 +675,22 @@
 
       case 'nextmessage':
         if (this.env.next_uid)
-          this.show_message(this.env.next_uid);
+          this.show_message(this.env.next_uid, false, this.env.action=='preview');
+        break;
+
+	  case 'lastmessage':
+        if (this.env.last_uid)
+          this.show_message(this.env.last_uid);
         break;
 
       case 'previousmessage':
         if (this.env.prev_uid)
-          this.show_message(this.env.prev_uid);
+          this.show_message(this.env.prev_uid, false, this.env.action=='preview');
+        break;
+
+      case 'firstmessage':
+        if (this.env.first_uid)
+          this.show_message(this.env.first_uid);
         break;
       
       case 'checkmail':
@@ -1028,6 +1060,9 @@
 
   this.msglist_select = function(list)
     {
+    if (this.preview_timer)
+      clearTimeout(this.preview_timer);
+
     var selected = list.selection.length==1;
     if (this.env.mailbox == this.env.drafts_mailbox)
       {
@@ -1038,17 +1073,26 @@
       {
       this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected);
       this.enable_command('delete', 'moveto', list.selection.length>0 ? true : false);
+
+      // start timer for message preview (wait for double click)
+      if (selected && this.env.contentframe)
+        this.preview_timer = setTimeout(this.ref+'.msglist_get_preview()', this.dblclick_time + 10);
+      else if (this.env.contentframe)
+        this.show_messageframe(false);
       }
-   };
+    };
 
 
   this.msglist_dbl_click = function(list)
     {
+      if (this.preview_timer)
+        clearTimeout(this.preview_timer);
+
     var uid = list.get_single_selection();
     if (uid && this.env.mailbox == this.env.drafts_mailbox)
       this.goto_url('compose', '_draft_uid='+uid+'&_mbox='+urlencode(this.env.mailbox), true);
     else if (uid)
-      this.show_message(uid);
+      this.show_message(uid, false, false);
     };
 
 
@@ -1061,6 +1105,15 @@
     };
 
 
+  this.msglist_get_preview = function()
+  {
+    var uid = this.get_single_uid();
+    if (uid && this.env.contentframe)
+      this.show_message(uid, false, true);
+    else if (this.env.contentframe)
+      this.show_messageframe(false);
+  };
+
 
   /*********************************************************/
   /*********     (message) list functionality      *********/
@@ -1068,11 +1121,12 @@
 
 
   // when user doble-clicks on a row
-  this.show_message = function(id, safe)
+  this.show_message = function(id, safe, preview)
     {
     var add_url = '';
+    var action = preview ? 'preview': 'show';
     var target = window;
-    if (this.env.contentframe && window.frames && window.frames[this.env.contentframe])
+    if (preview && this.env.contentframe && window.frames && window.frames[this.env.contentframe])
       {
       target = window.frames[this.env.contentframe];
       add_url = '&_framed=1';
@@ -1083,11 +1137,31 @@
 
     if (id)
       {
-      this.set_busy(true, 'loading');
-      target.location.href = this.env.comm_path+'&_action=show&_uid='+id+'&_mbox='+urlencode(this.env.mailbox)+add_url;
+      var url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.env.mailbox)+add_url;
+      if (action == 'preview' && String(target.location.href).indexOf(url) >= 0)
+        this.show_messageframe(true);
+      else
+        {
+        this.set_busy(true, 'loading');
+        target.location.href = this.env.comm_path+url;
+        }
       }
     };
 
+
+  this.show_messageframe = function(show)
+    {
+    var frm;
+    if (this.env.contentframe && (frm = rcube_find_object(this.env.contentframe)))
+      {
+      if (window.frames[this.env.contentframe] && !show)
+        window.frames[this.env.contentframe].location.href = 'program/blank.gif';
+      frm.style.display = show ? 'block' : 'none';
+      }
+      
+    if (!show && this.busy)
+      this.set_busy(false);
+    };
 
 
   // list a specific page
@@ -1095,8 +1169,12 @@
     {
     if (page=='next')
       page = this.env.current_page+1;
+    if (page=='last')
+      page = this.env.pagecount;
     if (page=='prev' && this.env.current_page>1)
       page = this.env.current_page-1;
+    if (page=='first' && this.env.current_page>1)
+      page = 1;
       
     if (page > 0 && page <= this.env.pagecount)
       {
@@ -1314,7 +1392,14 @@
 
     // if there is a trash mailbox defined and we're not currently in it:
     if (this.env.trash_mailbox && String(this.env.mailbox).toLowerCase()!=String(this.env.trash_mailbox).toLowerCase())
-      this.move_messages(this.env.trash_mailbox);
+      // if shift was pressed delete it immediately
+      if (this.message_list && this.message_list.shiftkey)
+        {
+        if (confirm(this.get_label('deletemessagesconfirm')))
+          this.permanently_remove_messages();
+        }
+      else
+        this.move_messages(this.env.trash_mailbox);
     // if there is a trash mailbox defined but we *are* in it:
     else if (this.env.trash_mailbox && String(this.env.mailbox).toLowerCase() == String(this.env.trash_mailbox).toLowerCase())
       this.permanently_remove_messages();
@@ -1338,7 +1423,7 @@
   this.mark_message = function(flag, uid)
     {
     var a_uids = new Array();
-    var selection = this.message_list.get_selection();
+    var selection = this.message_list ? this.message_list.get_selection() : new Array();
     
     if (uid)
       a_uids[0] = uid;
@@ -1350,9 +1435,14 @@
       for (var n=0; n<selection.length; n++)
         {
         id = selection[n];
-        a_uids[a_uids.length] = id;
+        if ((flag=='read' && this.message_list.rows[id].unread) || (flag=='unread' && !this.message_list.rows[id].unread))
+          a_uids[a_uids.length] = id;
         }
       }
+    
+    // nothing to do
+    if (!a_uids.length)
+      return;
       
     switch (flag)
       {
@@ -1630,50 +1720,54 @@
       if (this.env.identity && this.env.signatures && this.env.signatures[this.env.identity])
         {
         sig = this.env.signatures[this.env.identity]['text'];
-        if (sig.indexOf('--')!=0)
-          sig = '--\n'+sig;
-  
+        if (sig.indexOf('-- ')!=0)
+          sig = '-- \n'+sig;
+
         p = message.lastIndexOf(sig);
         if (p>=0)
           message = message.substring(0, p-1) + message.substring(p+sig.length, message.length);
         }
-  
+
       // add the new signature string
       if (this.env.signatures && this.env.signatures[id])
         {
         sig = this.env.signatures[id]['text'];
-        if (sig.indexOf('--')!=0)
-          sig = '--\n'+sig;
+        if (this.env.signatures[id]['is_html'])
+          {
+          sig = this.env.signatures[id]['plain_text'];
+          }
+        if (sig.indexOf('-- ')!=0)
+          sig = '-- \n'+sig;
         message += '\n'+sig;
         }
       }
     else
       {
-        var eid = tinyMCE.getEditorId('_message');
-        // editor is a TinyMCE_Control object
-        var editor = tinyMCE.getInstanceById(eid);
-        var msgDoc = editor.getDoc();
-        var msgBody = msgDoc.body;
+      var eid = tinyMCE.getEditorId('_message');
+      // editor is a TinyMCE_Control object
+      var editor = tinyMCE.getInstanceById(eid);
+      var msgDoc = editor.getDoc();
+      var msgBody = msgDoc.body;
 
-        if (this.env.signatures && this.env.signatures[id])
+      if (this.env.signatures && this.env.signatures[id])
+        {
+        // Append the signature as a span within the body
+        var sigElem = msgDoc.getElementById("_rc_sig");
+        if (!sigElem)
           {
-          // Append the signature as a span within the body
-          var sigElem = msgDoc.getElementById("_rc_sig");
-          if (!sigElem)
-            {
-            sigElem = msgDoc.createElement("span");
-            sigElem.setAttribute("id", "_rc_sig");
-            msgBody.appendChild(sigElem);
-            }
-          if (this.env.signatures[id]['is_html'])
-            {
-            sigElem.innerHTML = this.env.signatures[id]['text'];
-            }
-          else
-            {
-            sigElem.innerHTML = '<pre>' + this.env.signatures[id]['text'] + '</pre>';
-            }
+          sigElem = msgDoc.createElement("span");
+          sigElem.setAttribute("id", "_rc_sig");
+          msgBody.appendChild(sigElem);
           }
+        if (this.env.signatures[id]['is_html'])
+          {
+          sigElem.innerHTML = this.env.signatures[id]['text'];
+          }
+        else
+          {
+          sigElem.innerHTML = '<pre>' + this.env.signatures[id]['text'] + '</pre>';
+          }
+        }
       }
 
     if (input_message)
@@ -2634,7 +2728,9 @@
   this.set_page_buttons = function()
     {
     this.enable_command('nextpage', (this.env.pagecount > this.env.current_page));
+    this.enable_command('lastpage', (this.env.pagecount > this.env.current_page));
     this.enable_command('previouspage', (this.env.current_page > 1));
+    this.enable_command('firstpage', (this.env.current_page > 1));
     }
 
 
@@ -3065,7 +3161,7 @@
   this.http_request = function(action, querystring, lock)
     {
     var request_obj = this.get_request_obj();
-    querystring += '&_remote=1';
+    querystring += (querystring ? '&' : '') + '_remote=1';
     
     // add timestamp to request url to avoid cacheing problems in Safari
     if (bw.safari)
@@ -3114,11 +3210,13 @@
       case 'moveto':
         if (this.env.action=='show')
           this.command('list');
+        else if (this.message_list)
+          this.message_list.init();
         break;
 
       case 'list':
         if (this.env.messagecount)
-          this.enable_command('purge', (this.env.mailbox==this.env.trash_mailbox));
+          this.enable_command('purge', (this.env.mailbox==this.env.trash_mailbox || this.env.mailbox==this.env.junk_mailbox));
 
       case 'expunge':
         this.enable_command('select-all', 'select-none', 'expunge', this.env.messagecount ? true : false);

--
Gitblit v1.9.1