diff --git a/mail/components/addrbook/content/abAddressBookNameDialog.js b/mail/components/addrbook/content/abAddressBookNameDialog.js
new file mode 100644
index 00000000000..bbe8d83a881
--- /dev/null
+++ b/mail/components/addrbook/content/abAddressBookNameDialog.js
@@ -0,0 +1,51 @@
+
+var okCallback = 0;
+var gCanRename = true;
+
+function abNameOnLoad()
+{
+ var abName = "";
+
+ // look in arguments[0] for parameters
+ if ("arguments" in window && window.arguments[0])
+ {
+ if ("title" in window.arguments[0])
+ {
+ var title = window.arguments[0].title;
+ top.window.title = title;
+ }
+
+ if ("okCallback" in window.arguments[0])
+ top.okCallback = window.arguments[0].okCallback;
+
+ if ("name" in window.arguments[0])
+ abName = window.arguments[0].name;
+
+ if ("canRename" in window.arguments[0])
+ gCanRename = window.arguments[0].canRename;
+ }
+
+ // focus on input
+ var name = document.getElementById('name');
+ if (name) {
+ if (abName)
+ name.value = abName;
+
+ if (gCanRename)
+ name.focus();
+ else
+ name.disabled = true;
+ }
+
+ moveToAlertPosition();
+}
+
+function abNameOKButton()
+{
+ if (top.okCallback && gCanRename)
+ top.okCallback(document.getElementById('name').value);
+
+ return true;
+}
+
+c
\ No newline at end of file
diff --git a/mail/components/addrbook/content/abAddressBookNameDialog.xul b/mail/components/addrbook/content/abAddressBookNameDialog.xul
new file mode 100644
index 00000000000..3de4a84b239
--- /dev/null
+++ b/mail/components/addrbook/content/abAddressBookNameDialog.xul
@@ -0,0 +1,38 @@
+
+
+# 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.
+
+
+
+
+
+
+
+
diff --git a/mail/components/addrbook/content/abCardOverlay.js b/mail/components/addrbook/content/abCardOverlay.js
new file mode 100644
index 00000000000..3c45bcaaa6b
--- /dev/null
+++ b/mail/components/addrbook/content/abCardOverlay.js
@@ -0,0 +1,536 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * 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.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Seth Spitzer
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var editCard;
+var gOnSaveListeners = new Array;
+var gOkCallback = null;
+var gAddressBookBundle;
+
+function OnLoadNewCard()
+{
+ InitEditCard();
+
+ var cardproperty = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance(Components.interfaces.nsIAbCard);
+
+ editCard.card = cardproperty;
+ editCard.titleProperty = "newCardTitle";
+ editCard.selectedAB = "";
+
+ if ("arguments" in window && window.arguments[0])
+ {
+ if ("selectedAB" in window.arguments[0]) {
+ // check if selected ab is a mailing list
+ var abURI = window.arguments[0].selectedAB;
+
+ var directory = GetDirectoryFromURI(abURI);
+ if (directory.isMailList) {
+ var parentURI = GetParentDirectoryFromMailingListURI(abURI);
+ if (parentURI) {
+ editCard.selectedAB = parentURI;
+ }
+ else {
+ // it's a mailing list, but we failed to determine the parent directory
+ // use the personal addressbook
+ editCard.selectedAB = kPersonalAddressbookURI;
+ }
+ }
+ else if (!(directory.operations & directory.opWrite)) {
+ editCard.selectedAB = kPersonalAddressbookURI;
+ }
+ else {
+ editCard.selectedAB = window.arguments[0].selectedAB;
+ }
+ }
+ else {
+ editCard.selectedAB = kPersonalAddressbookURI;
+ }
+
+ // we may have been given properties to pre-initialize the window with....
+ // we'll fill these in here...
+ if ("primaryEmail" in window.arguments[0])
+ editCard.card.primaryEmail = window.arguments[0].primaryEmail;
+ if ("displayName" in window.arguments[0]) {
+ editCard.card.displayName = window.arguments[0].displayName;
+ // if we've got a display name, don't generate
+ // a display name (and stomp on the existing display name)
+ // when the user types a first or last name
+ if (editCard.card.displayName.length)
+ editCard.generateDisplayName = false;
+ }
+ if ("aimScreenName" in window.arguments[0])
+ editCard.card.aimScreenName = window.arguments[0].aimScreenName;
+ }
+
+ // set popup with address book names
+ var abPopup = document.getElementById('abPopup');
+ if ( abPopup )
+ {
+ var menupopup = document.getElementById('abPopup-menupopup');
+
+ if ( editCard.selectedAB && menupopup && menupopup.childNodes )
+ {
+ for ( var index = menupopup.childNodes.length - 1; index >= 0; index-- )
+ {
+ if ( menupopup.childNodes[index].getAttribute('value') == editCard.selectedAB )
+ {
+ abPopup.label = menupopup.childNodes[index].getAttribute('label');
+ abPopup.value = menupopup.childNodes[index].getAttribute('value');
+ break;
+ }
+ }
+ }
+ else {
+ // Default to the first valid addressbook when none is
+ // selected. (the 0th is an empty/invalid entry)
+ abPopup.label = menupopup.childNodes[1].getAttribute('label');
+ abPopup.value = menupopup.childNodes[1].getAttribute('value');
+ }
+ }
+
+ GetCardValues(editCard.card, document);
+
+ // FIX ME - looks like we need to focus on both the text field and the tab widget
+ // probably need to do the same in the addressing widget
+
+ // focus on first or last name based on the pref
+ var focus;
+ if (editCard.displayLastNameFirst)
+ focus = document.getElementById('LastName');
+ else
+ focus = document.getElementById('FirstName');
+ if ( focus ) {
+ // XXX Using the setTimeout hack until bug 103197 is fixed
+ setTimeout( function(firstTextBox) { firstTextBox.focus(); }, 0, focus );
+ }
+ moveToAlertPosition();
+}
+
+// find the index in addressLists for the card that is being saved.
+function findCardIndex(directory)
+{
+ var index = -1;
+ var listCardsCount = directory.addressLists.Count();
+ for ( var i = 0; i < listCardsCount; i++ ) {
+ var card = directory.addressLists.QueryElementAt(i, Components.interfaces.nsIAbCard);
+ if (editCard.card.equals(card)) {
+ index = i;
+ break;
+ }
+ }
+ return index;
+}
+
+function EditCardOKButton()
+{
+
+ // See if this card is in any mailing list
+ // if so then we need to update the addresslists of those mailing lists
+ var index = -1;
+ var directory = GetDirectoryFromURI(editCard.abURI);
+
+ // if the directory is a mailing list we need to search all the mailing lists
+ // in the parent directory if the card exists.
+ if (directory.isMailList) {
+ var parentURI = GetParentDirectoryFromMailingListURI(editCard.abURI);
+ directory = GetDirectoryFromURI(parentURI);
+ }
+
+ var listDirectoriesCount = directory.addressLists.Count();
+ var foundDirectories = new Array();
+ var foundDirectoriesCount = 0;
+ var i;
+ // create a list of mailing lists and the index where the card is at.
+ for ( i=0; i < listDirectoriesCount; i++ ) {
+ var subdirectory = directory.addressLists.QueryElementAt(i, Components.interfaces.nsIAbDirectory);
+ index = findCardIndex(subdirectory);
+ if (index > -1)
+ {
+ foundDirectories[foundDirectoriesCount] = {directory:subdirectory, index:index};
+ foundDirectoriesCount++;
+ }
+ }
+
+ SetCardValues(editCard.card, document);
+
+ editCard.card.editCardToDatabase(editCard.abURI);
+
+ for (i=0; i 0) )
+ {
+ editCard.generateDisplayName = false;
+ }
+
+ GetCardValues(editCard.card, document);
+
+ var displayName = editCard.card.displayName;
+ top.window.title = gAddressBookBundle.getFormattedString(editCard.titleProperty,
+ [ displayName ]);
+ // check if selectedAB is a writeable
+ // if not disable all the fields
+ if ("arguments" in window && window.arguments[0])
+ {
+ if ("abURI" in window.arguments[0]) {
+ var abURI = window.arguments[0].abURI;
+ var directory = GetDirectoryFromURI(abURI);
+
+ if (!(directory.operations & directory.opWrite))
+ {
+ var disableElements = document.getElementsByAttribute("disableforreadonly", "true");
+ for (var i=0; i
+
+# 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.
+
+
+
+
+
+
+
diff --git a/mail/components/addrbook/content/abEditListDialog.xul b/mail/components/addrbook/content/abEditListDialog.xul
new file mode 100644
index 00000000000..139fd407353
--- /dev/null
+++ b/mail/components/addrbook/content/abEditListDialog.xul
@@ -0,0 +1,89 @@
+
+
+# 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.
+
+
+
+
+
+
+
+
diff --git a/mail/components/addrbook/content/abMailListDialog.xul b/mail/components/addrbook/content/abMailListDialog.xul
new file mode 100644
index 00000000000..21aa2dbb17a
--- /dev/null
+++ b/mail/components/addrbook/content/abMailListDialog.xul
@@ -0,0 +1,112 @@
+
+
+# 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.
+
+
+
+
+
+
+
diff --git a/mail/components/addrbook/content/abNewCardDialog.xul b/mail/components/addrbook/content/abNewCardDialog.xul
new file mode 100644
index 00000000000..afc582209b6
--- /dev/null
+++ b/mail/components/addrbook/content/abNewCardDialog.xul
@@ -0,0 +1,378 @@
+
+
+# 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.
+
+
+
+
+
+
diff --git a/mail/components/addrbook/jar.mn b/mail/components/addrbook/jar.mn
index 29af51b0923..7a8752e3a54 100644
--- a/mail/components/addrbook/jar.mn
+++ b/mail/components/addrbook/jar.mn
@@ -5,6 +5,14 @@ messenger.jar:
+ content/messenger/addressbook/abCardViewOverlay.js (content/abCardViewOverlay.js)
+ content/messenger/addressbook/addressbook.js (content/addressbook.js)
*+ content/messenger/addressbook/addressbook.xul (content/addressbook.xul)
++ content/messenger/addressbook/abCardOverlay.js (content/abCardOverlay.js)
++ content/messenger/addressbook/abAddressBookNameDialog.js (content/abAddressBookNameDialog.js)
+*+ content/messenger/addressbook/abAddressBookNameDialog.xul (content/abAddressBookNameDialog.xul)
+*+ content/messenger/addressbook/abEditCardDialog.xul (content/abEditCardDialog.xul)
+*+ content/messenger/addressbook/abEditListDialog.xul (content/abEditListDialog.xul)
+*+ content/messenger/addressbook/abMailListDialog.xul (content/abMailListDialog.xul)
+*+ content/messenger/addressbook/abNewCardDialog.xul (content/abNewCardDialog.xul)
en-US.jar:
+ locale/en-US/messenger/addressbook/abMainWindow.dtd (locale/abMainWindow.dtd)
++ locale/en-US/messenger/addressbook/abNewCardDialog.dtd (locale/abNewCardDialog.dtd)
diff --git a/mail/components/addrbook/locale/abNewCardDialog.dtd b/mail/components/addrbook/locale/abNewCardDialog.dtd
new file mode 100644
index 00000000000..65733caee74
--- /dev/null
+++ b/mail/components/addrbook/locale/abNewCardDialog.dtd
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+