diff --git a/plugins/kolab_folders/kolab_folders.js b/plugins/kolab_folders/kolab_folders.js index 6fffb1ff..0e63a6d8 100644 --- a/plugins/kolab_folders/kolab_folders.js +++ b/plugins/kolab_folders/kolab_folders.js @@ -19,11 +19,15 @@ $(document).ready(function() { // For non-mail folders we must hide mail-specific subtypes $('option', sub).each(function() { var opt = $(this), val = opt.val(); - if (val == '' || val == 'default') { + if (val == '') return; - } + // there's no mail.default + if (val == 'default' && type != 'mail') { + opt.show(); + return; + }; - if (type == 'mail') + if (type == 'mail' && val != 'default') opt.show(); else if (bw.ie) opt.remove(); diff --git a/plugins/kolab_folders/kolab_folders.php b/plugins/kolab_folders/kolab_folders.php index 0cd1f028..1490a0b4 100644 --- a/plugins/kolab_folders/kolab_folders.php +++ b/plugins/kolab_folders/kolab_folders.php @@ -28,7 +28,7 @@ class kolab_folders extends rcube_plugin public $task = '?(?!login).*'; public $types = array('mail', 'event', 'journal', 'task', 'note', 'contact'); - public $mail_types = array('inbox', 'drafts', 'sentitems', 'outbox', 'wastebasket', 'junkemail'); + public $mail_types = array('drafts', 'sentitems', 'outbox', 'wastebasket', 'junkemail'); private $rc; const CTYPE_KEY = '/shared/vendor/kolab/folder-type'; @@ -172,11 +172,24 @@ class kolab_folders extends rcube_plugin if (!$this->metadata_support()) { return $args; } + // load translations + $this->add_texts('localization/', false); + + // INBOX folder is of type mail.inbox and this cannot be changed + if ($args['name'] == 'INBOX') { + $args['form']['props']['fieldsets']['settings']['content']['foldertype'] = array( + 'label' => $this->gettext('folderctype'), + 'value' => sprintf('%s (%s)', $this->gettext('foldertypemail'), $this->gettext('inbox')), + ); + + return $args; + } $mbox = strlen($args['name']) ? $args['name'] : $args['parent_name']; + if (isset($_POST['_ctype'])) { $new_ctype = trim(get_input_value('_ctype', RCUBE_INPUT_POST)); - $new_subtype = trim(get_input_value('_subtype', RCUBE_INPUT_POST)); + $new_subtype = trim(get_input_value('_subtype', RCUBE_INPUT_POST)); } // Get type of the folder or the parent @@ -190,8 +203,7 @@ class kolab_folders extends rcube_plugin $ctype = 'mail'; } - // load translations - $this->add_texts('localization/', false); + // Add javascript script to the client $this->include_script('kolab_folders.js'); // build type SELECT fields