diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcmail.php | 41 | ||||
-rw-r--r-- | program/localization/en_US/labels.inc | 5 |
2 files changed, 44 insertions, 2 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 29ed66a43..cfdd1816e 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1678,7 +1678,6 @@ class rcmail extends rcube $quota = $this->storage->get_quota(); $quota = $this->plugins->exec_hook('quota', $quota); - unset($quota['abort']); $quota_result = (array) $quota; $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : ''; @@ -1697,7 +1696,39 @@ class rcmail extends rcube $quota_result['width'] = $attrib['width']; } if ($attrib['height']) { - $quota_result['height'] = $attrib['height']; + $quota_result['height'] = $attrib['height']; + } + + // build a table of quota types/roots info + if (($root_cnt = count($quota_result['all'])) > 1 || count($quota_result['all'][key($quota_result['all'])]) > 1) { + $table = new html_table(array('cols' => 3, 'class' => 'quota-info')); + + $table->add_header(null, self::Q($this->gettext('quotatype'))); + $table->add_header(null, self::Q($this->gettext('quotatotal'))); + $table->add_header(null, self::Q($this->gettext('quotaused'))); + + foreach ($quota_result['all'] as $root => $data) { + if ($root_cnt > 1 && $root) { + $table->add(array('colspan' => 3, 'class' => 'root'), self::Q($root)); + } + + if ($storage = $data['storage']) { + $percent = min(100, round(($storage['used']/max(1,$storage['total']))*100)); + + $table->add('name', self::Q($this->gettext('quotastorage'))); + $table->add(null, $this->show_bytes($storage['total'] * 1024)); + $table->add(null, sprintf('%s (%.0f%%)', $this->show_bytes($storage['used'] * 1024), $percent)); + } + if ($message = $data['message']) { + $percent = min(100, round(($message['used']/max(1,$message['total']))*100)); + + $table->add('name', self::Q($this->gettext('quotamessage'))); + $table->add(null, intval($message['total'])); + $table->add(null, sprintf('%d (%.0f%%)', $message['used'], $percent)); + } + } + + $quota_result['table'] = $table->show(); } } else { @@ -1706,6 +1737,12 @@ class rcmail extends rcube $quota_result['percent'] = 0; } + // cleanup + unset($quota_result['abort']); + if (empty($quota_result['table'])) { + unset($quota_result['all']); + } + return $quota_result; } diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index ba8fe2e40..1e179cbcf 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -208,6 +208,11 @@ $labels['importmessages'] = 'Import messages'; $labels['quota'] = 'Disk usage'; $labels['unknown'] = 'unknown'; $labels['unlimited'] = 'unlimited'; +$labels['quotatype'] = 'Quota type'; +$labels['quotatotal'] = 'Limit'; +$labels['quotaused'] = 'Used'; +$labels['quotastorage'] = 'Disk space'; +$labels['quotamessage'] = 'Messages count'; $labels['quicksearch'] = 'Quick search'; $labels['resetsearch'] = 'Reset search'; |