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 switch_back_to_panel = null;
function show_panel(panelid) {
if (panelid.getAttribute)
if (panelid.getAttribute) {
// we might be passed an HTMLElement <a>.
panelid = panelid.getAttribute('href').substring(1);
}
$('.admin_panel').hide();
$('#panel_' + panelid).show();

View File

@ -2,15 +2,34 @@
</style>
<script>
function checkfields() {
let use_relay = document.getElementById("use_relay").checked
let use_auth = document.getElementById("relay_use_auth").checked
const use_relay = document.getElementById("use_relay")
const relay_host = document.getElementById("relay_host")
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")
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)
api(
"/system/smtp/relay",
"GET",
{},
data => {
}
)
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>
<h2>SMTP Relays</h2>