From a9251be2f09fb5f18a85d201c67668c70980efe3 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 20 Apr 2011 15:11:10 -0400
Subject: [PATCH] Update to TinyMCE 3.4.2 to fix errors in IE9

---
 program/js/app.js |  143 +++++++++++++++++++++++++++++++----------------
 1 files changed, 93 insertions(+), 50 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index fe0a75a..8cdddcc 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1006,15 +1006,9 @@
 
       // user settings commands
       case 'preferences':
-        this.goto_url('');
-        break;
-
       case 'identities':
-        this.goto_url('settings/identities');
-        break;
-
       case 'folders':
-        this.goto_url('settings/folders');
+        this.goto_url('settings/' + command);
         break;
 
       // unified command call (command name == function name)
@@ -1701,7 +1695,7 @@
       var action = flags.mbox == this.env.drafts_mailbox ? 'compose' : 'show';
       var uid_param = flags.mbox == this.env.drafts_mailbox ? '_draft_uid' : '_uid';
       cols.subject = '<a href="./?_task=mail&_action='+action+'&_mbox='+urlencode(flags.mbox)+'&'+uid_param+'='+uid+'"'+
-        ' onclick="return rcube_event.cancel(event)">'+cols.subject+'</a>';
+        ' onclick="return rcube_event.cancel(event)" onmouseover="rcube_webmail.long_subject_title(this,'+(message.depth+1)+')">'+cols.subject+'</a>';
     }
 
     // add each submitted col
@@ -1917,7 +1911,7 @@
     var url = '', target = window;
 
     if (!mbox)
-      mbox = this.env.mailbox;
+      mbox = this.env.mailbox ? this.env.mailbox : 'INBOX';
 
     if (add_url)
       url += add_url;
@@ -3000,11 +2994,11 @@
   this.compose_field_hash = function(save)
   {
     // check input fields
-    var value_to = $("[name='_to']").val();
-    var value_cc = $("[name='_cc']").val();
-    var value_bcc = $("[name='_bcc']").val();
-    var value_subject = $("[name='_subject']").val();
-    var str = '';
+    var ed, str = '',
+      value_to = $("[name='_to']").val(),
+      value_cc = $("[name='_cc']").val(),
+      value_bcc = $("[name='_bcc']").val(),
+      value_subject = $("[name='_subject']").val();
 
     if (value_to)
       str += value_to+':';
@@ -3015,9 +3009,8 @@
     if (value_subject)
       str += value_subject+':';
 
-    var editor = tinyMCE.get(this.env.composebody);
-    if (editor)
-      str += editor.getContent();
+    if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)))
+      str += ed.getContent();
     else
       str += $("[name='_message']").val();
 
@@ -3777,6 +3770,9 @@
         this.show_contentframe(false);
     }
 
+    if (this.env.group)
+      qs += '&_gid='+urlencode(this.env.group);
+
     // also send search request to get the right records from the next page
     if (this.env.search_request) 
       qs += '&_search='+this.env.search_request;
@@ -4309,6 +4305,14 @@
     }
   };
 
+  // disables subscription checkbox (for protected folder)
+  this.disable_subscription = function(folder)
+  {
+    var id = this.get_folder_row_id(folder);
+    if (id)
+      $('input[name="_subscribed[]"]', $('#'+id)).attr('disabled', true);
+  };
+
   this.folder_size = function(folder)
   {
     var lock = this.set_busy(true, 'loading');
@@ -4521,35 +4525,48 @@
     type = type ? type : 'notice';
 
     var ref = this,
+      key = msg,
       date = new Date(),
       id = type + date.getTime(),
-      timeout = type == 'loading' ? this.env.request_timeout * 1000 : (this.message_time * (type == 'error' || type == 'warning' ? 2 : 1));
-
-    if (type == 'loading' && !msg)
-      msg = this.get_label('loading');
+      timeout = this.message_time * (type == 'error' || type == 'warning' ? 2 : 1);
+      
+    if (type == 'loading') {
+      key = 'loading';
+      timeout = this.env.request_timeout * 1000;
+      if (!msg)
+        msg = this.get_label('loading');
+    }
 
     // The same message is already displayed
-    if (this.messages[msg]) {
-      this.messages[msg].elements.push(id);
-      window.setTimeout(function() { ref.hide_message(id, true); }, timeout);
+    if (this.messages[key]) {
+      // replace label
+      if (this.messages[key].obj)
+        this.messages[key].obj.html(msg);
+      // store label in stack
+      if (type == 'loading') {
+        this.messages[key].labels.push({'id': id, 'msg': msg});
+      }
+      // add element and set timeout
+      this.messages[key].elements.push(id);
+      window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
       return id;
     }
 
-    var obj = $('<div>').addClass(type).html(msg).data('msg', msg),
-      cont = $(this.gui_objects.message).show();
+    // create DOM object and display it
+    var obj = $('<div>').addClass(type).html(msg).data('key', key),
+      cont = $(this.gui_objects.message).append(obj).show();
+
+    this.messages[key] = {'obj': obj, 'elements': [id]};
 
     if (type == 'loading') {
-      obj.appendTo(cont);
-      this.messages[msg] = {'obj': obj, 'elements': [id]};
-      window.setTimeout(function() { rcmail.hide_message(id); }, timeout);
-      return id;
+      this.messages[key].labels = [{'id': id, 'msg': msg}];
     }
     else {
-      obj.appendTo(cont).bind('mousedown', function() { return ref.hide_message(obj, true); });
-      window.setTimeout(function() { ref.hide_message(id, true); }, timeout);
-      this.messages[msg] = { 'obj': obj, 'elements': [id] };
-      return id;
+      obj.click(function() { return ref.hide_message(obj); });
     }
+
+    window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
+    return id;
   };
 
   // make a message to disapear
@@ -4559,25 +4576,37 @@
     if (this.is_framed())
       return parent.rcmail.hide_message(obj, fade);
 
+    var k, n, i, msg, m = this.messages;
+
+    // Hide message by object, don't use for 'loading'!
     if (typeof(obj) == 'object') {
-      // hide message object
       $(obj)[fade?'fadeOut':'hide']();
-      
-      var msg = $(obj).data('msg');
+      msg = $(obj).data('key');
       if (this.messages[msg])
         delete this.messages[msg];
     }
+    // Hide message by id
     else {
-      // hide message by id
-      var k, n, m = this.messages;
       for (k in m) {
         for (n in m[k].elements) {
           if (m[k] && m[k].elements[n] == obj) {
             m[k].elements.splice(n, 1);
-            // hide dom element if last instance is removed
+            // hide DOM element if last instance is removed
             if (!m[k].elements.length) {
               m[k].obj[fade?'fadeOut':'hide']();
               delete m[k];
+            }
+            // set pending action label for 'loading' message
+            else if (k == 'loading') {
+              for (i in m[k].labels) {
+                if (m[k].labels[i].id == obj) {
+                  delete m[k].labels[i];
+                }
+                else {
+                  msg = m[k].labels[i].msg;
+                }
+                m[k].obj.html(msg);
+              }
             }
           }
         }
@@ -4592,7 +4621,7 @@
       var current_li, target_li;
 
       if ((current_li = this.get_folder_li(old, prefix))) {
-        $(current_li).removeClass('selected').removeClass('unfocused');
+        $(current_li).removeClass('selected').addClass('unfocused');
       }
       if ((target_li = this.get_folder_li(name, prefix))) {
         $(target_li).removeClass('unfocused').addClass('selected');
@@ -4621,17 +4650,18 @@
   // and for setting some message list global variables
   this.set_message_coltypes = function(coltypes, repl)
   {
-    this.env.coltypes = coltypes;
+    var list = this.message_list,
+      thead = list ? list.list.tHead : null,
+      cell, col, n, len, th, tr;
 
-    // set correct list titles
-    var thead = this.gui_objects.messagelist ? this.gui_objects.messagelist.tHead : null,
-      cell, col, n, len;
+    this.env.coltypes = coltypes;
 
     // replace old column headers
     if (thead) {
       if (repl) {
-        var th = document.createElement('thead'),
-          tr = document.createElement('tr');
+        th = document.createElement('thead');
+        tr = document.createElement('tr');
+
         for (c=0, len=repl.length; c < len; c++) {
           cell = document.createElement('td');
           cell.innerHTML = repl[c].html;
@@ -4641,6 +4671,7 @@
         }
         th.appendChild(tr);
         thead.parentNode.replaceChild(th, thead);
+        thead = th;
       }
 
       for (n=0, len=this.env.coltypes.length; n<len; n++) {
@@ -4664,15 +4695,16 @@
 
     if ((n = $.inArray('subject', this.env.coltypes)) >= 0) {
       this.set_env('subject_col', n);
-      if (this.message_list)
-        this.message_list.subject_col = n;
+      if (list)
+        list.subject_col = n;
     }
     if ((n = $.inArray('flag', this.env.coltypes)) >= 0)
       this.set_env('flagged_col', n);
     if ((n = $.inArray('status', this.env.coltypes)) >= 0)
       this.set_env('status_col', n);
 
-    this.message_list.init_header();
+    if (list)
+      list.init_header();
   };
 
   // replace content of row count display
@@ -5263,6 +5295,17 @@
 
 }  // end object rcube_webmail
 
+
+// some static methods
+rcube_webmail.long_subject_title = function(elem, indent)
+{
+  if (!elem.title) {
+    var $elem = $(elem);
+    if ($elem.width() + indent * 15 > $elem.parent().width())
+      elem.title = $elem.html();
+  }
+};
+
 // copy event engine prototype
 rcube_webmail.prototype.addEventListener = rcube_event_engine.prototype.addEventListener;
 rcube_webmail.prototype.removeEventListener = rcube_event_engine.prototype.removeEventListener;

--
Gitblit v1.9.1