-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcbits_vacation.js
More file actions
40 lines (34 loc) · 1.3 KB
/
cbits_vacation.js
File metadata and controls
40 lines (34 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
window.rcmail && rcmail.addEventListener('init', function(evt) {
rcmail.register_command('plugin.cbits_vacation.save', function() {
rcmail.gui_objects.vacform.submit();
}, true);
new rcube_text_editor({}, 'vacation-message');
$('input[type=radio][name=active]').change(function () {
update_hidden_fields(this.value)
})
update_hidden_fields($('input[type=radio][name=active]:checked').val())
$('input:not(:hidden)').first().focus();
});
function update_hidden_fields(value) {
switch(value) {
case "off":
$('#vacation-start_datetime-row').hide();
$('#vacation-end_datetime-row').hide();
$('#vacation-forwarding_address-row').hide();
$('#vacation-message-row').hide();
break;
case "on-dates":
$('#vacation-start_datetime-row').show();
$('#vacation-end_datetime-row').show();
$('#vacation-forwarding_address-row').show();
$('#vacation-message-row').show();
break;
case "on-indef":
$('#vacation-start_datetime-row').hide();
$('#vacation-end_datetime-row').hide();
$('#vacation-forwarding_address-row').show();
$('#vacation-message-row').show();
break;
default:
}
}