Display full quota information in popup (#1485769, #1486604)
| | |
| | | CHANGELOG Roundcube Webmail |
| | | =========================== |
| | | |
| | | - Display full quota information in popup (#1485769, #1486604) |
| | | - Mail compose: Selecting contact inserts recipient to previously focused input - to/cc/bcc accordingly (#1489684) |
| | | - Add option to set default message list mode - default_list_mode (#1487312) |
| | | - Close "no subject" prompt with Enter key (#1489580) |
| | |
| | | $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'] : ''; |
| | | |
| | |
| | | if ($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 { |
| | | $unlimited = $this->config->get('quota_zero_as_unlimited'); |
| | |
| | | $quota_result['percent'] = 0; |
| | | } |
| | | |
| | | // cleanup |
| | | unset($quota_result['abort']); |
| | | if (empty($quota_result['table'])) { |
| | | unset($quota_result['all']); |
| | | } |
| | | |
| | | return $quota_result; |
| | | } |
| | | |
| | |
| | | $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'; |
| | |
| | | .quota_text_mid { color: #666; } |
| | | .quota_text_low { color: #666; } |
| | | |
| | | table.quota-info { |
| | | border-spacing: 0; |
| | | border-collapse: collapse; |
| | | table-layout: fixed; |
| | | margin: 2px; |
| | | } |
| | | |
| | | table.quota-info td, |
| | | table.quota-info th { |
| | | border: 1px solid #999; |
| | | padding: 2px 3px; |
| | | text-align: center; |
| | | min-width: 80px; |
| | | color: #333; |
| | | font-size: 11px; |
| | | } |
| | | |
| | | table.quota-info th { |
| | | font-weight: bold; |
| | | background-color: #ddd; |
| | | } |
| | | |
| | | table.quota-info td.name { |
| | | text-align: left; |
| | | } |
| | | |
| | | table.quota-info td.root { |
| | | font-style: italic; |
| | | } |
| | | |
| | | /********** TinyMCE styles **********/ |
| | | .mce-btn-small button |
| | |
| | | function update_quota(data) |
| | | { |
| | | percent_indicator(rcmail.gui_objects.quotadisplay, data); |
| | | |
| | | if (data.table) { |
| | | var menu = $('#quotamenu'); |
| | | |
| | | if (!menu.length) |
| | | menu = $('<div id="quotamenu" class="popupmenu">').appendTo($('body')); |
| | | |
| | | menu.html(data.table); |
| | | $('#quotaimg').css('cursor', 'pointer').off('click').on('click', function(e) { |
| | | return rcmail.command('menu-open', 'quotamenu', e.target, e); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // percent (quota) indicator |
| | |
| | | background: url(images/quota.png) -100px 0 no-repeat; |
| | | } |
| | | |
| | | table.quota-info { |
| | | border-spacing: 0; |
| | | border-collapse: collapse; |
| | | table-layout: fixed; |
| | | margin: 5px; |
| | | } |
| | | |
| | | table.quota-info td, |
| | | table.quota-info th { |
| | | color: white; |
| | | border: 1px solid lightgrey; |
| | | padding: 2px 3px; |
| | | text-align: center; |
| | | min-width: 80px; |
| | | } |
| | | |
| | | table.quota-info td.name { |
| | | text-align: left; |
| | | } |
| | | |
| | | table.quota-info td.root { |
| | | font-style: italic; |
| | | } |
| | | |
| | | /*** popup menus ***/ |
| | | |
| | | .popupmenu, |
| | |
| | | |
| | | function update_quota(p) |
| | | { |
| | | var step = 24, step_count = 20, |
| | | var element = $('#quotadisplay'), menu = $('#quotamenu'), |
| | | step = 24, step_count = 20, |
| | | y = p.total ? Math.ceil(p.percent / 100 * step_count) * step : 0; |
| | | |
| | | // never show full-circle if quota is close to 100% but below. |
| | | if (p.total && y == step * step_count && p.percent < 100) |
| | | y -= step; |
| | | |
| | | $('#quotadisplay').css('background-position', '0 -'+y+'px'); |
| | | element.css('background-position', '0 -' + y + 'px'); |
| | | |
| | | if (p.table) { |
| | | if (!menu.length) |
| | | menu = $('<div id="quotamenu" class="popupmenu">').appendTo($('body')); |
| | | |
| | | menu.html(p.table); |
| | | element.css('cursor', 'pointer').off('click').on('click', function(e) { |
| | | return rcmail.command('menu-open', 'quotamenu', e.target, e); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |