Improved mail.default and mail.inbox types handling

This commit is contained in:
Aleksander Machniak (Kolab Systems) 2011-07-07 19:39:34 +02:00
parent dc58fd1a28
commit 20c57736f5
2 changed files with 23 additions and 7 deletions

View file

@ -19,11 +19,15 @@ $(document).ready(function() {
// For non-mail folders we must hide mail-specific subtypes // For non-mail folders we must hide mail-specific subtypes
$('option', sub).each(function() { $('option', sub).each(function() {
var opt = $(this), val = opt.val(); var opt = $(this), val = opt.val();
if (val == '' || val == 'default') { if (val == '')
return; return;
} // there's no mail.default
if (val == 'default' && type != 'mail') {
opt.show();
return;
};
if (type == 'mail') if (type == 'mail' && val != 'default')
opt.show(); opt.show();
else if (bw.ie) else if (bw.ie)
opt.remove(); opt.remove();

View file

@ -28,7 +28,7 @@ class kolab_folders extends rcube_plugin
public $task = '?(?!login).*'; public $task = '?(?!login).*';
public $types = array('mail', 'event', 'journal', 'task', 'note', 'contact'); 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; private $rc;
const CTYPE_KEY = '/shared/vendor/kolab/folder-type'; const CTYPE_KEY = '/shared/vendor/kolab/folder-type';
@ -172,11 +172,24 @@ class kolab_folders extends rcube_plugin
if (!$this->metadata_support()) { if (!$this->metadata_support()) {
return $args; 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']; $mbox = strlen($args['name']) ? $args['name'] : $args['parent_name'];
if (isset($_POST['_ctype'])) { if (isset($_POST['_ctype'])) {
$new_ctype = trim(get_input_value('_ctype', RCUBE_INPUT_POST)); $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 // Get type of the folder or the parent
@ -190,8 +203,7 @@ class kolab_folders extends rcube_plugin
$ctype = 'mail'; $ctype = 'mail';
} }
// load translations // Add javascript script to the client
$this->add_texts('localization/', false);
$this->include_script('kolab_folders.js'); $this->include_script('kolab_folders.js');
// build type SELECT fields // build type SELECT fields