[horde] quota display
Alex
aferreira at gaiajoy.com
Mon Jan 16 04:05:28 PST 2006
Hi there!
This is my imp/templates/quota/quota.inc with a courier IMAP setup, with the
latest stable versions of horde/imp.
However, for reasons unkwown to myself, when the quota bar is active, horde
somehow adds an extra html tag, resulting in a blank line between the menu
bar and the quota bar. Any thoughts?
I wonder if someone could consider putting this (or something alike) in the
IMP package in the future... jan?
Regards,
Alex
---------------cut here----------------
<?php
if (is_a($quota, 'PEAR_Error')) {
$class = 'quotawarn';
$message = $quota->getMessage();
} else {
$percent=0;
$color='';
if ($quota['limit'] != 0) {
$quota['usage'] = $quota['usage'] / (1024 * 1024.0);
$quota['limit'] = $quota['limit'] / (1024 * 1024.0);
$percent = ($quota['usage'] * 100) / $quota['limit'];
if ($percent >= 90) {
$class = 'quotaalert';
$color = '#FF0000';
} elseif ($percent >= 75) {
$class = 'quotawarn';
$color = '#FCE30D';
} else {
$class = 'control';
$color = '#339933';
}
$message = sprintf(_("Quota status: %.2fMB / %.2fMB (%.2f%%)"),
$quota['usage'], $quota['limit'], $percent);
} elseif ($quota['usage'] != 0) {
$quota['usage'] = $quota['usage'] / (1024 * 1024.0);
$class = 'control';
$message = sprintf(_("Quota status: %.2fMB / NO LIMIT"),
$quota['usage']);
} else {
$class = 'control';
$message = sprintf(_("Quota status: NO LIMIT"));
}
$message .= '</td><td width="30" class="header" align="right"><font
size="-3">0%</font></td><td width="200" class="header">';
$message .= '<table width="100%"><tr><td bgcolor="#ffffff"><div
style="height:6px; width:';
$message .= sprintf("%.0f%%", $percent). '; font-size:3px;
background-color:'.$color.'">';
$message .= '</div></td></tr></table></td><td width="30"
class="header" align="left"><font size="-3">100%</font>';
$message .= '</td></tr></table></td></tr></table>';
}
?>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr><td class="<?php echo $class ?>" align="center">
<?php echo $message ?>
</td></tr>
</table>
---------------cut here----------------
> -----Original Message-----
> From: horde-bounces at lists.horde.org [mailto:horde-bounces at lists.horde.org]
> On Behalf Of Vishwanath T. K.
> Sent: 16 January 2006 11:43
> To: horde at lists.horde.org
> Subject: [horde] quota display
>
> Hi all,
>
> I had posted this question in IMP list also, but did not receive any
> reply. I hope i will get some reply for this.
>
> I have setup IMP4 with cyrus imap. I have also successfully setup the
> quota driver in servers.php.
>
> I want to have the quota displayed as in the image attached. Can
> anyone tell me if this is possible to achieve in IMP4 and how to do
> it.
>
> I was going through the list archieve and saw references to similar
> successful implementations in older versions of IMP.
>
> Thanks in advance
>
> Vishy
More information about the horde
mailing list