Skip to content

Commit bba7938

Browse files
committed
Sum for quota usage
1 parent 8271e11 commit bba7938

File tree

6 files changed

+37
-5
lines changed

6 files changed

+37
-5
lines changed

interface/web/dashboard/dashlets/databasequota.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ function show($limit_to_client_id = null) {
3333
//print_r($databases);
3434

3535
$has_databasequota = false;
36+
$total_used = 0;
3637
if(is_array($databases) && !empty($databases)){
38+
foreach ($databases as &$db) {
39+
$total_used += $db['used_raw'] * 1000 * 1000;
40+
}
3741
$databases = $app->functions->htmlentities($databases);
3842
$tpl->setloop('databasequota', $databases);
3943
$has_databasequota = isset($databases[0]['used']);
4044
}
4145
$tpl->setVar('has_databasequota', $has_databasequota);
46+
$tpl->setVar('total_used', $app->functions->formatBytes($total_used, 0));
4247

4348
return $tpl->grab();
4449
}

interface/web/dashboard/dashlets/mailquota.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ function show($limit_to_client_id = null) {
2626
//print_r($emails);
2727

2828
$has_mailquota = false;
29+
$total_used = 0;
2930
if(is_array($emails) && !empty($emails)){
3031
foreach($emails as &$email) {
3132
$email['email'] = $app->functions->idn_decode($email['email']);
33+
$total_used += $email['used_raw'];
3234
}
3335
unset($email);
3436
// email username is quoted in quota.lib already, so no htmlentities here to prevent double encoding
@@ -37,6 +39,7 @@ function show($limit_to_client_id = null) {
3739
$has_mailquota = isset($emails[0]['used']);
3840
}
3941
$tpl->setVar('has_mailquota', $has_mailquota);
42+
$tpl->setVar('total_used', $app->functions->formatBytes($total_used, 0));
4043

4144
return $tpl->grab();
4245
}

interface/web/dashboard/dashlets/quota.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function show($limit_to_client_id = null) {
3838
foreach($sites as &$site) {
3939
$site['domain'] = $app->functions->idn_decode($site['domain']);
4040
$site['progressbar'] = $site['hd_quota'];
41+
$total_used += $site['used_raw'] * 1000;
4142
}
4243
unset($site);
4344

@@ -46,6 +47,7 @@ function show($limit_to_client_id = null) {
4647
$has_quota = isset($sites[0]['used']);
4748
}
4849
$tpl->setVar('has_quota', $has_quota);
50+
$tpl->setVar('total_used', $app->functions->formatBytes($total_used, 0));
4951

5052
return $tpl->grab();
5153

interface/web/dashboard/dashlets/templates/databasequota.htm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,12 @@
2424
</tr>
2525
</tmpl_loop>
2626
</tbody>
27-
</table>
28-
</div>
27+
<tfoot>
28+
<tr>
29+
<th>{tmpl_var name='total_txt'}</th>
30+
<th>{tmpl_var name='total_used'}</th>
31+
<th colspan="2"></th>
32+
</tr>
33+
<tfoot>
34+
</table>
35+
</div>

interface/web/dashboard/dashlets/templates/mailquota.htm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,13 @@
2626
</tr>
2727
</tmpl_loop>
2828
</tbody>
29+
<tfoot>
30+
<tr>
31+
<th></th>
32+
<th>{tmpl_var name='total_txt'}</th>
33+
<th>{tmpl_var name='total_used'}</th>
34+
<th colspan="2"></th>
35+
</tr>
36+
</tfoot>
2937
</table>
30-
</div>
38+
</div>

interface/web/dashboard/dashlets/templates/quota.htm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
</td>{tmpl_else}<td></td>{/tmpl_if}
3030
</tr>
3131
</tmpl_loop>
32-
</tbody>
32+
</tbody>
33+
<tfoot>
34+
<tr>
35+
<th>{tmpl_var name='total_txt'}</th>
36+
<th>{tmpl_var name='total_used'}</th>
37+
<th colspan="3"></th>
38+
</tr>
39+
</tfoot>
3340
</table>
34-
</div>
41+
</div>

0 commit comments

Comments
 (0)