summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-01-17 18:26:24 +0000
committeralecpl <alec@alec.pl>2011-01-17 18:26:24 +0000
commite81a30752b244394b03cbcaa0df254c93b379782 (patch)
tree02e608ceab731e8f671d0913909084114a4ed6ae
parent824144214f82b4f00a82ac688a9adea7386c1bd0 (diff)
- Fix impossible to subscribe to protected folders (#1487656)
-rw-r--r--CHANGELOG1
-rw-r--r--program/js/app.js8
-rw-r--r--program/steps/settings/folders.inc17
3 files changed, 23 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index ec38b8ee7..0d929f983 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@ CHANGELOG Roundcube Webmail
- Require PHP 5.2.1 or greater
- Fix %h/%z variables in username_domain option (#1487701)
- Workaround for setting charset in case of malformed bodystructure response (#1487700)
+- Fix impossible to subscribe to protected folders (#1487656)
RELEASE 0.5
-----------
diff --git a/program/js/app.js b/program/js/app.js
index 280322cf6..b21435ef1 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4309,6 +4309,14 @@ function rcube_webmail()
}
};
+ // disables subscription checkbox (for protected folder)
+ this.disable_subscription = function(folder)
+ {
+ var id = this.get_folder_row_id(folder);
+ if (id)
+ $('input[name="_subscribed[]"]', $('#'+id)).attr('disabled', true);
+ };
+
this.folder_size = function(folder)
{
var lock = this.set_busy(true, 'loading');
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index ae8dddb78..dcc3ce64b 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -42,8 +42,16 @@ if ($RCMAIL->action == 'subscribe')
}
}
- if ($result)
+ if ($result) {
+ // Handle subscription of protected folder (#1487656)
+ if ($CONFIG['protect_default_folders'] == true
+ && in_array($mbox, $CONFIG['default_imap_folders'])
+ ) {
+ $OUTPUT->command('disable_subscription', $mbox);
+ }
+
$OUTPUT->show_message('foldersubscribed', 'confirmation');
+ }
else
rcmail_display_server_error('errorsaving');
}
@@ -294,13 +302,16 @@ function rcube_subscription_form($attrib)
$noselect = in_array('\\Noselect', $opts);
}
+ $disabled = (($protected && $subscribed) || $noselect);
+
$table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes)));
$table->add('name', $display_folder);
$table->add('subscribed', $checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''),
- array('value' => $folder_utf8, 'disabled' => ($protected || $noselect) ? 'disabled' : '')));
+ array('value' => $folder_utf8, 'disabled' => $disabled ? 'disabled' : '')));
- $a_js_folders['rcmrow'.$idx] = array($folder_utf8, Q($display_folder), $protected || $folder['virtual']);
+ $a_js_folders['rcmrow'.$idx] = array($folder_utf8,
+ Q($display_folder), $protected || $folder['virtual']);
}
$RCMAIL->plugins->exec_hook('folders_list', array('table' => $table));