Bug 201469 Add smtp server's username field to Account Wizard

patch by bugzilla@arlen.demon.co.uk r=neil sr=bienvenu
This commit is contained in:
timeless%mozdev.org 2003-10-07 09:00:40 +00:00
Родитель 621378faa2
Коммит 2dff18c7d7
6 изменённых файлов: 138 добавлений и 51 удалений

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

@ -303,8 +303,8 @@ function AccountDataToPageData(accountData, pageData)
if (accountData.smtp) {
smtp = accountData.smtp;
setPageData(pageData, "server", "smtphostname",
smtp.hostname);
setPageData(pageData, "server", "smtphostname", smtp.hostname);
setPageData(pageData, "login", "smtpusername", smtp.username);
}
}
@ -341,6 +341,8 @@ function PageDataToAccountData(pageData, accountData)
server.password = pageData.login.password.value;
if (pageData.login.rememberPassword)
server.rememberPassword = pageData.login.rememberPassword.value;
if (pageData.login.smtpusername)
smtp.username = pageData.login.smtpusername.value;
}
dump("pageData.server = " + pageData.server + "\n");
@ -886,7 +888,7 @@ function FixupAccountDataForIsp(accountData)
accountData.smtpRequiresUsername) {
// fix for bug #107953
// if incoming hostname is same as smtp hostname
// use the server username (insetad of the email username)
// use the server username (instead of the email username)
if (accountData.smtp.hostname == accountData.incomingServer.hostName)
accountData.smtp.username = accountData.incomingServer.username;
else

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

@ -156,7 +156,8 @@ Rights Reserved.
</vbox>
<vbox id="haveSmtp">
<description id="smtpStaticText" style="width: 200px;">&haveSmtp1.label;</description>
<description id="smtpStaticText1" style="width: 200px;" prefix="&haveSmtp1.prefix;"
suffix="&haveSmtp1.suffix;">*</description>
</vbox>
</vbox>
</wizardpage>
@ -175,6 +176,29 @@ Rights Reserved.
accesskey="&usernameLabel.accesskey;" control="username"/>
<textbox id="username" wsm_persist="true" flex="1"/>
</hbox>
<separator/>
<vbox id="loginSet1">
<description>&usernameSmtpDesc.label;</description>
<separator class="thin"/>
<hbox align="center">
<label class="label" value="&usernameSmtpLabel.label;" for="smtpusername" style="width: 8em;"
accesskey="&usernameSmtpLabel.accesskey;" control="smtpusername"/>
<textbox id="smtpusername" wsm_persist="true" flex="1"/>
</hbox>
</vbox>
<vbox id="loginSet2" hidden="true">
<description id="smtpStaticText2" style="width: 200px;" prefix="&haveSmtp2.prefix;"
suffix="&haveSmtp2.suffix;">*</description>
</vbox>
<vbox id="loginSet3" hidden="true">
<description id="smtpStaticText3" style="width: 200px;" prefix="&haveSmtp3.prefix;"
suffix="&haveSmtp3.suffix;">*</description>
</vbox>
</vbox>
</wizardpage>
@ -224,17 +248,17 @@ Rights Reserved.
</columns>
<rows>
<row autostretch="never" id="account.name">
<label class="label" flex="1" id="account.name.label" value="&accountNamePrefix.label;"/>
<label class="label" flex="1" id="account.name.label" value="&accnameLabel.label;"/>
<label class="label" id="account.name.text"/>
</row>
<row autostretch="never" id="server.username">
<label class="label" flex="1" id="server.username.label" value="&userNamePrefix.label;"/>
<label class="label" id="server.username.text"/>
</row>
<row autostretch="never" id="identity.email">
<label class="label" flex="1" id="identity.email.label" value="&emailPrefix.label;"/>
<label class="label" flex="1" id="identity.email.label" value="&emailLabel.label;"/>
<label class="label" id="identity.email.text"/>
</row>
<row autostretch="never" id="server.username">
<label class="label" flex="1" id="server.username.label" value="&usernameLabel.label;"/>
<label class="label" id="server.username.text"/>
</row>
<row autostretch="never" id="server.name">
<label class="label" flex="1" id="server.name.label" value="&serverNamePrefix.label;"/>
<label class="label" id="server.name.text"/>
@ -247,6 +271,10 @@ Rights Reserved.
<label class="label" flex="1" id="newsServer.name.label" value="&newsServerNamePrefix.label;"/>
<label class="label" id="newsServer.name.text"/>
</row>
<row autostretch="never" id="smtpServer.username">
<label class="label" flex="1" id="smtpServer.username.label" value="&usernameSmtpLabel.label;"/>
<label class="label" id="smtpServer.username.text"/>
</row>
<row autostretch="never" id="smtpServer.name">
<label class="label" flex="1" id="smtpServer.name.label" value="&smtpServerNamePrefix.label;"/>
<label class="label" id="smtpServer.name.text"/>

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

@ -69,17 +69,21 @@ function donePageInit() {
setDivTextFromForm("identity.email", email);
var userName="";
if (pageData.login && pageData.login.username) {
if (pageData.login && pageData.login.username)
userName = pageData.login.username.value;
}
if (!userName && email) {
var emailData = email.split('@');
userName = emailData[0];
}
if (!userName && email)
userName = getUsernameFromEmail(email);
// Hide the "username" field if we don't want to show information
// on the incoming server.
setDivTextFromForm("server.username", hideIncoming ? null : userName);
var smtpUserName="";
if (pageData.login && pageData.login.smtpusername)
smtpUserName = pageData.login.smtpusername.value;
if (!smtpUserName && email)
smtpUserName = getUsernameFromEmail(email);
setDivTextFromForm("smtpServer.username", smtpUserName);
var accountName="";
if (pageData.accname && pageData.accname.prettyName) {
accountName = pageData.accname.prettyName.value;

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

@ -59,18 +59,24 @@ function loginPageValidate() {
return false;
}
// If SMTP username box is blank it is because the
// incoming and outgoing server names were the same,
// so set to be same as incoming username
var smtpusername = document.getElementById("smtpusername").value || username;
setPageData(pageData, "login", "username", username);
setPageData(pageData, "login", "smtpusername", smtpusername);
return true;
}
function loginPageInit() {
gPrefsBundle = document.getElementById("bundle_prefs");
var pageData = parent.GetPageData();
var loginNameInput = document.getElementById("username");
if (loginNameInput.value == "") {
// retrieve data from previously entered pages
var pageData = parent.GetPageData();
var type = parent.getCurrentServerType(pageData);
dump("type = " + type + "\n");
@ -78,13 +84,52 @@ function loginPageInit() {
if (protocolinfo.requiresUsername) {
// since we require a username, use the uid from the email address
var email = pageData.identity.email.value;
var emailParts = email.split("@");
loginNameInput.value = emailParts[0];
loginNameInput.value = parent.getUsernameFromEmail(pageData.identity.email.value);
}
}
var smtpNameInput = document.getElementById("smtpusername");
var smtpServer = null;
try {
smtpServer = parent.smtpService.defaultServer;
}
catch (ex) {}
if (smtpServer && smtpServer.hostname && smtpServer.username &&
smtpServer.redirectorType == null) {
// we have a default SMTP server, so modify and show the static text
// and store the username for the default server in the textbox.
modifyStaticText(smtpServer.username, "2")
hideShowLoginSettings(2, 1, 3);
smtpNameInput.value = smtpServer.username;
}
else {
// no default SMTP server yet, so need to compare
// incoming and outgoing server names
var smtpServerName = pageData.server.smtphostname.value;
var incomingServerName = pageData.server.hostname.value;
if (smtpServerName == incomingServerName) {
// incoming and outgoing server names are the same, so show
// the static text and make sure textbox blank for later tests.
modifyStaticText(smtpServerName, "3")
hideShowLoginSettings(3, 1, 2);
smtpNameInput.value = "";
}
else {
// incoming and outgoing server names are different, so set smtp
// username's textbox to be the same as incoming's one, unless already set.
hideShowLoginSettings(1, 2, 3);
smtpNameInput.value = smtpNameInput.value || loginNameInput.value;
}
}
}
function hideShowLoginSettings(aEle, bEle, cEle)
{
document.getElementById("loginSet" + aEle).hidden = false;
document.getElementById("loginSet" + bEle).hidden = true;
document.getElementById("loginSet" + cEle).hidden = true;
}
var savedPassword="";

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

@ -160,35 +160,16 @@ function serverPageInit() {
}
catch(ex){}
// modify the value in the smtp display if we already have a
// smtp server so that the single string displays the
// name of the smtp server.
var smtpStatic = document.getElementById("smtpStaticText");
if (smtpServer && smtpServer.hostname && smtpStatic &&
smtpStatic.hasChildNodes()) {
var staticText = smtpStatic.firstChild.nodeValue;
staticText = staticText.replace(/@server_name@/, smtpServer.hostname);
while (smtpStatic.hasChildNodes())
smtpStatic.removeChild(smtpStatic.firstChild);
var staticTextNode = document.createTextNode(staticText);
smtpStatic.appendChild(staticTextNode);
}
hideShowSmtpSettings(smtpServer);
}
function hideShowSmtpSettings(smtpServer) {
var noSmtpBox = document.getElementById("noSmtp");
var haveSmtpBox = document.getElementById("haveSmtp");
var boxToHide;
var boxToShow;
if (smtpServer && smtpServer.hostname && smtpServer.redirectorType == null
&& smtpServer.hostname != "") {
// we have a hostname, so show the static text and
if (smtpServer && smtpServer.hostname && smtpServer.redirectorType == null) {
// we have a hostname, so modify and show the static text and
// store the value of the default smtp server in the textbox.
modifyStaticText(smtpServer.hostname, "1")
var smtpTextBox = document.getElementById("smtphostname");
if (smtpTextBox && smtpTextBox.value == "")
smtpTextBox.value = smtpServer.hostname;
@ -207,6 +188,17 @@ function hideShowSmtpSettings(smtpServer) {
boxToShow.removeAttribute("hidden");
}
function modifyStaticText(smtpMod, smtpBox)
{
// modify the value in the smtp display if we already have a
// smtp server so that the single string displays the hostname
// or username for the smtp server.
var smtpStatic = document.getElementById("smtpStaticText"+smtpBox);
if (smtpStatic && smtpStatic.hasChildNodes())
smtpStatic.childNodes[0].nodeValue = smtpStatic.getAttribute("prefix") +
smtpMod + smtpStatic.getAttribute("suffix");
}
function setServerType()
{
var pageData = parent.GetPageData();

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

@ -69,17 +69,36 @@
this variable. Also, translate currentSmtpBefore.label and currentSmtpAfter.label as a single sentence,
inserting text after the "&quot;" entity in currentSmtpAfter.label, if required grammatically
-->
<!-- LOCALIZATION NOTE (haveSmtp1.label) : Do not translate "SMTP" in below line -->
<!ENTITY haveSmtp1.label "Your existing outgoing server (SMTP), &quot;@server_name@&quot;, will be used. You can modify outgoing server settings by choosing Mail &amp; Newsgroups Account Settings from the Edit menu.">
<!-- LOCALIZATION NOTE (haveSmtp1.prefix and haveSmtp1.suffix) : Do not translate "SMTP" and "&quot;" in
these variables. Also, translate haveSmtp1.prefix and haveSmtp1.suffix as a single sentence, inserting
text after the "&quot;" entity in haveSmtp1.suffix, if required grammatically.
-->
<!ENTITY haveSmtp1.prefix "Your existing outgoing server (SMTP), &quot;">
<!ENTITY haveSmtp1.suffix "&quot;, will be used. You can modify outgoing server settings by choosing Mail &amp; Newsgroups Account Settings from the Edit menu.">
<!-- Entities for Login page -->
<!ENTITY loginTitle.label "User Name">
<!ENTITY usernameDesc.label "Enter the user name given to you by your email provider ">
<!ENTITY loginTitle.label "User Names">
<!ENTITY usernameDesc.label "Enter the incoming user name given to you by your email provider ">
<!-- LOCALIZATION NOTE (usernameExample.label) : do not translate "&quot;jsmith&quot;" in below line -->
<!ENTITY usernameExample.label "(for example, &quot;jsmith&quot;).">
<!ENTITY usernameLabel.label "User Name:">
<!ENTITY usernameLabel.accesskey "U">
<!ENTITY usernameLabel.label "Incoming User Name:">
<!ENTITY usernameLabel.accesskey "I">
<!ENTITY usernameSmtpDesc.label "Enter the outgoing user name given to you by your email provider (this is typically the same as your incoming user name).">
<!ENTITY usernameSmtpLabel.label "Outgoing User Name:">
<!ENTITY usernameSmtpLabel.accesskey "O">
<!-- LOCALIZATION NOTE (haveSmtp2.prefix and haveSmtp2.suffix) : Do not translate "SMTP" and "&quot;" in
these variables. Also, translate haveSmtp2.prefix and haveSmtp2.suffix as a single sentence, inserting
text after the "&quot;" entity in haveSmtp2.suffix, if required grammatically.
-->
<!ENTITY haveSmtp2.prefix "Your existing outgoing (SMTP) username, &quot;">
<!ENTITY haveSmtp2.suffix "&quot;, will be used. You can modify outgoing server settings by choosing Mail &amp; Newsgroups Account Settings from the Edit menu.">
<!-- LOCALIZATION NOTE (haveSmtp3.prefix and haveSmtp3.suffix) : Do not translate "SMTP" and "&quot;" in
these variables. Also, translate haveSmtp3.prefix and haveSmtp3.suffix as a single sentence, inserting
text after the "&quot;" entity in haveSmtp3.suffix, if required grammatically.
-->
<!ENTITY haveSmtp3.prefix "Your outgoing (SMTP) server, &quot;">
<!ENTITY haveSmtp3.suffix "&quot;, is identical to your incoming server, your incoming user name will be used to access it. You can modify outgoing server settings by choosing Mail &amp; Newsgroups Account Settings from the Edit menu.">
<!-- Entities for Account name page -->
@ -94,12 +113,9 @@
<!ENTITY completionTitle.label "Congratulations!">
<!ENTITY completionText.label "Please verify that the information below is correct.">
<!ENTITY userNamePrefix.label "User Name:">
<!ENTITY emailPrefix.label "Email Address:">
<!ENTITY serverTypePrefix.label "Incoming Server Type:">
<!ENTITY serverNamePrefix.label "Incoming Server Name:">
<!ENTITY smtpServerNamePrefix.label "Outgoing Server Name (SMTP):">
<!ENTITY newsServerNamePrefix.label "News Server Name (NNTP):">
<!ENTITY accountNamePrefix.label "Account Name:">
<!ENTITY downloadOnLogin.label "Download messages now">
<!ENTITY clickFinish.label "Click Finish to save these settings and exit the Account Wizard.">