From 63ab02a9f219f1e03ca47df57bae5bf0c9016e74 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Fri, 19 Mar 2010 16:18:23 -0400 Subject: [PATCH] - hide threads related prefs when threads are not supported by IMAP server - performance: don't load folders list when we don't need it --- plugins/archive/archive.php | 13 ++++++++++--- program/steps/settings/func.inc | 18 +++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index 939faf8..5d61311 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -110,12 +110,19 @@ function prefs_table($args) { + global $CURR_SECTION; + if ($args['section'] == 'folders') { $this->add_texts('localization'); - + $rcmail = rcmail::get_instance(); - $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, - 'maxlength' => 30, 'exceptions' => array('INBOX'))); + + // load folders list when needed + if ($CURR_SECTION) + $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, + 'maxlength' => 30, 'exceptions' => array('INBOX'))); + else + $select = new html_select(); $args['blocks']['main']['options']['archive_mbox'] = array( 'title' => $this->gettext('archivefolder'), diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 421fb37..7ad2449 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -300,7 +300,12 @@ ); } - if (!isset($no_override['autoexpand_threads'])) { + $RCMAIL->imap_connect(); + $threading_supported = $RCMAIL->imap->get_capability('thread=references') + || $RCMAIL->imap->get_capability('thread=orderedsubject') + || $RCMAIL->imap->get_capability('thread=refs'); + + if (!isset($no_override['autoexpand_threads']) && $threading_supported) { $field_id = 'rcmfd_autoexpand_threads'; $select_autoexpand_threads = new html_select(array('name' => '_autoexpand_threads', 'id' => $field_id)); $select_autoexpand_threads->add(rcube_label('never'), 0); @@ -532,9 +537,16 @@ // Configure special folders if (!isset($no_override['default_imap_folders'])) { + $RCMAIL->imap_connect(); - $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, - 'maxlength' => 30, 'exceptions' => array('INBOX'))); + + // load folders list only when needed + if ($current) { + $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, + 'maxlength' => 30, 'exceptions' => array('INBOX'))); + } + else // dummy select + $select = new html_select(); if (!isset($no_override['drafts_mbox'])) $blocks['main']['options']['drafts_mbox'] = array( -- Gitblit v1.9.1