Added suggestions for default values in UI (interactive). Fixed bug when

Security combobox was not disabled.
This commit is contained in:
Boris Gulay
2016-06-02 15:24:08 +03:00
parent 9ebacf0d61
commit ecbadcd866
2 changed files with 21 additions and 8 deletions

View File

@@ -14,14 +14,23 @@ $(function() {
}
}
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
if ($enFld.size() == 1)
$enFld.change();
$("INPUT[name='_ident_switch.form.enabled']").change();
$("SELECT[name='_ident_switch.form.secure']").change();
});
function plugin_switchIdent_enabled_onChange(e) {
var $enFld = $("INPUT[name='_ident_switch.form.enabled']");
$("INPUT[name!='_ident_switch.form.enabled']", $enFld.parents("FIELDSET")).prop("disabled", !$enFld.is(":checked"));
$("INPUT[name!='_ident_switch.form.enabled'], SELECT", $enFld.parents("FIELDSET")).prop("disabled", !$enFld.is(":checked"));
}
function plugin_switchIdent_secure_onChange(e) {
var $secSel = $("SELECT[name='_ident_switch.form.secure']");
var $portFld = $("INPUT[name='_ident_switch.form.port']");
if ('SSL' === $secSel.val().toUpperCase())
$portFld.attr("placeholder", 993);
else
$portFld.attr("placeholder", 143);
}
function plugin_switchIdent_switch(val) {

View File

@@ -159,13 +159,17 @@ class ident_switch extends rcube_plugin
'name' => $this->gettext('form.caption'),
'content' => array(
'ident_switch.form.enabled' => array('type' => 'checkbox', 'onchange' => 'plugin_switchIdent_enabled_onChange();'),
'ident_switch.form.label' => array('type' => 'text', 'size' => 32),
'ident_switch.form.host' => array('type' => 'text', 'size' => 64),
'ident_switch.form.secure' => array('type' => 'select', 'options' => array('ssl' => 'SSL', 'tls' => 'TLS')),
'ident_switch.form.label' => array('type' => 'text', 'size' => 32, 'placeholder' => $args['record']['email']),
'ident_switch.form.host' => array('type' => 'text', 'size' => 64, 'placeholder' => 'localhost'),
'ident_switch.form.secure' => array(
'type' => 'select',
'options' => array('ssl' => 'SSL', 'tls' => 'TLS'),
'onchange' => 'plugin_switchIdent_secure_onChange();'
),
'ident_switch.form.port' => array('type' => 'text', 'size' => 5),
'ident_switch.form.username' => array('type' => 'text', 'size' => 64),
'ident_switch.form.password' => array('type' => 'password', 'size' => 64),
'ident_switch.form.delimiter' => array('type' => 'text', 'size' => 1),
'ident_switch.form.delimiter' => array('type' => 'text', 'size' => 1, 'placeholder' => '.'),
),
);