1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-25 07:47:05 +00:00

HTML JS Cleanup

This commit is contained in:
David Duque 2020-04-14 09:52:01 +01:00
parent 109d8735c7
commit 14ee44e8e2
No known key found for this signature in database
GPG Key ID: 2F327738A3C0AE3A
2 changed files with 28 additions and 8 deletions

View File

@ -376,9 +376,10 @@
var current_panel = null; var current_panel = null;
var switch_back_to_panel = null; var switch_back_to_panel = null;
function show_panel(panelid) { function show_panel(panelid) {
if (panelid.getAttribute) if (panelid.getAttribute) {
// we might be passed an HTMLElement <a>. // we might be passed an HTMLElement <a>.
panelid = panelid.getAttribute('href').substring(1); panelid = panelid.getAttribute('href').substring(1);
}
$('.admin_panel').hide(); $('.admin_panel').hide();
$('#panel_' + panelid).show(); $('#panel_' + panelid).show();

View File

@ -2,15 +2,34 @@
</style> </style>
<script> <script>
function checkfields() { const use_relay = document.getElementById("use_relay")
let use_relay = document.getElementById("use_relay").checked const relay_host = document.getElementById("relay_host")
let use_auth = document.getElementById("relay_use_auth").checked const relay_use_auth = document.getElementById("relay_use_auth")
const relay_auth_user = document.getElementById("relay_auth_user")
const relay_auth_pass = document.getElementById("relay_auth_pass")
api(
"/system/smtp/relay",
"GET",
{},
data => {
document.getElementById("relay_host").disabled = !use_relay
document.getElementById("relay_use_auth").disabled = !use_relay
document.getElementById("relay_auth_user").disabled = !(use_relay && use_auth)
document.getElementById("relay_auth_pass").disabled = !(use_relay && use_auth)
} }
)
function checkfields() {
let relay_enabled = use_relay.checked
let auth_enabled = relay_use_auth.checked
relay_host.disabled = !relay_enabled
relay_use_auth.disabled = !relay_enabled
relay_auth_auth.disabled = !(relay_enabled && auth_enabled)
relay_auth_pass.disabled = !(relay_enabled && auth_enabled)
}
checkfields()
</script> </script>
<h2>SMTP Relays</h2> <h2>SMTP Relays</h2>