Fixing bugs 14301, 29745, 46450, 60668 and 63251. Fixes to bug 63251 includes introduction os new AccountCentral page. When user selects an account in the folder pane of the messenger, AccountCentral page is displayed inplace of threadpane and messagepane. This page contains links to various account related activities like read, search, compose messages and others. Bugs 14301 and 60668 are fixed so that we logon to the default account all other accounts that have been asked to login at startup. Fix to bug 29745 displays customized email description text on AcctWizard identity page. r=sspitzer sr=bienvenu

This commit is contained in:
racham%netscape.com 2001-01-23 21:54:34 +00:00
Родитель 906800af08
Коммит 7d6fd5e381
21 изменённых файлов: 824 добавлений и 69 удалений

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

@ -20,28 +20,104 @@
function onInit() { function onInit() {
var pageData = parent.wizardManager.WSM.PageData; var pageData = parent.wizardManager.WSM.PageData;
var showMailServerDetails = true;
var currentAccountData = parent.gCurrentAccountData;
if (currentAccountData) {
// find out if we need to hide server details
showMailServerDetails = currentAccountData.showServerDetailsOnWizardSummary;
// Change the username field description to email field label in aw-identity
setUserNameDescField(currentAccountData.emailIDFieldTitle);
}
var accountName="";
if (pageData.accname && pageData.accname.prettyName) {
accountName = pageData.accname.prettyName.value;
if (!accountName &&
currentAccountData &&
currentAccountData.prettyName)
accountName = currentAccountData.prettyName;
}
setDivTextFromForm("account.name", accountName);
var email = ""; var email = "";
if (pageData.identity && pageData.identity.email) { if (pageData.identity && pageData.identity.email) {
// fixup the email // fixup the email
email = pageData.identity.email.value; email = pageData.identity.email.value;
if (email.split('@').length < 2 && parent.gCurrentAccountData.domain) if (email.split('@').length < 2 &&
email += "@" + parent.gCurrentAccountData.domain; currentAccountData &&
currentAccountData.domain)
email += "@" + currentAccountData.domain;
} }
setDivTextFromForm("identity.email", email); setDivTextFromForm("identity.email", email);
var username=""; var userName="";
if (pageData.login && pageData.login.username) if (pageData.login && pageData.login.username) {
username = pageData.login.username.value; userName = pageData.login.username.value;
setDivTextFromForm("server.username", username); }
if (!userName && email) {
var emailData = email.split('@');
userName = emailData[0];
}
setDivTextFromForm("server.username", userName);
// Show mail servers (incoming&outgoing) detials
// based on current account data. ISP can set
// rdf value of literal showServerDetailsOnWizardSummary
// to false to hide server details
if (showMailServerDetails) {
var incomingServerName="";
if (pageData.server && pageData.server.hostname) {
incomingServerName = pageData.server.hostname.value;
if (!incomingServerName &&
currentAccountData &&
currentAccountData.incomingServer.hostname)
incomingServerName = currentAccountData.incomingServer.hostName;
}
setDivTextFromForm("server.name", incomingServerName);
var incomingServerType="";
if (pageData.server && pageData.server.servertype) {
incomingServerType = pageData.server.servertype.value;
if (!incomingServerType &&
currentAccountData &&
currentAccountData.incomingServer.type)
incomingServerType = currentAccountData.incomingServer.type;
}
setDivTextFromForm("server.type", incomingServerType.toUpperCase());
var smtpServerName="";
if (pageData.server && pageData.server.smtphostname) {
var smtpServer = parent.smtpService.defaultServer;
smtpServerName = pageData.server.smtphostname.value;
if (!smtpServerName && smtpServer.hostname)
smtpServerName = smtpServer.hostname;
}
setDivTextFromForm("smtpServer.name", smtpServerName);
}
else {
setDivTextFromForm("server.name", null);
setDivTextFromForm("server.type", null);
setDivTextFromForm("smtpServer.name", null);
}
var newsServerName="";
if (pageData.newsserver && pageData.newsserver.hostname)
newsServerName = pageData.newsserver.hostname.value;
if (newsServerName) {
// No need to show username for news account
setDivTextFromForm("server.username", null);
}
setDivTextFromForm("newsServer.name", newsServerName);
} }
function setDivTextFromForm(divid, value) { function setDivTextFromForm(divid, value) {
// hide the .label if the div has no value // collapse the row if the div has no value
if (!value || value =="") { if (!value) {
var div = document.getElementById(divid + ".label"); var div = document.getElementById(divid);
div.setAttribute("hidden","true"); div.setAttribute("collapsed","true");
return; return;
} }
@ -52,6 +128,14 @@ function setDivTextFromForm(divid, value) {
div.setAttribute("value", value); div.setAttribute("value", value);
} }
function setUserNameDescField(name)
{
if (name) {
var userNameField = document.getElementById("server.username.label");
userNameField.setAttribute("value", name);
}
}
function setupAnother(event) function setupAnother(event)
{ {
window.alert("Unimplemented, see bug #19982"); window.alert("Unimplemented, see bug #19982");

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

@ -44,18 +44,38 @@ Rights Reserved.
<grid> <grid>
<columns> <columns>
<column style="width: 8em;"/> <column/>
<column flex="1"/> <column flex="1"/>
</columns> </columns>
<rows> <rows>
<row autostretch="never"> <row autostretch="never" id="account.name">
<text class="label" id="server.username.label" value="&userNamePrefix.label;"/> <text class="label" flex="1" id="account.name.label" value="&accountNamePrefix.label;"/>
<text class="label" id="account.name.text"/>
</row>
<row autostretch="never" id="server.username">
<text class="label" flex="1" id="server.username.label" value="&userNamePrefix.label;"/>
<text class="label" id="server.username.text"/> <text class="label" id="server.username.text"/>
</row> </row>
<row autostretch="never"> <row autostretch="never" id="identity.email">
<text class="label" id="identity.email.label" value="&emailPrefix.label;"/> <text class="label" flex="1" id="identity.email.label" value="&emailPrefix.label;"/>
<text class="label" id="identity.email.text"/> <text class="label" id="identity.email.text"/>
</row> </row>
<row autostretch="never" id="server.name">
<text class="label" flex="1" id="server.name.label" value="&serverNamePrefix.label;"/>
<text class="label" id="server.name.text"/>
</row>
<row autostretch="never" id="server.type">
<text class="label" flex="1" id="server.type.label" value="&serverTypePrefix.label;"/>
<text class="label" id="server.type.text"/>
</row>
<row autostretch="never" id="newsServer.name">
<text class="label" flex="1" id="newsServer.name.label" value="&newsServerNamePrefix.label;"/>
<text class="label" id="newsServer.name.text"/>
</row>
<row autostretch="never" id="smtpServer.name">
<text class="label" flex="1" id="smtpServer.name.label" value="&smtpServerNamePrefix.label;"/>
<text class="label" id="smtpServer.name.text"/>
</row>
</rows> </rows>
</grid> </grid>
<!-- <html>&setupAnother.label;</html> --> <!-- <html>&setupAnother.label;</html> -->

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

@ -85,11 +85,74 @@ function validateEmail() {
function onInit() function onInit()
{ {
setEmailDescriptionText();
checkForDomain(); checkForDomain();
checkForFullName(); checkForFullName();
checkForEmail(); checkForEmail();
} }
// Use email example data that ISP has provided. ISP data, if avaialble
// for the choice user has made, will be read into CurrentAccountData.
// Default example data from properties will be used when the info is missing.
function setEmailDescriptionText()
{
var emailDescText = document.getElementById("emailDescText");
var emailFieldLabel = document.getElementById("emailFieldLabel");
var currentAccountData = parent.gCurrentAccountData;
var displayText = null;
var emailFieldLabelData = null;
var setDefaultEmailDescStrings = true;
// Get values for customized data from current account
if (currentAccountData)
{
var emailProvider = currentAccountData.emailProviderName;
var sampleEmail = currentAccountData.sampleEmail;
var sampleUserName = currentAccountData.sampleUserName;
var emailIDDesc = currentAccountData.emailIDDescription;
var emailIDTitle = currentAccountData.emailIDFieldTitle;
if (emailProvider &&
sampleEmail &&
sampleUserName &&
emailIDDesc &&
emailIDTitle)
{
// Get email description data
displayText = Bundle.GetStringFromName("customizedEmailText")
.replace(/%emailProvider%/g, emailProvider)
.replace(/%mailIDDesc%/g, emailIDDesc)
.replace(/%sampleEmail%/, sampleEmail)
.replace(/%sampleUserName%/, sampleUserName);
// Set emailfield label
emailFieldLabelData = emailIDTitle;
emailFieldLabel.setAttribute("value", emailFieldLabelData);
// Need to display customized data. Turn off default settings.
setDefaultEmailDescStrings = false;
}
}
if (setDefaultEmailDescStrings)
{
// Check for obtained values and set with default values if needed
var username = Bundle.GetStringFromName("exampleEmailUserName");
var domain = Bundle.GetStringFromName("exampleEmailDomain");
displayText = Bundle.GetStringFromName("defaultEmailText")
.replace(/%username%/, username)
.replace(/%domain%/, domain);
}
// Create a text nodes with text to be displayed
var emailDescTextNode = document.createTextNode(displayText);
// Display the dynamically generated text for email description
emailDescText.appendChild(emailDescTextNode);
}
// retrieve the current domain from the parent wizard window, // retrieve the current domain from the parent wizard window,
// and update the UI to add the @domain static text // and update the UI to add the @domain static text
function checkForDomain() function checkForDomain()

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

@ -38,24 +38,34 @@ Rights Reserved.
<box class="box-header" title="&identityTitle.label;"/> <box class="box-header" title="&identityTitle.label;"/>
<separator/> <separator/>
<box class="box-wizardcontent" orient="vertical" flex="1"> <box class="box-wizardcontent" orient="vertical" flex="1">
<html>&identityDesc.label;</html> <html>&identityDesc.label;</html>
<separator/> <separator/>
<html>&fullnameDesc.label; &fullnameExample.label;</html> <html>&fullnameDesc.label; &fullnameExample.label;</html>
<separator class="thin"/> <separator class="thin"/>
<box autostretch="never"> <box autostretch="never">
<text class="label" for="fullName" value="&fullnameLabel.label;" style="width: 8em;"/> <text class="awIdentityLabel" for="fullName" value="&fullnameLabel.label;"/>
<textfield mailtype="identity" wsm_persist="true" name="fullName" id="fullName" flex="6"/> <textfield mailtype="identity" wsm_persist="true" name="fullName" id="fullName" flex="6"/>
</box> </box>
<separator/> <separator/>
<html>&emailDesc.label; &emailExample.label;</html> <grid>
<separator class="thin"/> <columns>
<box autostretch="never"> <column flex="1"/>
<text class="label" for="email" value="&emailLabel.label;" style="width: 8em;"/> </columns>
<textfield wsm_persist="true" mailtype="identity" name="email" id="email" flex="6"/> <rows>
<text id="postEmailText"/> <row>
</box> <html id="emailDescText"/>
</row>
<separator class="thin"/>
<row>
<box autostretch="never">
<text class="awIdentityLabel" id="emailFieldLabel" value="&emailLabel.label;"/>
<textfield wsm_persist="true" mailtype="identity" name="email" id="email" flex="6"/>
<text id="postEmailText"/>
</box>
</row>
</rows>
</grid>
</box> </box>
</window> </window>

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

@ -3,6 +3,11 @@
<!ENTITY completionText.label "You have entered all the information required to set up this account."> <!ENTITY completionText.label "You have entered all the information required to set up this account.">
<!ENTITY userNamePrefix.label "User Name:"> <!ENTITY userNamePrefix.label "User Name:">
<!ENTITY emailPrefix.label "Email Address:"> <!ENTITY emailPrefix.label "Email Address:">
<!ENTITY serverTypePrefix.label "Incoming Server Type:">
<!ENTITY serverNamePrefix.label "Incoming Server Name:">
<!ENTITY smtpServerNamePrefix.label "SMTP Server Name:">
<!ENTITY newsServerNamePrefix.label "News Server Name:">
<!ENTITY accountNamePrefix.label "Account Name:">
<!ENTITY setupAnother.label "Click Set up Another to save these settings and set up another account."> <!ENTITY setupAnother.label "Click Set up Another to save these settings and set up another account.">
<!ENTITY clickFinish.label "Click Finish to save these settings and exit the Account Wizard."> <!ENTITY clickFinish.label "Click Finish to save these settings and exit the Account Wizard.">
<!ENTITY setupAnotherButton.label "Set up Another..."> <!ENTITY setupAnotherButton.label "Set up Another...">

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

@ -12,7 +12,4 @@
<!ENTITY fullnameExample.label "(For example, &quot;John Smith&quot;)"> <!ENTITY fullnameExample.label "(For example, &quot;John Smith&quot;)">
<!ENTITY fullnameLabel.label "Your Name:"> <!ENTITY fullnameLabel.label "Your Name:">
<!ENTITY emailDesc.label "Enter your email address. This is the address others will use to send email to you.">
<!-- LOCALIZATION NOTE (fullnameDesc.label) : do not translate "&quot;example@netscape.net&quot;" in below line -->
<!ENTITY emailExample.label "(For example, &quot;example@netscape.net&quot;)">
<!ENTITY emailLabel.label "Email Address:"> <!ENTITY emailLabel.label "Email Address:">

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

@ -38,6 +38,12 @@ failedDeleteAccount=Failed to delete this account.
failedDuplicateAccount=Failed to duplicate this account. failedDuplicateAccount=Failed to duplicate this account.
confirmDeleteAccount=Are you sure you want to delete this account? confirmDeleteAccount=Are you sure you want to delete this account?
#Provide default example values for sample email address
exampleEmailUserName=example
exampleEmailDomain=netscape.net
defaultEmailText=Enter your email address. This is the address others will use to send email to you. (For example, "%username%@%domain%".)
customizedEmailText=Enter your %emailProvider% %mailIDDesc%. (For example, if your %emailProvider% email address is "%sampleEmail%", your %mailIDDesc% is "%sampleUserName%".)
# account manager stuff # account manager stuff
prefPanel-server=Server prefPanel-server=Server
prefPanel-copies=Copies and Folders prefPanel-copies=Copies and Folders

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

@ -186,6 +186,9 @@ interface nsIMsgIncomingServer : nsISupports {
/* used for comparing nsIMsgIncomingServers */ /* used for comparing nsIMsgIncomingServers */
boolean equals(in nsIMsgIncomingServer server); boolean equals(in nsIMsgIncomingServer server);
/* Get Messages at startup */
readonly attribute boolean downloadMessagesAtStartup;
/** /**
* can this server be removed from the account manager? for * can this server be removed from the account manager? for
* instance, local mail is not removable, but an imported folder is * instance, local mail is not removable, but an imported folder is

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

@ -25,7 +25,6 @@
//The eventual goal is for this file to go away and for the functions to either be brought into //The eventual goal is for this file to go away and for the functions to either be brought into
//mailCommands.js or into 3pane specific code. //mailCommands.js or into 3pane specific code.
var gFolderJustSwitched = false; var gFolderJustSwitched = false;
var gBeforeFolderLoadTime; var gBeforeFolderLoadTime;
var gRDFNamespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; var gRDFNamespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
@ -180,9 +179,19 @@ function ChangeFolderByURI(uri, isThreaded, sortID, sortDirection, viewType)
//if it's a server, clear the threadpane and don't bother trying to load. //if it's a server, clear the threadpane and don't bother trying to load.
if(msgfolder.isServer) if(msgfolder.isServer)
{ {
ClearThreadPane(); ClearThreadPane();
// Load AccountCentral page here.
ShowAccountCentral();
return; return;
} }
// If the user clicks on msgfolder, time to display thread pane and message pane.
// Hide AccountCentral page
if (gAccountCentralLoaded)
{
HideAccountCentral();
}
if (showPerformance) { if (showPerformance) {
gBeforeFolderLoadTime = new Date(); gBeforeFolderLoadTime = new Date();
@ -777,7 +786,8 @@ function FolderPaneSelectionChange()
ClearThreadPane(); ClearThreadPane();
} }
} }
ClearMessagePane(); if (!gAccountCentralLoaded)
ClearMessagePane();
} }

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

@ -54,7 +54,10 @@ var messageDSContractID = datasourceContractIDPrefix + "mailnewsmessages"
var accountManagerDataSource; var accountManagerDataSource;
var folderDataSource; var folderDataSource;
var messageDataSource; var messageDataSource;
var messagesBox = null;
var accountCentralBox = null;
var gAccountCentralLoaded = false;
//End progress and Status variables //End progress and Status variables
function OnMailWindowUnload() function OnMailWindowUnload()
@ -153,6 +156,8 @@ function CreateMailWindowGlobals()
folderDataSource = Components.classes[folderDSContractID].createInstance(); folderDataSource = Components.classes[folderDSContractID].createInstance();
messageDataSource = Components.classes[messageDSContractID].createInstance(); messageDataSource = Components.classes[messageDSContractID].createInstance();
messagesBox = document.getElementById("messagesBox");
accountCentralBox = document.getElementById("accountCentralBox");
} }
function InitMsgWindow() function InitMsgWindow()
@ -391,3 +396,55 @@ function loadStartPage() {
} }
} }
// Display AccountCentral page when users clicks on the Account Folder.
// When AccountCentral page need to be shown, we need to hide
// the box containing threadPane, splitter and messagePane.
// Load iframe in the AccountCentral box with corresponding page
function ShowAccountCentral()
{
try {
var acctCentralPage = pref.getLocalizedUnicharPref("mailnews.account_central_page.url");
messagesBox.setAttribute("hidden", "true");
accountCentralBox.removeAttribute("hidden");
window.frames["accountCentralPane"].location = acctCentralPage;
gAccountCentralLoaded = true;
}
catch (ex) {
dump("Error loading AccountCentral page -> " + ex + "\n");
return;
}
}
// Display thread and message panes with splitter when user tries
// to read messages by clicking on msgfolders. Hide AccountCentral
// box and display message box.
function HideAccountCentral()
{
try {
accountCentralBox.setAttribute("hidden", "true");
messagesBox.removeAttribute("hidden");
gAccountCentralLoaded = false;
}
catch (ex) {
dump("Error hiding AccountCentral page -> " + ex + "\n");
return;
}
}
// Given the server, open the twisty and the set the selection
// on inbox of that server
function OpenInboxForServer(server)
{
try {
HideAccountCentral();
OpenTwistyForServer(server);
var inboxFolder = GetInboxFolder(server);
var folderTree = GetFolderTree();
var inboxFolderUri = document.getElementById(inboxFolder.URI);
ChangeSelection(folderTree, inboxFolderUri);
}
catch (ex) {
dump("Error opening inbox for server -> " + ex + "\n");
return;
}
}

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

@ -208,6 +208,36 @@ function GetFirstSelectedMsgFolder()
return result; return result;
} }
function GetInboxFolder(server)
{
try {
var rootFolder = server.RootFolder;
var rootMsgFolder = rootFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
//now find Inbox
var outNumFolders = new Object();
var inboxFolder = rootMsgFolder.getFoldersWithFlag(0x1000, 1, outNumFolders);
return inboxFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
}
catch (ex) {
dump(ex + "\n");
}
return null;
}
function GetMessagesForInboxOnServer(server)
{
var inboxFolder = GetInboxFolder(server);
if (!inboxFolder) return;
var folders = new Array(1);
folders[0] = inboxFolder;
var compositeDataSource = GetCompositeDataSource("GetNewMessages");
GetNewMessages(folders, compositeDataSource);
}
function MsgGetMessage() function MsgGetMessage()
{ {
var folders = GetSelectedMsgFolders(); var folders = GetSelectedMsgFolders();
@ -215,6 +245,37 @@ function MsgGetMessage()
GetNewMessages(folders, compositeDataSource); GetNewMessages(folders, compositeDataSource);
} }
function MsgGetMessagesForAllServers(defaultServer)
{
// now log into any server
try
{
var allServers = accountManager.allServers;
for (var i=0;i<accountManager.allServers.Count();i++)
{
var currentServer = accountManager.allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
var protocolinfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" + currentServer.type].getService(Components.interfaces.nsIMsgProtocolInfo);
if (protocolinfo.canLoginAtStartUp && currentServer.loginAtStartUp)
{
if (defaultServer && defaultServer.equals(currentServer))
{
dump(currentServer.serverURI + "...skipping, already opened\n");
}
else
{
// this assumes "logging is" means getting message on the inbox...is that always true?
GetMessagesForInboxOnServer(currentServer);
}
}
}
}
catch(ex)
{
dump(ex + "\n");
}
}
function MsgGetNextNMessages() function MsgGetNextNMessages()
{ {
var folder = GetFirstSelectedMsgFolder(); var folder = GetFirstSelectedMsgFolder();

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

@ -62,6 +62,7 @@ Rights Reserved.
<script type="text/javascript" src="chrome://messenger/content/mailContextMenus.js"/> <script type="text/javascript" src="chrome://messenger/content/mailContextMenus.js"/>
<script type="text/javascript" src="chrome://messenger/content/messengerdnd.js"/> <script type="text/javascript" src="chrome://messenger/content/messengerdnd.js"/>
<script type="text/javascript" src="chrome://messenger/content/accountUtils.js"/> <script type="text/javascript" src="chrome://messenger/content/accountUtils.js"/>
<script type="text/javascript" src="chrome://messenger/content/msgAccountCentral.js"/>
<script type="text/javascript" src="chrome://communicator/content/contentAreaClick.js"/> <script type="text/javascript" src="chrome://communicator/content/contentAreaClick.js"/>
<script type="text/javascript" src="chrome://communicator/content/contentAreaDD.js"/> <script type="text/javascript" src="chrome://communicator/content/contentAreaDD.js"/>
<script type="text/javascript" src="chrome://global/content/nsJSSupportsUtils.js"/> <script type="text/javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
@ -134,6 +135,12 @@ Rights Reserved.
<splitter id="sidebar-splitter"/> <splitter id="sidebar-splitter"/>
<box orient="vertical" flex="1"> <box orient="vertical" flex="1">
<box id="accountCentralBox" orient="vertical" flex="1">
<iframe name="accountCentralPane" flex="1" src="about:blank"/>
</box>
<box id="messagesBox" orient="vertical" flex="1">
<tree id="threadTree" flex="2" persist="height" style="height:0px" context="threadPaneContext" focusring="false"/> <tree id="threadTree" flex="2" persist="height" style="height:0px" context="threadPaneContext" focusring="false"/>
@ -152,7 +159,8 @@ Rights Reserved.
<statusbarpanel id="unreadMessageCount" style="min-width: 5px"/> <statusbarpanel id="unreadMessageCount" style="min-width: 5px"/>
<statusbarpanel id="totalMessageCount" style="min-width: 5px"/> <statusbarpanel id="totalMessageCount" style="min-width: 5px"/>
</statusbar> </statusbar>
</box> </box>
</box>
</box> </box>

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

@ -0,0 +1,163 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*/
var selectedServer = null;
var brandBundle = null;
var msgBundle = null;
function OnInit()
{
var title = null;
var titleElement = null;
var brandName = null;
var acctType = null;
var acctName = null;
// Set the header for the page.
// Title containts the brand name of the application and the account
// type (mail/news) and the name of the account
try {
// Get title element from the document
titleElement = document.getElementById("AccountCentralTitle");
// Get the brand name
brandBundle = srGetStrBundle("chrome://global/locale/brand.properties");
brandName = brandBundle.GetStringFromName("brandShortName");
// Get the account type
msgBundle = srGetStrBundle("chrome://messenger/locale/messenger.properties");
selectedServer = GetSelectedServer();
var serverType = selectedServer.type;
if (serverType == "nntp")
acctType = msgBundle.GetStringFromName("newsAcctType");
else
acctType = msgBundle.GetStringFromName("mailAcctType");
// Get the account name
acctName = GetSelectedMsgFolderName();
title = msgBundle.GetStringFromName("acctCentralTitleFormat")
.replace(/%brandName%/, brandName)
.replace(/%accountType%/, acctType)
.replace(/%accountName%/, acctName);
titleElement.setAttribute("value", title);
// Display and collapse items presented to the user based on account type
ArrangeAccountCentralItems(serverType);
}
catch(ex) {
dump("Error -> " + ex + "\n");
}
}
function ArrangeAccountCentralItems(serverType)
{
if (serverType == "nntp")
ShowOnlyNewsItems();
else
ShowOnlyMailItems();
}
// From the current folder tree, return the selected server
function GetSelectedServer()
{
var folderURI = window.parent.GetSelectedFolderURI();
var server = GetServer(folderURI);
return server;
}
// From the current folder tree, return the name of the folder selected
function GetSelectedMsgFolderName()
{
var folderURI = window.parent.GetSelectedFolderURI();
var msgFolder = window.parent.GetMsgFolderFromURI(folderURI);
return msgFolder.prettyName;
}
// Base AccountCentral page has items pertained to both mail and news.
// For news, we collapse all unwanted mail items and display all news items
function ShowOnlyNewsItems()
{
try {
document.getElementById("ReadMessages").setAttribute("collapsed", "true");
document.getElementById("CreateFilters").setAttribute("collapsed", "true");
}
catch(ex) {
dump("Error -> " + ex + "\n");
}
}
// Base AccountCentral page has items pertained to both mail and news.
// For mail, we collapse all unwanted news items and display all mail items
function ShowOnlyMailItems()
{
try {
document.getElementById("ReadMessages").removeAttribute("collapsed");
document.getElementById("CreateFilters").removeAttribute("collapsed");
}
catch(ex) {
dump("Error -> " + ex + "\n");
}
}
// Open Inbox for selected server.
// If needed, open th twsity and select Inbox.
function ReadMessages()
{
try {
window.parent.OpenInboxForServer(selectedServer);
}
catch(ex) {
dump("Error -> " + ex + "\n");
}
}
// Trigger composer for a new message
function ComposeAMessage(event)
{
window.parent.MsgNewMessage();
}
// Open AccountManager to view settings for a given account
function ViewSettings()
{
window.parent.MsgAccountManager();
}
// Open AccountWizard to create an account
function CreateNewAccount()
{
window.parent.msgOpenAccountWizard();
}
// Bring up search interface for selected account
function SearchMessages()
{
window.parent.MsgSearchMessages();
}
// Open filters window
function CreateMsgFilters()
{
window.parent.MsgFilters();
}

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

@ -0,0 +1,138 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://messenger/skin/msgAccountCentral.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
%brandDTD;
<!ENTITY % acctCentralDTD SYSTEM "chrome://messenger/locale/msgAccountCentral.dtd">
%acctCentralDTD;
]>
<window
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="OnInit();">
<script language="javascript" src="chrome://global/content/strres.js"/>
<script type="text/javascript" src="chrome://messenger/content/AccountManager.js"/>
<script type="text/javascript" src="chrome://messenger/content/accountUtils.js"/>
<script type="text/javascript" src="chrome://messenger/content/mailCommands.js"/>
<script type="text/javascript" src="chrome://messenger/content/commandglue.js"/>
<script type="text/javascript" src="chrome://messenger/content/mailWindowOverlay.js"/>
<script type="text/javascript" src="chrome://messenger/content/mailWindow.js"/>
<script type="text/javascript" src="chrome://messenger/content/msgMail3PaneWindow.js"/>
<script type="text/javascript" src="chrome://messenger/content/widgetglue.js"/>
<script type="text/javascript" src="chrome://messenger/content/msgAccountCentral.js"/>
<grid flex="1" id="acctCentralGrid">
<columns>
<column flex="40" id="acctCentralActionsColumn"/>
<column flex="60" id="acctCentralHelpDataColumn"/>
</columns>
<rows>
<row id="acctCentralHeaderRow">
<text class="label" id="AccountCentralTitle"/>
</row>
<separator/>
<row id="EmailHeader" class="acctCentralTitleRow">
<box class="acctCentralRowTitleBox">
<html>&emailSectionHdr.label;</html>
</box>
</row>
<separator class="thin"/>
<row id="ReadMessages" class="acctCentralRow">
<box>
<text class="acctCentralText acctCentralLinkText" value="&readMsgsLink.label;" onclick="ReadMessages();"/>
<text class="acctCentralText" value="&spacer.label;"/>
<text class="acctCentralText" value="&readMsgsSuffix.label;"/>
</box>
</row>
<separator class="thin"/>
<row id="ComposeMessage" class="acctCentralRow">
<box>
<text class="acctCentralText acctCentralLinkText" value="&composeMsgLink.label;" onclick="ComposeAMessage();"/>
<text class="acctCentralText" value="&spacer.label;"/>
<text class="acctCentralText" value="&composeMsgSuffix.label;"/>
</box>
</row>
<separator/>
<separator/>
<separator/>
<row id="AccountsHeader" class="acctCentralTitleRow">
<box class="acctCentralRowTitleBox">
<html>&accountsSectionHdr.label;</html>
</box>
</row>
<separator class="thin"/>
<row id="AccountSettings" class="acctCentralRow">
<box>
<text class="acctCentralText" value="&settingsPrefix.label;"/>
<text class="acctCentralText" value="&spacer.label;"/>
<text class="acctCentralText acctCentralLinkText" value="&settingsLink.label;" onclick="ViewSettings();"/>
<text class="acctCentralText" value="&spacer.label;"/>
<text class="acctCentralText" value="&settingsSuffix.label;"/>
</box>
</row>
<separator class="thin"/>
<row id="CreateAccount" class="acctCentralRow">
<box>
<text class="acctCentralText" value="&newAcctPrefix.label;"/>
<text class="acctCentralText" value="&spacer.label;"/>
<text class="acctCentralText acctCentralLinkText" value="&newAcctLink.label;" onclick="CreateNewAccount();"/>
</box>
</row>
<separator/>
<separator/>
<separator/>
<row id="AdvancedFeaturesHeader" class="acctCentralTitleRow">
<box class="acctCentralRowTitleBox">
<html>&advFeaturesSectionHdr.label;</html>
</box>
</row>
<separator class="thin"/>
<row id="SearchMessages" class="acctCentralRow">
<box>
<text class="acctCentralText acctCentralLinkText" value="&searchMsgsLink.label;" onclick="SearchMessages();"/>
<text class="acctCentralText" value="&spacer.label;"/>
<text class="acctCentralText" value="&searchMsgsSuffix.label;"/>
</box>
</row>
<separator class="thin"/>
<row id="CreateFilters" class="acctCentralRow">
<box>
<text class="acctCentralText" value="&filtersPrefix.label;"/>
<text class="acctCentralText" value="&spacer.label;"/>
<text class="acctCentralText acctCentralLinkText" value="&filtersLink.label;" onclick="CreateMsgFilters();"/>
</box>
</row>
</rows>
</grid>
</window>

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

@ -235,6 +235,7 @@ function OnLoadMessenger()
Create3PaneGlobals(); Create3PaneGlobals();
verifyAccounts(); verifyAccounts();
HideAccountCentral();
loadStartPage(); loadStartPage();
InitMsgWindow(); InitMsgWindow();
@ -368,53 +369,115 @@ function PerformExpandForAllOpenServers(tree)
} }
} }
function loadStartFolder(startFolderUri) function loadStartFolder(initialUri)
{ {
//First get default account var defaultServer = null;
try var startFolderUri = initialUri;
{
if(!startFolderUri)
{
var defaultAccount = accountManager.defaultAccount;
var server = defaultAccount.incomingServer; //First get default account
var rootFolder = server.RootFolder; try
var rootMsgFolder = rootFolder.QueryInterface(Components.interfaces.nsIMsgFolder); {
if(!startFolderUri)
{
var defaultAccount = accountManager.defaultAccount;
//now find Inbox defaultServer = defaultAccount.incomingServer;
var outNumFolders = new Object(); var rootFolder = defaultServer.RootFolder;
var inboxFolder = rootMsgFolder.getFoldersWithFlag(0x1000, 1, outNumFolders); var rootMsgFolder = rootFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
if(!inboxFolder) return;
var resource = inboxFolder.QueryInterface(Components.interfaces.nsIRDFResource); //now find Inbox
startFolderUri = resource.Value; var outNumFolders = new Object();
var inboxFolder = rootMsgFolder.getFoldersWithFlag(0x1000, 1, outNumFolders);
if(!inboxFolder) return;
//first, let's see if it's already in the dom. This will make life easier. var resource = inboxFolder.QueryInterface(Components.interfaces.nsIRDFResource);
//We need to make sure content is built by this time startFolderUri = resource.Value;
}
msgNavigationService.EnsureDocumentIsLoaded(document);
var startFolder = document.getElementById(startFolderUri); //first, let's see if it's already in the dom. This will make life easier.
//We need to make sure content is built by this time
}
msgNavigationService.EnsureDocumentIsLoaded(document);
//if it's not here we will have to make sure it's open. var startFolder = document.getElementById(startFolderUri);
if(!startFolder)
{
} //if it's not here we will have to make sure it's open.
if(!startFolder && startFolderUri && defaultServer)
{
// Opens the twisty for the default account
OpenTwistyForServer(defaultServer);
startFolder = document.getElementById(startFolderUri);
}
var folderTree= GetFolderTree(); var folderTree= GetFolderTree();
ChangeSelection(folderTree, startFolder); ChangeSelection(folderTree, startFolder);
// only do this on startup, when we pass in null
if (!initialUri && defaultServer)
{
// Start downloading messages for the INBOX of the default server
TriggerGetMessages(defaultServer);
}
// because the "open" state persists, we'll call // because the "open" state persists, we'll call
// PerformExpand() for all servers that are open at startup. // PerformExpand() for all servers that are open at startup.
PerformExpandForAllOpenServers(folderTree); PerformExpandForAllOpenServers(folderTree);
} }
catch(ex) catch(ex)
{ {
dump(ex); dump(ex);
dump('Exception in LoadStartFolder caused by no default account. We know about this\n'); dump('Exception in LoadStartFolder caused by no default account. We know about this\n');
} }
if (!initialUri)
{
MsgGetMessagesForAllServers(defaultServer);
}
}
function OpenTwistyForServer(server)
{
var treeNode = GetTreeNodeForServerURI(server.serverURI);
if (treeNode)
treeNode.setAttribute('open', 'true');
}
function GetTreeNodeForServerURI(serverURI)
{
var treeNode = null;
var tree = GetFolderTree();
// Iterate through folder tree to find the node associated with given serverURI
if ( tree && tree.childNodes ) {
for ( var i = tree.childNodes.length - 1; i >= 0; i-- ) {
var treechild = tree.childNodes[i];
if (treechild.localName == 'treechildren') {
var treeitems = treechild.childNodes;
for ( var j = treeitems.length - 1; j >= 0; j--) {
var isServer = treeitems[j].getAttribute('IsServer');
if (isServer == "true") {
var uri = treeitems[j].getAttribute('id');
if (uri == serverURI) {
treeNode = treeitems[j];
break;
}
}
}
}
}
}
return treeNode;
}
function TriggerGetMessages(server)
{
// downloadMessagesAtStartup for a given server type indicates whether
// or not there is a need to Trigger GetMessages action
if (server.downloadMessagesAtStartup)
MsgGetMessage();
} }
function AddToSession() function AddToSession()

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

@ -136,6 +136,12 @@ In the future, you can select which messages or folders to read offline. To do \
this, choose Offline from the file menu and then select Synchronize. You can \n\ this, choose Offline from the file menu and then select Synchronize. You can \n\
adjust the Disk Space preference to prevent the downloading of large messages. adjust the Disk Space preference to prevent the downloading of large messages.
# accountCentral
mailnews.account_central_page.url=chrome://messenger/content/msgAccountCentral.xul
acctCentralTitleFormat=%brandName% %accountType% for %accountName%
mailAcctType=Mail
newsAcctType=News
# LOCALIZATION NOTES(nocachedbodytitle): Do not translate "<TITLE>" or "</TITLE>" in the line below # LOCALIZATION NOTES(nocachedbodytitle): Do not translate "<TITLE>" or "</TITLE>" in the line below
nocachedbodytitle=<TITLE>Go Online to View This Message</TITLE>\n\ nocachedbodytitle=<TITLE>Go Online to View This Message</TITLE>\n\

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

@ -0,0 +1,40 @@
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!ENTITY emailSectionHdr.label "Email">
<!ENTITY readMsgsLink.label "Read">
<!ENTITY readMsgsSuffix.label "my Email messages">
<!ENTITY composeMsgLink.label "Compose">
<!ENTITY composeMsgSuffix.label "a new message">
<!ENTITY accountsSectionHdr.label "Accounts">
<!ENTITY settingsPrefix.label "View">
<!ENTITY settingsLink.label "Settings">
<!ENTITY settingsSuffix.label "for this account">
<!ENTITY newAcctPrefix.label "Create a">
<!ENTITY newAcctLink.label "new account">
<!ENTITY advFeaturesSectionHdr.label "Advanced Features">
<!ENTITY searchMsgsLink.label "Search">
<!ENTITY searchMsgsSuffix.label "my messages">
<!ENTITY filtersPrefix.label "Create message">
<!ENTITY filtersLink.label "filters">
<!ENTITY spacer.label " ">

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

@ -177,6 +177,14 @@ nsMsgIncomingServer::CloseCachedConnections()
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsMsgIncomingServer::GetDownloadMessagesAtStartup(PRBool *getMessagesAtStartup)
{
// derived class should override if they need to do this.
*getMessagesAtStartup = PR_FALSE;
return NS_OK;
}
// construct <localStoreType>://[<username>@]<hostname // construct <localStoreType>://[<username>@]<hostname
NS_IMETHODIMP NS_IMETHODIMP
nsMsgIncomingServer::GetServerURI(char* *aResult) nsMsgIncomingServer::GetServerURI(char* *aResult)

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

@ -99,6 +99,8 @@ messenger.jar:
content/messenger/newFolderDialog.js (base/resources/content/newFolderDialog.js) content/messenger/newFolderDialog.js (base/resources/content/newFolderDialog.js)
content/messenger/msgViewNavigation.js (base/resources/content/msgViewNavigation.js) content/messenger/msgViewNavigation.js (base/resources/content/msgViewNavigation.js)
content/messenger/msgMail3PaneWindow.js (base/resources/content/msgMail3PaneWindow.js) content/messenger/msgMail3PaneWindow.js (base/resources/content/msgMail3PaneWindow.js)
content/messenger/msgAccountCentral.xul (base/resources/content/msgAccountCentral.xul)
content/messenger/msgAccountCentral.js (base/resources/content/msgAccountCentral.js)
content/messenger/mail3PaneWindowCommands.js (base/resources/content/mail3PaneWindowCommands.js) content/messenger/mail3PaneWindowCommands.js (base/resources/content/mail3PaneWindowCommands.js)
content/messenger/msgFolderPickerOverlay.js (base/resources/content/msgFolderPickerOverlay.js) content/messenger/msgFolderPickerOverlay.js (base/resources/content/msgFolderPickerOverlay.js)
content/messenger/msgFolderPickerOverlay.xul (base/resources/content/msgFolderPickerOverlay.xul) content/messenger/msgFolderPickerOverlay.xul (base/resources/content/msgFolderPickerOverlay.xul)
@ -171,6 +173,7 @@ en-US.jar:
locale/en-US/messenger/addressbook/abMailListDialog.dtd (addrbook/resources/locale/en-US/abMailListDialog.dtd) locale/en-US/messenger/addressbook/abMailListDialog.dtd (addrbook/resources/locale/en-US/abMailListDialog.dtd)
locale/en-US/messenger/addressbook/addressBook.properties (addrbook/resources/locale/en-US/addressBook.properties) locale/en-US/messenger/addressbook/addressBook.properties (addrbook/resources/locale/en-US/addressBook.properties)
locale/en-US/messenger/messenger.dtd (base/resources/locale/en-US/messenger.dtd) locale/en-US/messenger/messenger.dtd (base/resources/locale/en-US/messenger.dtd)
locale/en-US/messenger/msgAccountCentral.dtd (base/resources/locale/en-US/msgAccountCentral.dtd)
locale/en-US/messenger/messenger.properties (base/resources/locale/en-US/messenger.properties) locale/en-US/messenger/messenger.properties (base/resources/locale/en-US/messenger.properties)
locale/en-US/messenger/threadpane.dtd (base/resources/locale/en-US/threadpane.dtd) locale/en-US/messenger/threadpane.dtd (base/resources/locale/en-US/threadpane.dtd)
locale/en-US/messenger/folderpane.dtd (base/resources/locale/en-US/folderpane.dtd) locale/en-US/messenger/folderpane.dtd (base/resources/locale/en-US/folderpane.dtd)

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

@ -297,3 +297,13 @@ NS_IMETHODIMP nsPop3IncomingServer::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlL
rv = pop3Service->GetNewMail(aMsgWindow, aUrlListener, inbox, this, aResult); rv = pop3Service->GetNewMail(aMsgWindow, aUrlListener, inbox, this, aResult);
return rv; return rv;
} }
NS_IMETHODIMP
nsPop3IncomingServer::GetDownloadMessagesAtStartup(PRBool *getMessagesAtStartup)
{
// GetMessagese is not automatically done for pop servers at startup.
// We need to trigger that action. Return true.
*getMessagesAtStartup = PR_TRUE;
return NS_OK;
}

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

@ -44,7 +44,7 @@ public:
NS_IMETHOD GetLocalStoreType(char **); NS_IMETHOD GetLocalStoreType(char **);
NS_IMETHOD PerformBiff(); NS_IMETHOD PerformBiff();
NS_IMETHOD GetDownloadMessagesAtStartup(PRBool *getMessages);
private: private:
static nsresult setSubFolderFlag(nsIFolder *aRootFolder, static nsresult setSubFolderFlag(nsIFolder *aRootFolder,