add support for automatically disabling certain controls in the smtp server editor

r=sspitzer
This commit is contained in:
alecf%netscape.com 2000-04-04 01:39:11 +00:00
Родитель a382e36f3e
Коммит 6c4a494981
2 изменённых файлов: 48 добавлений и 12 удалений

Просмотреть файл

@ -25,15 +25,18 @@
// with the new XUL widgets
function initSmtpSettings(server) {
if (!server) return;
document.getElementById("smtp.hostname").value = server.hostname;
document.getElementById("smtp.alwaysUseUsername").checked =
server.alwaysUseUsername;
document.getElementById("smtp.username").value = server.username;
document.getElementById("smtp.savePassword").checked = server.savePassword;
// radio groups not implemented
//document.getElementById("smtp.trySSL").value = server.trySSL;
if (server) {
document.getElementById("smtp.hostname").value = server.hostname;
document.getElementById("smtp.alwaysUseUsername").checked =
server.alwaysUseUsername;
document.getElementById("smtp.username").value = server.username;
document.getElementById("smtp.savePassword").checked = server.savePassword;
// radio groups not implemented
//document.getElementById("smtp.trySSL").value = server.trySSL;
}
updateControls();
}
function saveSmtpSettings(server)
@ -46,3 +49,35 @@ function saveSmtpSettings(server)
//server.savePassword = document.getElementById("smtp.savePassword").checked;
}
function updateControls() {
dump("Update controls..\n");
var alwaysUseUsername =
(document.getElementById("smtp.alwaysUseUsername").checked == "true")
if (alwaysUseUsername) {
document.getElementById("smtp.username").removeAttribute("disabled");
document.getElementById("smtp.savePassword").removeAttribute("disabled");
}
else {
document.getElementById("smtp.username").setAttribute("disabled", "true");
document.getElementById("smtp.savePassword").setAttribute("disabled", "true");
}
var isSecure =
(document.getElementById("smtp.isSecure").checked == "true");
if (isSecure) {
document.getElementById("smtp.alwaysSecure").removeAttribute("disabled");
document.getElementById("smtp.sometimesSecure").removeAttribute("disabled");
}
else {
document.getElementById("smtp.alwaysSecure").setAttribute("disabled", "true");
document.getElementById("smtp.sometimesSecure").setAttribute("disabled", "true");
}
}

Просмотреть файл

@ -38,7 +38,8 @@
</box>
<!-- use a grid here when it's implemented -->
<box orient="vertical">
<checkbox id="smtp.alwaysUseUsername" value="&alwaysUseUsername.label;"/>
<checkbox id="smtp.alwaysUseUsername" value="&alwaysUseUsername.label;"
oncommand="updateControls();"/>
<box orient="vertical" style="margin-left: 2em">
<box orient="horizontal">
<text value="&userName.label;"/>
@ -47,11 +48,11 @@
<checkbox id="smtp.savePassword" value="&savePassword.label;"/>
</box>
</box>
<checkbox value="&isSecure.label;"/>
<checkbox id="smtp.isSecure" value="&isSecure.label;" oncommand="updateControls();"/>
<radiogroup id="smtp.trySSL">
<box orient="horizontal">
<radio value="&alwaysSecure.label;"/>
<radio value="&sometimesSecure.label;"/>
<radio value="&alwaysSecure.label;" id="smtp.alwaysSecure"/>
<radio value="&sometimesSecure.label;" id="smtp.sometimesSecure"/>
</box>
</radiogroup>
</box>