Warn user about mail quota limit if it's 99% full and freespace is less than 50 mb

This commit is contained in:
Hadi Nategh 2017-03-13 10:49:32 +01:00
parent 211e60b45d
commit aaf3492588
2 changed files with 15 additions and 12 deletions

View File

@ -2453,20 +2453,21 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
/**
* gather Info on how to display the quota info
*
* @param int $_usage
* @param int $_limit
* @param int $_usage amount of usage in Kb
* @param int $_limit amount of limit in Kb
* @return array returns an array of info used for quota
* array(
* class => string,
* text => string,
* $percent=> string
* percent => string,
* freespace => integer
* )
*/
function quotaDisplay($_usage, $_limit)
{
$percent = $_limit == 0 ? 100 : round(($_usage*100)/$_limit);
$limit=Mail::show_readable_size($_limit*1024);
$usage=Mail::show_readable_size($_usage*1024);
$limit = Mail::show_readable_size($_limit*1024);
$usage = Mail::show_readable_size($_usage*1024);
if ($_limit > 0)
{
@ -2491,7 +2492,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
return array (
'class' => $class,
'text' => lang('Quota: %1',$text),
'percent' => $percent
'percent' => $percent,
'freespace' => $_limit*1024 - $_usage*1024
);
}
@ -4483,7 +4485,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
'quotainpercent' => (string)$quotainfo['percent'],
'quotaclass' => $quotainfo['class'],
'quotanotsupported' => "",
'profileid' => $icServerID
'profileid' => $icServerID,
'quotawarning' => ($quotainfo['freespace']/pow(1024, 2)) < 50 && $quotainfo['percent'] >= 99 ? true : false
);
}
else

View File

@ -1232,7 +1232,7 @@ app.classes.mail = AppJS.extend(
quotabox.set_class(_data.data.quotaclass);
quotabox.set_value(_data.data.quotainpercent);
quotabox.set_label(_data.data.quota);
if (parseInt(_data.data.quotainpercent) >= 99)
if (_data.data.quotawarning)
{
var self = this;
var buttons = [
@ -1248,7 +1248,7 @@ app.classes.mail = AppJS.extend(
}
return;
},
this.egw.lang("Your mail quota is %%1 full, you may not be able to send/receive further emails.\r\n"+
this.egw.lang("Your mail quota is %1% full, you may not be able to send/receive further emails.\r\n"+
"Although cleaning up emails in trash or junk folder might help you to get some free space back.\r\n"+
"If that didn't help, please ask administrator for more quota.", _data.data.quotainpercent),
this.egw.lang("Mail cleanup"),