fix for #28246 - display static text if the user has already entered an SMTP server

r=sspitzer
This commit is contained in:
alecf%netscape.com 2000-02-18 22:58:27 +00:00
parent 80b76bbc3f
commit 70f68218de
4 changed files with 73 additions and 6 deletions

View File

@ -28,8 +28,13 @@ function getFirstInvalidAccount(accounts)
var numAccounts = accounts.Count();
for (var i=0; i<numAccounts; i++) {
var account = accounts.QueryElementAt(i, Components.interfaces.nsIMsgAccount);
if (!account.incomingServer.valid)
return account;
try {
if (!account.incomingServer.valid)
return account;
} catch (ex) {
// this account is busted, just keep going
continue;
}
var identities = account.identities;
var numIdentities = identities.Count();

View File

@ -39,9 +39,55 @@ function validate() {
function onInit() {
var smtpserver = document.getElementById("smtphostname");
var smtpTextField = document.getElementById("smtphostname");
var smtpServer = parent.smtpService.defaultServer;
if (smtpTextField && smtpTextField.value == "" &&
smtpServer.hostname)
smtpTextField.value = smtpServer.hostname;
setDivText("smtpStaticText", smtpServer.hostname);
hideShowSmtpSettings(smtpServer);
}
function setDivText(id, value) {
if (!value) return;
var div = document.getElementById("smtpStaticText");
if (!div) return;
if (div.firstChild)
div.removeChild(div.firstChild);
div.appendChild(document.createTextNode(value));
}
function hideShowSmtpSettings(smtpServer) {
var noSmtpBox = document.getElementById("noSmtp");
var haveSmtpBox = document.getElementById("haveSmtp");
var boxToHide;
var boxToShow;
if (smtpServer && smtpServer.hostname &&
smtpServer.hostname != "") {
// we have a hostname, so show the static text
boxToShow = haveSmtpBox;
boxToHide = noSmtpBox;
} else {
// no default hostname yet
boxToShow = noSmtpBox;
boxToHide = haveSmtpBox;
}
if (boxToHide)
boxToHide.style.visibility = "collapse";
if (boxToShow)
boxToShow.style.visibility = "visible";
if (smtpserver && smtpserver.value == "" &&
parent.smtpService.defaultServer.hostname)
smtpserver.value = parent.smtpService.defaultServer.hostname;
}

View File

@ -61,6 +61,7 @@ Rights Reserved.
<spring class="spacer"/>
<spring class="spacer"/>
<html:div id="noSmtp">
<box align="vertical">
<html:div class="title">&smtpServerTitle.label;</html:div>
<spring class="spacer"/>
@ -71,4 +72,11 @@ Rights Reserved.
<html:input type="text" id="smtphostname" name="smtphostname"/>
</html:div>
</box>
</html:div>
<html:div id="haveSmtp">
<html:p>&currentSmtpBefore.label;<html:span id="smtpStaticText"/>&currentSmtpAfter.label;</html:p>
<html:p>&haveSmtp1.label;</html:p>
<html:p>&haveSmtp2.label;</html:p>
</html:div>
</window>

View File

@ -25,3 +25,11 @@
<!ENTITY newsPasswordTitle.label "News Server Password">
<!ENTITY newsPasswordDesc.label "If your System Administrator or Internet Service Provider has given you a username and password for your news server and informed you that you must provide this information when accessing your news server, check the box below.">
<!ENTITY newsUsePasswordCheckbox.label "Always use name and password">
<!-- for when the user has an SMTP server pre-configured -->
<!ENTITY currentSmtpBefore.label "Your outgoing (SMTP) server is currently set to &quot;">
<!ENTITY currentSmtpAfter.label "&quot;.">
<!ENTITY haveSmtp1.label "For multiple mail accounts, only one outgoing server needs to be specified. For most Internet Service Providers, you should use the SMTP server associated with the account you use most often to connect to the Internet.">
<!ENTITY haveSmtp2.label "If you change the account you use to connect to the Internet or if you know that you can use your SMTP server from any Internet connection, you can go to Mail/News Account Settings | Outoing (SMTP) Server to configure another SMTP server.">