From a2e81736a91f72c8688e6ab0f45061369614dae3 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sat, 19 Jun 2010 13:46:11 -0400
Subject: [PATCH] - Move quota indicator to mailboxlist footer - Fix groupcontrols on IE6 (use gif)

---
 skins/default/common.css                    |    4 +-
 skins/default/templates/mail.html           |   14 +++---
 skins/default/ie6hacks.css                  |   12 ++++++
 skins/default/mail.css                      |   15 ++++---
 program/steps/mail/func.inc                 |   51 +++++++++++--------------
 skins/default/images/icons/groupactions.gif |    0 
 skins/default/images/quota.gif              |    0 
 program/js/app.js                           |    7 +++
 8 files changed, 58 insertions(+), 45 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 37bec82..3b5b727 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4674,7 +4674,7 @@
   this.set_quota = function(content)
   {
     if (content && this.gui_objects.quotadisplay) {
-      if (typeof(content) == 'object')
+      if (typeof(content) == 'object' && content.type == 'image')
         this.percent_indicator(this.gui_objects.quotadisplay, content);
       else
         $(this.gui_objects.quotadisplay).html(content);
@@ -4834,6 +4834,9 @@
       quota = 100; 
     }
 
+    if (data.title)
+      data.title = this.get_label('quota') + ': ' +  data.title;
+
     // main div
     var main = $('<div>');
     main.css({position: 'absolute', top: pos.top, left: pos.left,
@@ -4864,6 +4867,8 @@
 
     // replace quota image
     $(obj).html('').append(bar1).append(bar2).append(main);
+    // update #quotaimg title
+    $('#quotaimg').attr('title', data.title);
   };
 
   /********************************************************/
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 1614f4c..805f0af 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -130,7 +130,7 @@
 
   if (!$OUTPUT->ajax_call)
     $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash',
-      'movingmessage', 'copyingmessage', 'copy', 'move');
+      'movingmessage', 'copyingmessage', 'copy', 'move', 'quota');
 
   $OUTPUT->set_pagetitle(rcmail_localize_foldername($mbox_name));
   }
@@ -449,13 +449,10 @@
 
   $quota = rcmail_quota_content($attrib);
 
-  if (is_array($quota)) {
-    $OUTPUT->add_script('$(document).ready(function(){
+  $OUTPUT->add_script('$(document).ready(function(){
 	rcmail.set_quota('.json_serialize($quota).')});', 'foot');
-    $quota = '';
-    }
 
-  return html::span($attrib, $quota);
+  return html::span($attrib, '');
   }
 
 
@@ -463,39 +460,37 @@
   {
   global $COMM_PATH, $RCMAIL;
 
-  $display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
-
   $quota = $RCMAIL->imap->get_quota();
   $quota = $RCMAIL->plugins->exec_hook('quota', $quota);
 
-  if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited'))
-    return rcube_label('unlimited');
+  $quota_result = (array) $quota;
+  $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
 
-  if ($quota['total'])
-    {
+  if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited')) {
+    $quota_result['title'] = rcube_label('unlimited');
+    $quota_result['percent'] = 0;
+    }
+  else if ($quota['total']) {
     if (!isset($quota['percent']))
-      $quota['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
+      $quota_result['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
 
-    $quota_result = sprintf('%s / %s (%.0f%%)',
+    $title = sprintf('%s / %s (%.0f%%)',
         show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024),
-        $quota['percent']);
+        $quota_result['percent']);
 
-    if ($display == 'image') {
-      $quota_result = array(
-    	'percent' 	=> $quota['percent'],
-        'title'		=> $quota_result,
-	  );
+    $quota_result['title'] = $title;
 
-      if ($attrib['width'])
-        $quota_result['width'] = $attrib['width'];
-      if ($attrib['height'])
-        $quota_result['height']	= $attrib['height'];
-      }
-
-      return $quota_result;
+    if ($attrib['width'])
+      $quota_result['width'] = $attrib['width'];
+    if ($attrib['height'])
+      $quota_result['height']	= $attrib['height'];
+    }
+  else {
+    $quota_result['title'] = rcube_label('unknown');
+    $quota_result['percent'] = 0;
     }
 
-  return rcube_label('unknown');
+  return $quota_result;
   }
 
 
diff --git a/skins/default/common.css b/skins/default/common.css
index 881160f..f3af5f1 100644
--- a/skins/default/common.css
+++ b/skins/default/common.css
@@ -286,7 +286,7 @@
   overflow: hidden;
   height: 22px;
   border-top: 1px solid #999;
-  background: url('images/listheader.gif') top left repeat-x #CCC;
+  background: url(images/listheader.gif) top left repeat-x #CCC;
 }
 
 .boxfooter a.button,
@@ -299,7 +299,7 @@
   padding: 0px;
   margin: 0;
   overflow: hidden;
-  background: url('images/icons/groupactions.png') 0 0 no-repeat transparent;
+  background: url(images/icons/groupactions.png) 0 0 no-repeat transparent;
   opacity: 0.99; /* this is needed to make buttons appear correctly in Chrome */
 }
 
diff --git a/skins/default/ie6hacks.css b/skins/default/ie6hacks.css
index 9fa3eb8..f1d74e6 100644
--- a/skins/default/ie6hacks.css
+++ b/skins/default/ie6hacks.css
@@ -49,6 +49,18 @@
   padding-right: 10px;
 }
 
+.boxfooter a.button,
+.boxfooter a.buttonPas
+{
+  background-image: url(images/icons/groupactions.gif);
+}
+
+.pagenav a.button,
+.pagenav a.buttonPas
+{
+  background-image: url(images/pagenav.gif);
+}
+
 #listcontrols a.button,
 #listcontrols a.buttonPas {
   background-image: url(images/mail_footer.gif);
diff --git a/skins/default/images/icons/groupactions.gif b/skins/default/images/icons/groupactions.gif
new file mode 100644
index 0000000..1564904
--- /dev/null
+++ b/skins/default/images/icons/groupactions.gif
Binary files differ
diff --git a/skins/default/images/quota.gif b/skins/default/images/quota.gif
new file mode 100644
index 0000000..9896d4c
--- /dev/null
+++ b/skins/default/images/quota.gif
Binary files differ
diff --git a/skins/default/mail.css b/skins/default/mail.css
index fae7a82..70770a5 100644
--- a/skins/default/mail.css
+++ b/skins/default/mail.css
@@ -373,16 +373,17 @@
 #quota
 {
   position: absolute;
-  bottom: 12px;
-  left: 20px;
+  top: 3px;
+  right: 8px;
+  width: 100px;
 }
 
-#quota span
+#quotaimg
 {
-  display: block;
-  float: left;
-  font-size: 11px;
-  color: #666;
+  position: absolute;
+  top: 3px;
+  right: 6px;
+  z-index: 101;
 }
 
 
diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html
index 75acbcd..2a150dd 100644
--- a/skins/default/templates/mail.html
+++ b/skins/default/templates/mail.html
@@ -33,6 +33,13 @@
 <div class="boxfooter">
   <!--<roundcube:button name="togglequota" type="link" title="showquota" class="buttonPas showinfo" classAct="button showinfo" onclick="rcmail_ui.toggle_quotadisplay();return false" content=" " />-->
   <roundcube:button name="mboxactions" id="mboxactionslink" type="link" title="folderactions" class="button groupactions" onclick="rcmail_ui.show_mailboxmenu();return false" content=" " />
+
+<roundcube:if condition="env:quota" />
+<img id="quotaimg" src="/images/quota.gif" alt="" />
+<div id="quota">
+  <roundcube:object name="quotaDisplay" display="image" width="100" height="14" id="quotadisplay" />
+</div>
+<roundcube:endif />
 </div>
 </div>
 
@@ -214,13 +221,6 @@
   <roundcube:button command="menu-save" id="listmenusave" type="input" class="button mainaction" label="save" />
 </div>
 </div>
-
-<roundcube:if condition="env:quota" />
-<div id="quota">
-  <span style="margin-right: 5px"><roundcube:label name="quota" />:</span>
-  <roundcube:object name="quotaDisplay" display="image" width="100" height="14" id="quotadisplay" />
-</div>
-<roundcube:endif />
 
 <div id="rcmversion"><roundcube:object name="productname" /> <roundcube:object name="version" /></div>
 

--
Gitblit v1.9.1