summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-09-12 16:48:23 +0000
committeralecpl <alec@alec.pl>2008-09-12 16:48:23 +0000
commit6cd00992a2c7de38e0ff7df152fba8ea89012dce (patch)
tree699eb407f8d52876a89d64a7c7659ab8aa8af153
parent85a9130647fff8ffafbd35117705f3ec7ec98ce0 (diff)
- Fixed quota img height/width setting from template (#1484857)
-rw-r--r--CHANGELOG1
-rw-r--r--bin/quotaimg.php2
-rw-r--r--program/steps/mail/func.inc19
-rw-r--r--skins/default/templates/mail.html2
4 files changed, 17 insertions, 7 deletions
diff --git a/CHANGELOG b/CHANGELOG
index cdb46a930..a82605e59 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@ CHANGELOG RoundCube Webmail
- Added vertical splitter for folders list resizing
- Added possibility to view all headers in message view
- Fixed splitter drag/resize on Opera (#1485170)
+- Fixed quota img height/width setting from template (#1484857)
2008/09/12 (thomasb)
----------
diff --git a/bin/quotaimg.php b/bin/quotaimg.php
index 354f4ebdb..97c8b8630 100644
--- a/bin/quotaimg.php
+++ b/bin/quotaimg.php
@@ -159,7 +159,7 @@ function genQuota($used, $total, $width, $height)
}
$quota_width = $quota / 100 * $width;
- imagefilledrectangle($im, $border, 0, $quota, $height-2*$border, $fill);
+ imagefilledrectangle($im, $border, 0, $quota_width, $height-2*$border, $fill);
$string = $quota . '%';
$mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1;
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 6a885a07c..6d23b6f8e 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -446,7 +446,7 @@ function rcmail_quota_display($attrib)
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'display'));
$out = '<span' . $attrib_str . '>';
- $out .= rcmail_quota_content();
+ $out .= rcmail_quota_content(NULL, $attrib);
$out .= '</span>';
return $out;
}
@@ -455,7 +455,7 @@ function rcmail_quota_display($attrib)
/**
*
*/
-function rcmail_quota_content($quota=NULL)
+function rcmail_quota_content($quota=NULL, $attrib=NULL)
{
global $IMAP, $COMM_PATH, $RCMAIL;
@@ -481,14 +481,23 @@ function rcmail_quota_content($quota=NULL)
// show quota as image (by Brett Patterson)
if ($display == 'image' && function_exists('imagegif'))
{
- $attrib = array('width' => 100, 'height' => 14);
+ if (!$attrib['width'])
+ $attrib['width'] = isset($_SESSION['quota_width']) ? $_SESSION['quota_width'] : 100;
+ else
+ $_SESSION['quota_width'] = $attrib['width'];
+
+ if (!$attrib['height'])
+ $attrib['height'] = isset($_SESSION['quota_height']) ? $_SESSION['quota_height'] : 14;
+ else
+ $_SESSION['quota_height'] = $attrib['height'];
+
$quota_text = sprintf('<img src="./bin/quotaimg.php?u=%s&amp;q=%d&amp;w=%d&amp;h=%d" width="%d" height="%d" alt="%s" title="%s / %s" />',
$quota['used'], $quota['total'],
$attrib['width'], $attrib['height'],
$attrib['width'], $attrib['height'],
$quota_text,
- show_bytes($quota["used"] * 1024),
- show_bytes($quota["total"] * 1024));
+ show_bytes($quota['used'] * 1024),
+ show_bytes($quota['total'] * 1024));
}
}
else
diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html
index 3d2068d91..935a7af23 100644
--- a/skins/default/templates/mail.html
+++ b/skins/default/templates/mail.html
@@ -109,7 +109,7 @@ body_keypress: function(evt, p)
<roundcube:button command="select-all" prop="unread" label="unread" classAct="active" />&nbsp;
<roundcube:button command="select-none" label="none" classAct="active" /> &nbsp;&nbsp;&nbsp;
<roundcube:if condition="env:quota" />
-<roundcube:label name="quota" />: <roundcube:object name="quotaDisplay" display="image" width="120" id="quotadisplay" />
+<roundcube:label name="quota" />: <roundcube:object name="quotaDisplay" display="image" width="100" id="quotadisplay" />
<roundcube:endif />
</div>