backing out all of ben's JS changes as they were completely unreviewed and unapproved

This commit is contained in:
alecf%netscape.com 2000-09-07 11:33:09 +00:00
Родитель 2ff9437de0
Коммит c86ed00000
5 изменённых файлов: 64 добавлений и 104 удалений

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

@ -43,8 +43,6 @@
*/
var DEBUG_alecf = false;
/*
the account wizard path is something like:
@ -85,12 +83,6 @@ var gCurrentAccount;
// will eventually be dumped into the account
var gCurrentAccountData;
function _dd(aString)
{
if (DEBUG_alecf)
_dd(aString);
}
// event handlers
function onLoad() {
@ -129,7 +121,7 @@ function onFinish() {
return;
var pageData = GetPageData();
_dd(parent.wizardManager.WSM);
dump(parent.wizardManager.WSM);
var accountData= gCurrentAccountData;
@ -154,8 +146,8 @@ function onFinish() {
var prefs = Components.classes["component://netscape/preferences"].getService(Components.interfaces.nsIPref);
prefs.SavePrefFile();
} catch (ex) {
_dd("Error saving prefs!\n");
_dd("ex = " + ex + "\n");
dump("Error saving prefs!\n");
dump("ex = " + ex + "\n");
}
window.close();
}
@ -166,7 +158,7 @@ function onFinish() {
function AccountDataToPageData(accountData, pageData)
{
if (!accountData) {
_dd("null account data! clearing..\n");
dump("null account data! clearing..\n");
// handle null accountData as if it were an empty object
// so that we clear-out any old pagedata from a
// previous accountdata. The trick is that
@ -210,12 +202,12 @@ function AccountDataToPageData(accountData, pageData)
var identity;
if (accountData.identity) {
_dd("This is an accountdata\n");
dump("This is an accountdata\n");
identity = accountData.identity;
}
else if (accountData.identities) {
identity = accountData.identities.QueryElementAt(0, Components.interfaces.nsIMsgIdentity);
_dd("this is an account, id= " + identity + "\n");
dump("this is an account, id= " + identity + "\n");
}
setPageData(pageData, "identity", "email", identity.email);
@ -245,7 +237,7 @@ function PageDataToAccountData(pageData, accountData)
var server = accountData.incomingServer;
var smtp = accountData.smtp;
_dd("Setting identity for " + pageData.identity.email.value + "\n");
dump("Setting identity for " + pageData.identity.email.value + "\n");
identity.email = pageData.identity.email.value;
identity.fullName = pageData.identity.fullName.value;
@ -254,7 +246,7 @@ function PageDataToAccountData(pageData, accountData)
if (serverIsNntp(pageData)) {
// this stuff probably not relevant
_dd("not setting username/password/rememberpassword/etc\n");
dump("not setting username/password/rememberpassword/etc\n");
} else {
if (pageData.login) {
if (pageData.login.username)
@ -265,9 +257,9 @@ function PageDataToAccountData(pageData, accountData)
server.rememberPassword = pageData.login.rememberPassword.value;
}
_dd("pageData.server = " + pageData.server + "\n");
dump("pageData.server = " + pageData.server + "\n");
if (pageData.server) {
_dd("pageData.server.smtphostname.value = " + pageData.server.smtphostname + "\n");
dump("pageData.server.smtphostname.value = " + pageData.server.smtphostname + "\n");
if (pageData.server.smtphostname &&
pageData.server.smtphostname.value)
smtp.hostname = pageData.server.smtphostname.value;
@ -287,14 +279,14 @@ function createAccount(accountData)
{
var server = accountData.incomingServer;
_dd("am.createIncomingServer(" + server.username + "," +
dump("am.createIncomingServer(" + server.username + "," +
server.hostName + "," +
server.type + ")\n");
var server = am.createIncomingServer(server.username,
server.hostName,
server.type);
_dd("am.createIdentity()\n");
dump("am.createIdentity()\n");
var identity = am.createIdentity();
/* new nntp identities should use plain text by default
@ -303,7 +295,7 @@ function createAccount(accountData)
identity.composeHtml = false;
}
_dd("am.createAccount()\n");
dump("am.createAccount()\n");
var account = am.createAccount();
account.addIdentity(identity);
account.incomingServer = server;
@ -323,7 +315,7 @@ function finishAccount(account, accountData) {
// see if there are any protocol-specific attributes
// if so, we use the type to get the IID, QueryInterface
// as appropriate, then copy the data over
_dd("srcServer.ServerType-" + srcServer.type + " = " +
dump("srcServer.ServerType-" + srcServer.type + " = " +
srcServer["ServerType-" + srcServer.type] + "\n");
if (srcServer["ServerType-" + srcServer.type]) {
// handle server-specific stuff
@ -332,7 +324,7 @@ function finishAccount(account, accountData) {
destProtocolServer = destServer.QueryInterface(IID);
srcProtocolServer = srcServer["ServerType-" + srcServer.type];
_dd("Copying over " + srcServer.type + "-specific data\n");
dump("Copying over " + srcServer.type + "-specific data\n");
copyObjectToInterface(destProtocolServer, srcProtocolServer);
}
}
@ -364,7 +356,7 @@ function finishAccount(account, accountData) {
if (accountData.smtpCreateNewServer)
smtpServer = smtpService.createSmtpServer();
_dd("Copying smtpServer (" + smtpServer + ") to accountData\n");
dump("Copying smtpServer (" + smtpServer + ") to accountData\n");
copyObjectToInterface(smtpServer, accountData.smtp);
// some identities have 'preferred'
@ -387,9 +379,9 @@ function copyObjectToInterface(dest, src) {
dest[i] = src[i];
}
catch (ex) {
_dd("Error copying the " +
dump("Error copying the " +
i + " attribute: " + ex + "\n");
_dd("(This is ok if this is a ServerType-* attribute)\n");
dump("(This is ok if this is a ServerType-* attribute)\n");
}
}
}
@ -398,13 +390,13 @@ function copyObjectToInterface(dest, src) {
// if not, create it.
function verifyLocalFoldersAccount(account) {
_dd("Looking for Local Folders.....\n");
dump("Looking for Local Folders.....\n");
var localMailServer = null;
try {
localMailServer = am.localFoldersServer;
}
catch (ex) {
// _dd("exception in findserver: " + ex + "\n");
// dump("exception in findserver: " + ex + "\n");
localMailServer = null;
}
@ -418,7 +410,7 @@ function verifyLocalFoldersAccount(account) {
defaultCopiesAndFoldersPrefsToServer = protocolinfo.defaultCopiesAndFoldersPrefsToServer;
if (!localMailServer) {
// _dd("Creating local mail account\n");
// dump("Creating local mail account\n");
// creates a copy of the identity you pass in
messengerMigrator = Components.classes["component://netscape/messenger/migrator"].getService(Components.interfaces.nsIMessengerMigrator);
messengerMigrator.createLocalMailAccount(false /* false, since we are not migrating */);
@ -426,7 +418,7 @@ function verifyLocalFoldersAccount(account) {
localMailServer = am.localFoldersServer;
}
catch (ex) {
_dd("error! we should have found the local mail server after we created it.\n");
dump("error! we should have found the local mail server after we created it.\n");
localMailServer = null;
}
}
@ -437,7 +429,7 @@ function verifyLocalFoldersAccount(account) {
}
else {
if (!localMailServer) {
_dd("error! we should have a local mail server at this point\n");
dump("error! we should have a local mail server at this point\n");
return;
}
copiesAndFoldersServer = localMailServer;
@ -448,7 +440,7 @@ function verifyLocalFoldersAccount(account) {
} catch (ex) {
// return false (meaning we did not create the account)
// on any error
_dd("Error creating local mail: " + ex + "\n");
dump("Error creating local mail: " + ex + "\n");
return false;
}
return true;
@ -456,7 +448,7 @@ function verifyLocalFoldersAccount(account) {
function setDefaultCopiesAndFoldersPrefs(identity, server)
{
_dd("finding folders on server = " + server.hostName + "\n");
dump("finding folders on server = " + server.hostName + "\n");
var rootFolder = server.RootFolder;
@ -490,26 +482,26 @@ function setDefaultCopiesAndFoldersPrefs(identity, server)
if (stationeryFolder) identity.stationeryFolder = stationeryFolder.URI;
if (fccFolder) identity.fccFolder = fccFolder.URI;
_dd("fccFolder = " + identity.fccFolder + "\n");
_dd("draftFolder = " + identity.draftFolder + "\n");
_dd("stationeryFolder = " + identity.stationeryFolder + "\n");
dump("fccFolder = " + identity.fccFolder + "\n");
dump("draftFolder = " + identity.draftFolder + "\n");
dump("stationeryFolder = " + identity.stationeryFolder + "\n");
}
function AccountExists(userName,hostName,serverType)
{
_dd("AccountExists("+userName+","+hostName+","+serverType+")\n");
dump("AccountExists("+userName+","+hostName+","+serverType+")\n");
var accountExists = false;
var accountManager = Components.classes["component://netscape/messenger/account-manager"].getService(Components.interfaces.nsIMsgAccountManager);
try {
var server = accountManager.FindServer(userName,hostName,serverType);
if (server) {
_dd("account exists\n");
dump("account exists\n");
accountExists = true;
}
}
catch (ex) {
_dd("AccountExists() failed: "+ex+"\n");
dump("AccountExists() failed: "+ex+"\n");
accountExists = false;
}
return accountExists;
@ -529,7 +521,7 @@ function checkForInvalidAccounts()
if (firstInvalidAccount) {
var pageData = GetPageData();
_dd("We have an invalid account, " + firstInvalidAccount + ", let's use that!\n");
dump("We have an invalid account, " + firstInvalidAccount + ", let's use that!\n");
gCurrentAccount = firstInvalidAccount;
// there's a possibility that the invalid account has ISP defaults
@ -540,9 +532,9 @@ function checkForInvalidAccounts()
var identity =
firstInvalidAccount.identities.QueryElementAt(0, nsIMsgIdentity);
_dd("Invalid account: trying to get ISP data for " + identity.email + "\n");
dump("Invalid account: trying to get ISP data for " + identity.email + "\n");
var accountData = getIspDefaultsForEmail(identity.email);
_dd("Invalid account: Got " + accountData + "\n");
dump("Invalid account: Got " + accountData + "\n");
// account -> accountData -> pageData
AccountToAccountData(firstInvalidAccount, accountData);
@ -550,13 +542,13 @@ function checkForInvalidAccounts()
gCurrentAccountData = accountData;
_dd(parent.wizardManager.WSM);
dump(parent.wizardManager.WSM);
}
}
function AccountToAccountData(account, defaultAccountData)
{
_dd("AccountToAccountData(" + account + ", " +
dump("AccountToAccountData(" + account + ", " +
defaultAccountData + ")\n");
var accountData = defaultAccountData;
if (!accountData)
@ -638,10 +630,10 @@ function UpdateWizardMap() {
// conditions handled right now:
// -
function updateMap(pageData, wizardMap) {
_dd("Updating wizard map..\n");
dump("Updating wizard map..\n");
if (pageData.accounttype) {
var ismailaccount = pageData.accounttype.mailaccount
_dd("Accounttype is mail: " + (ismailaccount && ismailaccount.value) + "\n");
dump("Accounttype is mail: " + (ismailaccount && ismailaccount.value) + "\n");
// set up default account stuff
wizardMap.identity.next = "server";
wizardMap.done.previous = "accname";
@ -663,7 +655,7 @@ function updateMap(pageData, wizardMap) {
wizardMap.accname.previous = "newsserver";
}
else {
_dd("Handle other types (" + pageData.accounttype + ") here?\n");
dump("Handle other types (" + pageData.accounttype + ") here?\n");
}
}
@ -677,7 +669,7 @@ function GetPageData()
function PrefillAccountForIsp(ispName)
{
_dd("AccountWizard.prefillAccountForIsp(" + ispName + ")\n");
dump("AccountWizard.prefillAccountForIsp(" + ispName + ")\n");
var ispData = getIspDefaultsForUri(ispName);
@ -685,7 +677,7 @@ function PrefillAccountForIsp(ispName)
// prefill the rest of the wizard
_dd("PrefillAccountForISP: filling with " + ispData + "\n");
dump("PrefillAccountForISP: filling with " + ispData + "\n");
SetCurrentAccountData(ispData);
AccountDataToPageData(ispData, pageData);
}
@ -715,7 +707,7 @@ function FixupAccountDataForIsp(accountData)
function SetCurrentAccountData(accountData)
{
// _dd("Setting current account data (" + gCurrentAccountData + ") to " + accountData + "\n");
// dump("Setting current account data (" + gCurrentAccountData + ") to " + accountData + "\n");
gCurrentAccountData = accountData;
}
@ -729,7 +721,7 @@ function getInterfaceForType(type) {
return protoInfo.serverIID;
} catch (ex) {
_dd("could not get IID for " + type + ": " + ex + "\n");
dump("could not get IID for " + type + ": " + ex + "\n");
return undefined;
}
}

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

@ -21,13 +21,6 @@
* Alec Flett <alecf@netscape.com>
*/
var DEBUG_alecf = false;
function _dd(aString)
{
if (DEBUG_alecf)
dump(aString);
}
function onInit() {
fixLabels(document.getElementById("ispBox"));
@ -57,7 +50,7 @@ function preselectRadioButtons()
}
} catch (ex) {
_dd("Error preselecting a radio button: " + ex + "!\n");
dump("Error preselecting a radio button: " + ex + "!\n");
}
}
@ -65,17 +58,17 @@ function preselectRadioButtons()
// basically: templates can't set the "id" attribute on a node, so we
// have to set "fakeid" and then transfer it manually
function fixLabels(box) {
_dd("Fixing labels on " + box + "\n");
dump("Fixing labels on " + box + "\n");
if (!box) return;
var child = box.firstChild;
_dd("starting looking with " + child + "\n");
dump("starting looking with " + child + "\n");
var haveDynamicInputs = false;
while (child) {
_dd("found child: " + child + "\n");
dump("found child: " + child + "\n");
if (child.localName.toLowerCase() == "radio") {
_dd("Found dynamic inputs!\n");
dump("Found dynamic inputs!\n");
haveDynamicInputs = true;
}
@ -84,11 +77,11 @@ function fixLabels(box) {
if (haveDynamicInputs) {
var subButtons = document.getElementById("ispchoice");
_dd("** Have dynamic inputs: showing " + subButtons + "\n");
dump("** Have dynamic inputs: showing " + subButtons + "\n");
subButtons.removeAttribute("hidden");
var otherIspRadio = document.getElementById("otherIspRadio");
_dd("** Also showing the other ISP button\n");
dump("** Also showing the other ISP button\n");
otherIspRadio.removeAttribute("hidden");
}
}
@ -114,7 +107,7 @@ function enableControls(container, enabled)
function enableIspButtons(child, enabled)
{
_dd("disabling " + child.id + "\n");
dump("disabling " + child.id + "\n");
if (enabled)
child.removeAttribute("disabled");
else
@ -123,7 +116,7 @@ function enableIspButtons(child, enabled)
}
function onUnload() {
_dd("OnUnload!\n");
dump("OnUnload!\n");
parent.UpdateWizardMap();
initializeIspData();
@ -147,13 +140,13 @@ function initializeIspData()
var formElement = controls[i];
if (formElement.getAttribute("group") == "ispchoice" &&
formElement.checked) {
_dd("ispName = " + formElement.id + "\n");
dump("ispName = " + formElement.id + "\n");
ispName = formElement.id;
break;
}
}
_dd("initializing ISP data for " + ispName + "\n");
dump("initializing ISP data for " + ispName + "\n");
if (!ispName || ispName == "") return;

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

@ -22,13 +22,6 @@
* Seth Spitzer <sspitzer@netscape.com>
*/
var DEBUG_alecf = false;
function _dd(aString)
{
if (DEBUG_alecf)
dump(aString);
}
var protocolinfo = null;
var Bundle = srGetStrBundle("chrome://messenger/locale/prefs.properties");
@ -61,7 +54,7 @@ function onInit() {
var pageData = parent.wizardManager.WSM.PageData;
var type = parent.getCurrentServerType(pageData);
_dd("type = " + type + "\n");
dump("type = " + type + "\n");
protocolinfo = Components.classes["component://netscape/messenger/protocol/info;type=" + type].getService(Components.interfaces.nsIMsgProtocolInfo);
if (protocolinfo.requiresUsername) {
@ -77,7 +70,7 @@ function onInit() {
var savedPassword="";
function onSavePassword(target) {
_dd("savePassword changed! (" + target.checked + ")\n");
dump("savePassword changed! (" + target.checked + ")\n");
var passwordField = document.getElementById("server.password");
if (!passwordField) return;

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

@ -91,20 +91,9 @@ function hideShowSmtpSettings(smtpServer) {
if (smtpServer && smtpServer.hostname &&
smtpServer.hostname != "") {
// we have a hostname, so show the static text
// XXX, UI - this text provides little value to the vast majority of
// users who will not need or want to specify a second
// smtp server. As this panel is cramped for space, and
// as this text offers nothing other than visual clutter,
// it is being removed. - Ben (09/06/2000)
boxToShow = haveSmtpBox;
boxToHide = noSmtpBox;
// turn off but leave logic behind, just in case.
if (boxToShow)
boxToShow.setAttribute("hidden", "true");
boxToShow = null;
} else {
// no default hostname yet
boxToShow = noSmtpBox;

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

@ -21,18 +21,11 @@
* Alec Flett <alecf@netscape.com>
*/
var DEBUG_alecf = false;
function _dd(aString)
{
if (DEBUG_alecf)
dump(aString);
}
var gFieldList;
function GetFields()
{
_dd("wizardAdapter: GetFields()\n");
dump("wizardAdapter: GetFields()\n");
if (!gFieldList)
gFieldList = document.getElementsByAttribute("wsm_persist", "true");
@ -42,7 +35,7 @@ function GetFields()
if (field.parentNode.tagName == "template") continue;
_dd(" for field <" + field.tagName + ">\n");
dump(" for field <" + field.tagName + ">\n");
var obj = new Object;
obj.id = field.id;
@ -54,7 +47,7 @@ function GetFields()
else
obj.value = field.value;
_dd(" returning " + obj.id + " and " + obj.value + " value=" + field.value + "\n");
dump(" returning " + obj.id + " and " + obj.value + " value=" + field.value + "\n");
fields[field.id] = obj;
}
@ -63,16 +56,16 @@ function GetFields()
function SetFields(id, value)
{
_dd("wizardAdapter: SetFields(" + id + ", " + value + ")\n");
dump("wizardAdapter: SetFields(" + id + ", " + value + ")\n");
var field = document.getElementById(id);
if (!field) {
_dd(" Unknown field with id " + id + "\n");
_dd(" Trying to find it in the ispbox \n");
dump(" Unknown field with id " + id + "\n");
dump(" Trying to find it in the ispbox \n");
var ispBox = document.getElementById("ispBox");
var fields = document.getElementsByAttribute("id", id);
if (!fields || fields.length == 0) {
_dd("still couldn't find it!\n");
dump("still couldn't find it!\n");
return;
} else
field = fields[0];
@ -81,7 +74,7 @@ function SetFields(id, value)
return;
}
_dd(" SetFields(<" + field.tagName + ">);\n");
dump(" SetFields(<" + field.tagName + ">);\n");
if (field.tagName == "radio" ||
field.tagName == "checkbox")
field.checked = value;