I hammered this out today, just as a test. Need to refine and rewrite....
** Fixed error caused by quota output containing varying number of spaces as quota changes
** added comments for clarity
This is version 0.3.2
Basically, I am highjacking what is already there, pulling the username from roundcube, doing a quota query using the shell and returning the results back to roundcube.
1. Open 'program/steps/mail/func.inc
2. replace rcmail_quota_content function with the following:
Code:
function rcmail_quota_content($attrib)
{
global $RCMAIL;
#get user name from roundcube
$temp = $RCMAIL->user->get_username();
$tempboom = explode ('@', $temp);
$qusern=$tempboom[0];
#run quota on user name
$output= shell_exec("/usr/bin/quota " . $qusern);
# remove consecutive spaces
$output = ereg_replace("[ \t\n\r]+", " ", $output);
#split apart
$parts = explode(" ",$output);
#calculate
$out = 35 - round(($parts[17] * 1024)/1048576);
$quota_result = $out . "MB";
return $quota_result;
}
Note: I set all my user quotas to 35M, change this to reflect your needs or remove to show usage.
3. Open /skins/default/templates/main.html
4. look for <div id="listcontrols"> (should be around line 74)
change the last span to:
Code:
<span style="margin-left: 20px; margin-right: 5px">Storage Space Remaining:</span>
<roundcube:object name="quotaDisplay" id="quotadisplay" />
5. This needs to be cleaned up to be an actual option, maybe add a database query to get the actual user quota from either the database or from the results of the quota query.
6. Double check for typos, etc. if you need any help, send me a message.
NOTE: this is mainly a proof of concept, a starting point. I am using this on a production machine, but it has very low volume of users.
Anyone that can help continue, please please do.
Recent comments
17 hours 48 min ago
17 hours 53 min ago
22 hours 52 min ago
1 day 5 hours ago
1 day 6 hours ago
1 day 7 hours ago
1 day 11 hours ago
1 day 18 hours ago
1 day 22 hours ago
2 days 3 min ago