[imp] Quota Display Tweak

David Collins davidpcollins at yahoo.com
Fri Feb 21 06:03:02 PST 2003


I found this on the mailing list a while back (don't
remember the original author, sorry).  Tweaked a
little of course.  I know it has a few glitches in it
but works fairly well.

David


if (!function_exists('imp_show_quota')) {
    function imp_show_quota ($imp) {
         $user=$imp['user'];
         $command="/bin/awk '$1 == \"".$user."\" && $5
!= 0' /var/tmp/quota.info";
         // print "Command = " . $command;
         $junk = exec($command,$quota_data,
$return_code);
         if ($return_code == 0 && count($quota_data)
== 1) {
                $fields = split("[[:blank:]]+",
trim($quota_data[0]));

             $taken   = $fields[2] / 1000.0;
             $total   = $fields[4] / 1000.0;
             $percent = $taken * 100 / $total;
             if ($percent >= 90) {
                 $color = '#FF9900';
             } elseif ($percent >= 75) {
                 $color = '#FCE30D';
             } else {
                 $color = '#339933';
             }

        $quota_html = '<table width="100%" border="0"
cellpadding="0" cellspacing="0"><tr>';
        $quota_html .= '<td align="right"
class="header" width="45%">';
        $quota_html .= sprintf("<font size=-2>Space
Used: %.1f%%</font>", $percent);
        $quota_html .= '</td><td width="55%"
class="header" align="left">';
        $quota_html .= '<table width="200"><tr><td
bgcolor="#ffffff" align="left">';
        $quota_html .= '<div style="height:6px;
width:'. sprintf("%.1f%%", $percent). ';
font-size:3px; background-color:'.$color.'">';
        $quota_html .= '</div></td></tr></table>';
        $quota_html .= '</td></tr></table>';

         return $quota_html;
         }
     }
 }

Zitat von Hammad <hammad at brisksolutions.com>:

> I was thinking of displaying quota usage information
in graphical format
> rather
> then just plain numbers. Has anyone already done
something like this?
> before I
> go start writing code for it. :)
>
> If so, any help or pointers will be appreciated.

There once was a patch for IMP that created the quota
bar an an image using
the gd extension. I even used this patch here but I
don't remember where it
was available.
I guess you'll have to dig through old mailing list
archives.

Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft

--
IMP mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: imp-unsubscribe at lists.horde.org


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


More information about the imp mailing list