Elastic skin support for kolab_folders

This commit is contained in:
Aleksander Machniak 2017-10-30 11:30:02 +01:00
parent 211fe3ada5
commit 18d9f3b31f
2 changed files with 24 additions and 7 deletions

View file

@ -51,7 +51,7 @@ window.rcmail && rcmail.env.action == 'folders' && rcmail.addEventListener('init
window.rcmail && rcmail.env.action != 'folders' && $(document).ready(function() { window.rcmail && rcmail.env.action != 'folders' && $(document).ready(function() {
// Add onchange handler for folder type SELECT, and call it on form init // Add onchange handler for folder type SELECT, and call it on form init
$('#_ctype').change(function() { $('#_folderctype').change(function() {
var type = $(this).val(), var type = $(this).val(),
sub = $('#_subtype'), sub = $('#_subtype'),
subtypes = rcmail.env.kolab_folder_subtypes[type] || {}; subtypes = rcmail.env.kolab_folder_subtypes[type] || {};

View file

@ -262,7 +262,7 @@ class kolab_folders extends rcube_plugin
$this->include_script('kolab_folders.js'); $this->include_script('kolab_folders.js');
// build type SELECT fields // build type SELECT fields
$type_select = new html_select(array('name' => '_ctype', 'id' => '_ctype', $type_select = new html_select(array('name' => '_ctype', 'id' => '_folderctype',
'onchange' => "\$('[name=\"_expire\"]').attr('disabled', \$(this).val() != 'mail')" 'onchange' => "\$('[name=\"_expire\"]').attr('disabled', \$(this).val() != 'mail')"
)); ));
$sub_select = new html_select(array('name' => '_subtype', 'id' => '_subtype')); $sub_select = new html_select(array('name' => '_subtype', 'id' => '_subtype'));
@ -286,10 +286,12 @@ class kolab_folders extends rcube_plugin
} }
} }
$args['form']['props']['fieldsets']['settings']['content']['foldertype'] = array( $args['form']['props']['fieldsets']['settings']['content']['folderctype'] = array(
'label' => $this->gettext('folderctype'), 'label' => $this->gettext('folderctype'),
'value' => $type_select->show(isset($new_ctype) ? $new_ctype : $ctype) 'value' => html::div('input-group',
. $sub_select->show(isset($new_subtype) ? $new_subtype : $subtype), $type_select->show(isset($new_ctype) ? $new_ctype : $ctype)
. $sub_select->show(isset($new_subtype) ? $new_subtype : $subtype)
),
); );
$this->rc->output->set_env('kolab_folder_subtypes', $sub_types); $this->rc->output->set_env('kolab_folder_subtypes', $sub_types);
@ -750,15 +752,30 @@ class kolab_folders extends rcube_plugin
if (($expire = $this->get_expire_annotation($folder)) !== false) { if (($expire = $this->get_expire_annotation($folder)) !== false) {
$post = trim(rcube_utils::get_input_value('_expire', rcube_utils::INPUT_POST)); $post = trim(rcube_utils::get_input_value('_expire', rcube_utils::INPUT_POST));
$is_mail = empty($type) || preg_match('/^mail/i', $type); $is_mail = empty($type) || preg_match('/^mail/i', $type);
$input = new html_inputfield(array('name' => '_expire', 'size' => 3, 'disabled' => !$is_mail)); $label = $this->gettext('xdays');
$input = new html_inputfield(array(
'id' => '_kolabexpire',
'name' => '_expire',
'size' => 3,
'disabled' => !$is_mail
));
if ($post && $is_mail) { if ($post && $is_mail) {
$expire = (int) $post; $expire = (int) $post;
} }
if (strpos($label, '$') === 0) {
$label = str_replace('$x', '', $label);
$html = $input->show($expire ?: '') . html::span('input-group-addon', rcube::Q($label));
}
else {
$label = str_replace('$x', '', $label);
$html = html::span('input-group-addon', rcube::Q($label)) . $input->show($expire ?: '');
}
$form['props']['fieldsets']['settings']['content']['kolabexpire'] = array( $form['props']['fieldsets']['settings']['content']['kolabexpire'] = array(
'label' => $this->gettext('folderexpire'), 'label' => $this->gettext('folderexpire'),
'value' => str_replace('$x', $input->show($expire ?: ''), $this->gettext('xdays')), 'value' => html::div('input-group', $html),
); );
} }
} }