зеркало из https://github.com/mozilla/gecko-dev.git
add support for automatically disabling certain controls in the smtp server editor
r=sspitzer
This commit is contained in:
Родитель
a382e36f3e
Коммит
6c4a494981
|
@ -25,15 +25,18 @@
|
||||||
// with the new XUL widgets
|
// with the new XUL widgets
|
||||||
|
|
||||||
function initSmtpSettings(server) {
|
function initSmtpSettings(server) {
|
||||||
if (!server) return;
|
|
||||||
|
|
||||||
document.getElementById("smtp.hostname").value = server.hostname;
|
if (server) {
|
||||||
document.getElementById("smtp.alwaysUseUsername").checked =
|
document.getElementById("smtp.hostname").value = server.hostname;
|
||||||
server.alwaysUseUsername;
|
document.getElementById("smtp.alwaysUseUsername").checked =
|
||||||
document.getElementById("smtp.username").value = server.username;
|
server.alwaysUseUsername;
|
||||||
document.getElementById("smtp.savePassword").checked = server.savePassword;
|
document.getElementById("smtp.username").value = server.username;
|
||||||
// radio groups not implemented
|
document.getElementById("smtp.savePassword").checked = server.savePassword;
|
||||||
//document.getElementById("smtp.trySSL").value = server.trySSL;
|
// radio groups not implemented
|
||||||
|
//document.getElementById("smtp.trySSL").value = server.trySSL;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSmtpSettings(server)
|
function saveSmtpSettings(server)
|
||||||
|
@ -46,3 +49,35 @@ function saveSmtpSettings(server)
|
||||||
//server.savePassword = document.getElementById("smtp.savePassword").checked;
|
//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>
|
</box>
|
||||||
<!-- use a grid here when it's implemented -->
|
<!-- use a grid here when it's implemented -->
|
||||||
<box orient="vertical">
|
<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="vertical" style="margin-left: 2em">
|
||||||
<box orient="horizontal">
|
<box orient="horizontal">
|
||||||
<text value="&userName.label;"/>
|
<text value="&userName.label;"/>
|
||||||
|
@ -47,11 +48,11 @@
|
||||||
<checkbox id="smtp.savePassword" value="&savePassword.label;"/>
|
<checkbox id="smtp.savePassword" value="&savePassword.label;"/>
|
||||||
</box>
|
</box>
|
||||||
</box>
|
</box>
|
||||||
<checkbox value="&isSecure.label;"/>
|
<checkbox id="smtp.isSecure" value="&isSecure.label;" oncommand="updateControls();"/>
|
||||||
<radiogroup id="smtp.trySSL">
|
<radiogroup id="smtp.trySSL">
|
||||||
<box orient="horizontal">
|
<box orient="horizontal">
|
||||||
<radio value="&alwaysSecure.label;"/>
|
<radio value="&alwaysSecure.label;" id="smtp.alwaysSecure"/>
|
||||||
<radio value="&sometimesSecure.label;"/>
|
<radio value="&sometimesSecure.label;" id="smtp.sometimesSecure"/>
|
||||||
</box>
|
</box>
|
||||||
</radiogroup>
|
</radiogroup>
|
||||||
</box>
|
</box>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче