Author Topic: Modify the displayed quota table  (Read 11453 times)

Offline rafmedia

  • Newbie
  • *
  • Posts: 2
Modify the displayed quota table
« on: March 24, 2017, 12:47:25 PM »
Hi,
At first apologize for my english.

I have a problem with modifying the qouta table.
I would like it to not display the server value in webmail.

The original is:



My intention:



Construction of this table I found in program/include/rcmail.php line: 1781:

Code: [Select]
// 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));
                       // $table->add(null, sprintf('%s (%.0f%%)', $this->show_bytes(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['title']   = $this->gettext($unlimited ? 'unlimited' : 'unknown');
            $quota_result['percent'] = 0;
        }

        // cleanup
        unset($quota_result['abort']);
        if (empty($quota_result['table'])) {
            unset($quota_result['all']);
        }

        return $quota_result;
    }

Please help  :'(

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: Modify the displayed quota table
« Reply #1 on: March 25, 2017, 05:00:59 AM »
If you really have to do it in Roundcube then you should write a plugin and use the quota hook to modify the information. But another option is to change the settings on your IMAP server of what information it returns.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦