rhymix/modules/admin/tpl/js/notification_config.js

96 lines
4 KiB
JavaScript

(function($) {
$(function() {
$("#mail_driver").on("change", function() {
var selected_driver = $(this).val();
$(this).parents("section").find("div.x_control-group.hidden-by-default, p.x_help-block").not(".show-always").each(function() {
if ($(this).hasClass("show-for-" + selected_driver)) {
$(this).show();
} else {
$(this).hide();
}
});
var reply_to = $("#mail_reply_to").parents("div.x_control-group");
if (selected_driver === "woorimail") {
reply_to.hide();
} else {
reply_to.show();
}
}).triggerHandler("change");
$("#sms_driver").on("change", function() {
var selected_driver = $(this).val();
$(this).parents("section").find("div.x_control-group.hidden-by-default, p.x_help-block").not(".show-always").each(function() {
if ($(this).hasClass("show-for-" + selected_driver)) {
$(this).show();
} else {
$(this).hide();
}
});
}).triggerHandler("change");
$("#mail_smtp_manual_entry").on("change", function() {
var auto_fill = $(this).val();
if (auto_fill === 'gmail') {
$("#mail_smtp_smtp_host").val('smtp.gmail.com');
$("#mail_smtp_smtp_port").val('465');
$("#mail_smtp_security_ssl").prop("checked", true).parent().addClass("checked");
$("#mail_smtp_security_tls").parent().removeClass("checked");
$("#mail_smtp_security_none").parent().removeClass("checked");
$("#mail_force_default_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'hanmail') {
$("#mail_smtp_smtp_host").val('smtp.daum.net');
$("#mail_smtp_smtp_port").val('465');
$("#mail_smtp_security_ssl").prop("checked", true).parent().addClass("checked");
$("#mail_smtp_security_tls").parent().removeClass("checked");
$("#mail_smtp_security_none").parent().removeClass("checked");
$("#mail_force_default_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'naver') {
$("#mail_smtp_smtp_host").val('smtp.naver.com');
$("#mail_smtp_smtp_port").val('587');
$("#mail_smtp_security_tls").prop("checked", true).parent().addClass("checked");
$("#mail_smtp_security_ssl").parent().removeClass("checked");
$("#mail_smtp_security_none").parent().removeClass("checked");
$("#mail_force_default_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'worksmobile') {
$("#mail_smtp_smtp_host").val('smtp.worksmobile.com');
$("#mail_smtp_smtp_port").val('587');
$("#mail_smtp_security_tls").prop("checked", true).parent().addClass("checked");
$("#mail_smtp_security_ssl").parent().removeClass("checked");
$("#mail_smtp_security_none").parent().removeClass("checked");
$("#mail_force_default_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'outlook') {
$("#mail_smtp_smtp_host").val('smtp-mail.outlook.com');
$("#mail_smtp_smtp_port").val('587');
$("#mail_smtp_security_tls").prop("checked", true).parent().addClass("checked");
$("#mail_smtp_security_ssl").parent().removeClass("checked");
$("#mail_smtp_security_none").parent().removeClass("checked");
$("#mail_force_default_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'yahoo') {
$("#mail_smtp_smtp_host").val('smtp.mail.yahoo.com');
$("#mail_smtp_smtp_port").val('465');
$("#mail_smtp_security_ssl").prop("checked", true).parent().addClass("checked");
$("#mail_smtp_security_tls").parent().removeClass("checked");
$("#mail_smtp_security_none").parent().removeClass("checked");
$("#mail_force_default_sender").prop("checked", true).parent().addClass("checked");
}
});
$("#mail_woorimail_account_type_free,#mail_woorimail_account_type_paid").on("change", function() {
if ($("#mail_woorimail_account_type_paid").is(":checked")) {
$("#mail_reply_to").attr("disabled", "disabled");
} else {
$("#mail_reply_to").removeAttr("disabled");
}
}).triggerHandler("change");
});
} (jQuery));