From ce06d32dd81e3a9c5c5c8a5e27562b5c55b49c81 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 17 Jun 2010 15:08:00 -0400
Subject: [PATCH] - UI unification  - Added button to hide/unhide the preview pane (#1484215)

---
 skins/default/functions.js |   52 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/skins/default/functions.js b/skins/default/functions.js
index e9b03a1..4ef069b 100644
--- a/skins/default/functions.js
+++ b/skins/default/functions.js
@@ -131,7 +131,8 @@
     messagemenu:'messagemenu',
     listmenu:'listmenu',
     dragmessagemenu:'dragmessagemenu',
-    groupmenu:'groupoptionsmenu'
+    groupmenu:'groupoptionsmenu',
+    mailboxmenu:'mailboxoptionsmenu'
   };
   
   var obj;
@@ -148,7 +149,7 @@
 {
   if (typeof show == 'undefined')
     show = obj.is(':visible') ? false : true;
-  
+
   var ref = rcube_find_object(refname);
   if (show && ref) {
     var pos = $(ref).offset();
@@ -171,6 +172,11 @@
 show_groupmenu: function(show)
 {
   this.show_popupmenu(this.groupmenu, 'groupactionslink', show, true);
+},
+
+show_mailboxmenu: function(show)
+{
+  this.show_popupmenu(this.mailboxmenu, 'mboxactionslink', show, true);
 },
 
 show_searchmenu: function(show)
@@ -214,7 +220,13 @@
 
   var ref = rcube_find_object('listmenulink');
   if (show && ref) {
-    var pos = $(ref).offset();
+    var pos = $(ref).offset(),
+      menuwidth = this.listmenu.width(),
+      pagewidth = $(document).width();
+
+    if (pagewidth - pos.left < menuwidth && pos.left > menuwidth)
+      pos.left = pos.left - menuwidth;
+
     this.listmenu.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)});
     // set form values
     $('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').attr('checked', 1);
@@ -283,6 +295,8 @@
     this.dragmessagemenu.hide();
   else if (this.groupmenu &&  this.groupmenu.is(':visible') && target != rcube_find_object('groupactionslink'))
     this.show_groupmenu(false);
+  else if (this.mailboxmenu &&  this.mailboxmenu.is(':visible') && target != rcube_find_object('mboxactionslink'))
+    this.show_mailboxmenu(false);
   else if (this.listmenu && this.listmenu.is(':visible') && target != rcube_find_object('listmenulink')) {
     var menu = rcube_find_object('listmenu');
     while (target.parentNode) {
@@ -311,6 +325,38 @@
         this[k].hide();
     }
   }
+},
+
+switch_preview_pane: function(elem)
+{
+  var uid, prev_frm = $('#mailpreviewframe');
+
+  if (elem.checked) {
+    rcmail.env.contentframe = 'messagecontframe';
+    if (mailviewsplit.layer) {
+      mailviewsplit.resize();
+      mailviewsplit.layer.elm.style.display = '';
+    } else
+      mailviewsplit.init();
+    prev_frm.show();
+    if (uid = rcmail.message_list.get_single_selection())
+      rcmail.show_message(uid, false, true);
+    rcmail.http_post('save-pref', '_name=preview_pane&_value=1');
+  } else {
+    prev_frm.hide();
+    if (bw.ie6 || bw.ie7) {
+      var fr = document.getElementById('mailcontframe');
+      fr.style.bottom = 0;
+      fr.style.height = parseInt(fr.parentNode.offsetHeight)+'px';  
+    }
+    else
+      $('#mailcontframe').css({height: 'auto', bottom: 0});
+    if (mailviewsplit.layer)
+      mailviewsplit.layer.elm.style.display = 'none';
+    rcmail.env.contentframe = null;
+    rcmail.show_contentframe(false);
+    rcmail.http_post('save-pref', '_name=preview_pane&_value=0');
+  }
 }
 
 };

--
Gitblit v1.9.1