From 111acf180dfacf7f049d4d7b6f93b79560f51fc4 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 28 Oct 2012 08:35:09 -0400
Subject: [PATCH] Fix error in IE<8

---
 program/js/app.js |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 7e55a33..1aa0082 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -575,7 +575,7 @@
           var prevstate = this.env.compose_extwin;
           $("input[name='_action']", this.gui_objects.messageform).val('compose');
           this.gui_objects.messageform.action = this.url('mail/compose', { _id: this.env.compose_id, _extwin: 1 });
-          this.gui_objects.messageform.target = this.open_window('about:blank', 1150, 900);
+          this.gui_objects.messageform.target = this.open_window('', 1150, 900);
           this.gui_objects.messageform.submit();
         }
         else {
@@ -615,12 +615,11 @@
         break;
 
       case 'sort':
-        var sort_order, sort_col = props;
+        var sort_order = this.env.sort_order,
+          sort_col = !this.env.disabled_sort_col ? props : this.env.sort_col;
 
-        if (this.env.sort_col==sort_col)
-          sort_order = this.env.sort_order=='ASC' ? 'DESC' : 'ASC';
-        else
-          sort_order = 'ASC';
+        if (!this.env.disabled_sort_order)
+          sort_order = this.env.sort_col == sort_col && sort_order == 'ASC' ? 'DESC' : 'ASC';
 
         // set table header and update env
         this.set_list_sorting(sort_col, sort_order);
@@ -913,7 +912,7 @@
             }
 
             if (a_cids.length)
-              this.http_post('mailto', { _cid: a_cids.join(','), _source: this.env.source, }, true);
+              this.http_post('mailto', { _cid: a_cids.join(','), _source: this.env.source }, true);
             else if (this.env.group)
               this.http_post('mailto', { _gid: this.env.group, _source: this.env.source }, true);
 
@@ -1672,8 +1671,15 @@
       t = Math.max(0, (screen.height - h) / 2 + (screen.top || 0) - 20);
 
     var wname = 'rcmextwin' + new Date().getTime(),
-      extwin = window.open(url + '&_extwin=1', wname, 'width='+w+',height='+h+',top='+t+',left='+l);
+      extwin = window.open(url + '&_extwin=1', wname, 'width='+w+',height='+h+',top='+t+',left='+l+',resizable=yes,toolbar=no,status=no');
     extwin.moveTo(l,t);
+
+    // write loading... message to empty windows
+    if (!url && extwin.document) {
+      extwin.document.write('<html><body>' + this.get_label('loading') + '</body></html>');
+    }
+
+    // focus window, delayed to bring to front
     window.setTimeout(function(){ extwin.focus(); }, 10);
 
     return wname;
@@ -3030,9 +3036,9 @@
       ac_fields = ['cc', 'bcc', 'replyto', 'followupto'],
       ac_props;
 
-    // copy contents from opener (after opening in a new window)
+    // close compose step in opener
     if (window.opener && opener.rcmail && opener.rcmail.env.action == 'compose') {
-      //opener.history.back();
+      setTimeout(function(){ opener.history.back(); }, 100);
     }
 
     // configure parallel autocompletion
@@ -5799,13 +5805,11 @@
         col = this.env.coltypes[n];
         if ((cell = thead.rows[0].cells[n]) && (col == 'from' || col == 'to' || col == 'fromto')) {
           cell.id = 'rcm'+col;
+          $('span,a', cell).text(this.get_label(col == 'fromto' ? smart_col : col));
           // if we have links for sorting, it's a bit more complicated...
-          if (cell.firstChild && cell.firstChild.tagName.toLowerCase()=='a') {
-            cell = cell.firstChild;
-            cell.onclick = function(){ return rcmail.command('sort', this.__col, this); };
-            cell.__col = col;
-          }
-          cell.innerHTML = this.get_label(col == 'fromto' ? smart_col : col);
+          $('a', cell).click(function(){
+            return rcmail.command('sort', this.id.replace(/^rcm/, ''), this);
+          });
         }
       }
     }

--
Gitblit v1.9.1