Enabled a number of address book features, and connected the address book to the compose window.

This commit is contained in:
hangas%netscape.com 1999-07-13 20:25:38 +00:00
Родитель 45e54da445
Коммит 0ff81ab8c4
7 изменённых файлов: 518 добавлений и 254 удалений

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

@ -1,22 +1,4 @@
function GetDirectoryTree()
{
var directoryTree = frames[0].frames[0].document.getElementById('dirTree');
return directoryTree;
}
function GetResultTree()
{
var cardTree = frames[0].frames[1].document.getElementById('resultTree');
return cardTree;
}
function GetResultTreeDirectory()
{
var tree = GetResultTree();
return tree.childNodes[5];
}
function AbNewCard()
function AbNewCardDialog()
{
var dialog = window.openDialog("chrome://addressbook/content/newcardDialog.xul",
"abNewCard",
@ -24,13 +6,12 @@ function AbNewCard()
return dialog;
}
function AbEditCard(card)
function AbEditCardDialog(card, okCallback)
{
var dialog = window.openDialog("chrome://addressbook/content/editcardDialog.xul",
"abEditCard",
"chrome",
{card:card});
{card:card, okCallback:okCallback});
return dialog;
}
@ -41,7 +22,8 @@ function AbDelete()
addressbook = addressbook.QueryInterface(Components.interfaces.nsIAddressBook);
dump("\AbDelete from XUL\n");
var tree = GetResultTree();
if(tree) {
if( tree )
{
dump("tree is valid\n");
//get the selected elements
var cardList = tree.getElementsByAttribute("selected", "true");
@ -51,3 +33,105 @@ function AbDelete()
addressbook.DeleteCards(tree, srcDirectory, cardList);
}
}
function GetDirectoryTree()
{
var directoryTree = frames["directoryFrame"].document.getElementById('dirTree');
return directoryTree;
}
function GetResultTree()
{
var cardTree = frames["resultsFrame"].document.getElementById('resultTree');
return cardTree;
}
function GetResultTreeDirectory()
{
var tree = GetResultTree();
var treechildrenList = tree.getElementsByTagName('treechildren');
if ( treechildrenList.length == 1 )
return(treechildrenList[0]);
}
function EditCard()
{
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
var resultsDoc = frames["resultsFrame"].document;
var selArray = resultsDoc.getElementsByAttribute('selected', 'true');
if ( selArray && selArray.length == 1 )
{
var uri = selArray[0].getAttribute('id');
var card = rdf.GetResource(uri);
card = card.QueryInterface(Components.interfaces.nsIAbCard);
AbEditCardDialog(card, UpdateCardView);
}
}
function UpdateCardView()
{
var resultsDoc = frames["resultsFrame"].document;
var selArray = resultsDoc.getElementsByAttribute('selected', 'true');
dump("UpdateCardView -- selArray = " + selArray + "\n");
if ( selArray && selArray.length == 1 )
DisplayCardViewPane(selArray[0]);
}
function AbNewMessage()
{
var msgComposeService = Components.classes["component://netscape/messengercompose"].getService();
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
msgComposeService.OpenComposeWindowWithValues(null, 0, GetSelectedAddresses(), null, null,
null, null, null);
}
function GetSelectedAddresses()
{
var item, uri, rdf, cardResource, card;
var selectedAddresses = "";
var resultsDoc = frames["resultsFrame"].document;
var bucketDoc = frames["directoryFrame"].document;
rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
var selArray = resultsDoc.getElementsByAttribute('selected', 'true');
if ( selArray && selArray.length )
{
for ( item = 0; item < selArray.length; item++ )
{
uri = selArray[item].getAttribute('id');
cardResource = rdf.GetResource(uri);
card = cardResource.QueryInterface(Components.interfaces.nsIAbCard);
if ( selectedAddresses )
selectedAddresses += ",";
selectedAddresses += "\"" + card.DisplayName + "\" <" + card.PrimaryEmail + ">";
}
}
dump("selectedAddresses = " + selectedAddresses + "\n");
return selectedAddresses;
}
function AbExit()
{
var editorShell = Components.classes["component://netscape/editor/editorshell"].createInstance();
editorShell = editorShell.QueryInterface(Components.interfaces.nsIEditorShell);
if ( editorShell )
editorShell.Exit();
}
function AbClose()
{
top.window.close();
}

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

@ -9,96 +9,100 @@
<!-- menu items: the . means that the menu item isn't implemented yet -->
<!ENTITY fileMenu.label "File">
<!ENTITY newMenu.label "New">
<!ENTITY newNavCmd.label ".Navigator Window">
<!ENTITY newMessageCmd.label "Message">
<!ENTITY newBlankPageCmd.label ".Blank Page">
<!ENTITY newPageFromTemplate.label ".Page from Template">
<!ENTITY newPageFromWizard.label ".Page from Wizard">
<!ENTITY newCardCmd.label "New Card...">
<!ENTITY newListCmd.label ".New List...">
<!ENTITY newAddressBookCmd.label ".New Address Book...">
<!ENTITY newDirectoryCmd.label ".New Directory...">
<!ENTITY callCmd.label ".Call">
<!ENTITY importCmd.label ".Import..">
<!ENTITY exportCmd.label ".Export...">
<!ENTITY closeCmd.label ".Close">
<!ENTITY exitCmd.label "Exit">
<!ENTITY editMenu.label "Edit">
<!ENTITY undoCmd.label ".Undo">
<!ENTITY redoCmd.label ".Redo">
<!ENTITY cutCmd.label ".Cut">
<!ENTITY copyCmd.label ".Copy">
<!ENTITY pasteCmd.label ".Paste">
<!ENTITY deleteCmd.label "Delete Card">
<!ENTITY selectAllCmd.label ".Select All">
<!ENTITY selectMenu.label ".Search for...">
<!ENTITY findAgainCmd.label ".Find Again">
<!ENTITY htmlDomainCmd.label ".HTML Domain...">
<!ENTITY abPropsCmd.label ".Properties">
<!ENTITY prefsCmd.label ".Preferences">
<!ENTITY viewMenu.label "View">
<!ENTITY showMenu.label ".Show">
<!ENTITY showAbToolbarCmd.label ".Addressbook Toolbar">
<!ENTITY showAddressBook.label ".Address Books">
<!ENTITY sortMenu.label ".Sort">
<!ENTITY sortByTypeCmd.label ".by Type">
<!ENTITY sortByNameCmd.label ".by Name">
<!ENTITY sortByEmailCmd.label ".by Email">
<!ENTITY sortByOrganizationCmd.label "by Organization">
<!ENTITY sortByNicknameCmd.label ".by Nickname">
<!ENTITY sortByPhoneCmd.label ".by Phone Number">
<!ENTITY sortByCityCmd.label ".by City">
<!ENTITY sortAscendingCmd.label ".Ascending">
<!ENTITY sortDescendingCmd.label ".Descending">
<!ENTITY communicatorMenu.label "Communicator">
<!ENTITY navigatorCmd.label "Navigator">
<!ENTITY messengerCmd.label ".Messenger">
<!ENTITY composerCmd.label ".Composer">
<!ENTITY aimCmd.label ".AOL Instant Messenger Service">
<!ENTITY bookmarkMenu.label ".Bookmark">
<!ENTITY addBookmarkCmd.label ".Add Bookmark">
<!ENTITY fileBookmarkCmd.label ".File Bookmark">
<!ENTITY editBookmarkCmd.label ".Edit Bookmark">
<!ENTITY newsgroupsCmd.label ".Newsgroups">
<!ENTITY addressBookCmd.label "Address Book">
<!ENTITY toolsMenu.label ".Tools">
<!ENTITY historyCmd.label ".History">
<!ENTITY securityInfoCmd.label ".Security Info">
<!ENTITY messageCenterCmd.label ".Message Center">
<!ENTITY importUtilCmd.label ".Import Utility">
<!ENTITY javaConsoleCmd.label ".Java Console">
<!ENTITY windowCmd.label ".Window">
<!ENTITY helpMenu.label ".Help">
<!ENTITY helpContentCmd.label ".Help Content">
<!ENTITY referenceLibraryCmd.label ".Reference Library">
<!ENTITY releaseNotesCmd.label ".Release Notes">
<!ENTITY productInfoCmd.label ".Produce Information and Support">
<!ENTITY softwareUpdatesCmd.label ".Software Updates">
<!ENTITY registerCmd.label ".Register Now">
<!ENTITY memberServicesCmd.label ".Member Services">
<!ENTITY internationalCmd.label ".International Users">
<!ENTITY securityCmd.label ".Security">
<!ENTITY netwatchCmd.label ".NetWatch">
<!ENTITY aboutPluginsCmd.label ".About Plug-ins">
<!ENTITY aboutFontCmd.label ".About Font Displayers">
<!ENTITY aboutCmd.label ".About Communicator...">
<!ENTITY fileMenu.label "File">
<!ENTITY newMenu.label "New">
<!ENTITY newNavCmd.label ".Navigator">
<!ENTITY newMessageCmd.label "Message">
<!ENTITY newCardCmd.label "New Card...">
<!ENTITY newListCmd.label ".New List...">
<!ENTITY newAddressBookCmd.label ".New Address Book...">
<!ENTITY newDirectoryCmd.label ".New Directory...">
<!ENTITY importCmd.label ".Import...">
<!ENTITY exportCmd.label ".Export...">
<!ENTITY pageSetupCmd.label ".Page Setup...">
<!ENTITY printPreviewCmd.label ".Print Preview">
<!ENTITY printCardViewCmd.label ".Print Card View...">
<!ENTITY printAddressBook.label ".Print Address Book...">
<!ENTITY closeCmd.label "Close">
<!ENTITY exitCmd.label "Exit">
<!ENTITY editMenu.label "Edit">
<!ENTITY undoCmd.label ".Undo">
<!ENTITY redoCmd.label ".Redo">
<!ENTITY cutCmd.label ".Cut">
<!ENTITY copyCmd.label ".Copy">
<!ENTITY pasteCmd.label ".Paste">
<!ENTITY deleteCmd.label "Delete">
<!ENTITY selectAllCmd.label ".Select All">
<!ENTITY searchCmd.label ".Search...">
<!ENTITY htmlDomainCmd.label ".HTML Domains...">
<!ENTITY abPropsCmd.label "Properties">
<!ENTITY prefsCmd.label ".Preferences">
<!ENTITY viewMenu.label "View">
<!ENTITY showMenu.label ".Show">
<!ENTITY showAbToolbarCmd.label ".Address Book Toolbar">
<!ENTITY showCardPane.label ".Card Pane">
<!ENTITY showTaskbar.label ".Taskbar">
<!ENTITY sortMenu.label ".Sort">
<!ENTITY sortByNameCmd.label ".by Name">
<!ENTITY sortByEmailCmd.label ".by Email">
<!ENTITY sortByOrganizationCmd.label ".by Organization">
<!ENTITY sortByNicknameCmd.label ".by Nickname">
<!ENTITY sortByPhoneCmd.label ".by Phone Number">
<!ENTITY sortByCityCmd.label ".by City">
<!ENTITY sortAscendingCmd.label ".Ascending">
<!ENTITY sortDescendingCmd.label ".Descending">
<!ENTITY stopSearchingCmd.label ".Stop Searching">
<!ENTITY tasksMenu.label "Tasks">
<!ENTITY navigatorCmd.label "Navigator">
<!ENTITY messengerCmd.label ".Messenger">
<!ENTITY addressBookCmd.label ".Address Book">
<!ENTITY bookmarkMenu.label ".Bookmarks">
<!ENTITY addBookmarkCmd.label ".Add Bookmark">
<!ENTITY fileBookmarkCmd.label ".File Bookmark">
<!ENTITY editBookmarkCmd.label ".Edit Bookmark">
<!ENTITY newsgroupsCmd.label ".Newsgroups">
<!ENTITY toolsMenu.label ".Tools">
<!ENTITY historyCmd.label ".History">
<!ENTITY securityInfoCmd.label ".Security Info">
<!ENTITY messageCenterCmd.label ".Message Center">
<!ENTITY importUtilCmd.label ".Import Utility">
<!ENTITY javaConsoleCmd.label ".Java Console">
<!ENTITY windowMenu.label ".Window">
<!ENTITY helpMenu.label "Help">
<!ENTITY helpContentCmd.label ".Help Contents">
<!ENTITY referenceLibraryCmd.label ".Reference Library">
<!ENTITY releaseNotesCmd.label ".Release Notes">
<!ENTITY productInfoCmd.label ".Product Information and Support">
<!ENTITY softwareUpdatesCmd.label ".Software Updates">
<!ENTITY registerCmd.label ".Register Now">
<!ENTITY memberServicesCmd.label ".Member Services">
<!ENTITY internationalCmd.label ".International Users">
<!ENTITY securityCmd.label ".Security">
<!ENTITY netwatchCmd.label ".NetWatch">
<!ENTITY aboutPluginsCmd.label ".About Plug-ins">
<!ENTITY aboutFontCmd.label ".About Font Displayers">
<!ENTITY aboutCmd.label ".About Communicator...">
<!-- Toolbar items -->
<!ENTITY newcardButton.img "chrome://addressbook/skin/newcard.gif">
<!ENTITY newcardButton.label "New Card">
<!ENTITY newlistButton.img "chrome://addressbook/skin/newlist.gif">
<!ENTITY newlistButton.label "New List">
<!ENTITY propertiesButton.img "chrome://addressbook/skin/property.gif">
<!ENTITY propertiesButton.label "Properties">
<!ENTITY newlistButton.label ".New List">
<!ENTITY editButton.img "chrome://addressbook/skin/property.gif">
<!ENTITY editButton.label "Edit">
<!ENTITY newmsgButton.img "chrome://addressbook/skin/abnewmsg.gif">
<!ENTITY newmsgButton.label "New Msg">
<!ENTITY deleteButton.img "chrome://messenger/skin/trash.gif">
<!ENTITY deleteButton.label "Delete">
<!ENTITY stopButton.img "resource:/res/toolbar/TB_Stop.gif">
<!ENTITY stopButton.label "Stop">
<!ENTITY search.label "Show names containing:">
<!ENTITY stopButton.label ".Stop">
<!ENTITY searchButton.img "resource:/res/toolbar/TB_Search.gif">
<!ENTITY searchButton.label ".Search">
<!ENTITY showNames.label "Show names containing:">
<!ENTITY throbber.img "resource:/res/throbber/anims00.gif">
<!ENTITY throbber.url "http://www.mozilla.org/">
]>
@ -118,126 +122,129 @@
<html:script language="javascript" src="chrome://addressbook/content/cardviewPane.js"/>
<html:script language="JavaScript" src="chrome://addressbook/content/editcard.js"/>
<html:script language="JavaScript" src="chrome://messenger/content/commandglue.js"/>
<!--
<html:script language="JavaScript" src="resource://res/samples/DumpDOM.js"/>
-->
<menubar>
<menu name="&fileMenu.label;">
<menu name="&newMenu.label;">
<menuitem name="&newNavCmd.label;" onclick="NewBrowserWindow();"/>
<menuitem name="&newMessageCmd.label;" onclick="AbNewMessage();"/>
</menu>
<menuitem name="&newCardCmd.label;" onclick="AbNewCardDialog()"/>
<menuitem name="&newListCmd.label;" onclick="AbNewList()"/>
<menuitem name="&newAddressBookCmd.label;" onclick="AbNewAddressBook()"/>
<menuitem name="&newDirectoryCmd.label;" onclick="AbNewDirectoryt()"/>
<separator/>
<menuitem name="&importCmd.label;" onclick="AbImport()"/>
<menuitem name="&exportCmd.label;" onclick="AbExport()"/>
<separator/>
<menuitem name="&pageSetupCmd.label;" onclick="AbPageSetup()"/>
<menuitem name="&printPreviewCmd.label;" onclick="AbPrintPreview()"/>
<menuitem name="&printCardViewCmd.label;" onclick="AbCardView()"/>
<menuitem name="&printAddressBook.label;" onclick="AbPrintAddressBook()"/>
<separator/>
<menuitem name="&closeCmd.label;" onclick="AbClose()"/>
<menuitem name="&exitCmd.label;" onclick="AbExit()"/>
</menu>
<menubar>
<menu name="&fileMenu.label;">
<menu name="&newMenu.label;">
<menuitem name="&newNavCmd.label;" onclick="NewBrowserWindow();"/>
<menuitem name="&newMessageCmd.label;" onclick="NewMessage();"/>
<menuitem name="&newBlankPageCmd.label;" onclick="NewBlankPage();"/>
<separator/>
<menuitem name="&newPageFromTemplate.label;" onclick="TemplatePage();"/>
<menuitem name="&newPageFromWizard.label;" onclick="WizardPage();"/>
</menu>
<menuitem name="&newCardCmd.label;" onclick="AbNewCard();"/>
<menuitem name="&newListCmd.label;" onclick="AbNewList();"/>
<menuitem name="&newAddressBookCmd.label;" onclick="AbNewAddressBook();"/>
<menuitem name="&newDirectoryCmd.label;" onclick="AbNewDirectoryt();"/>
<separator/>
<menuitem name="&callCmd.label;" onclick="MsgCall();"/>
<separator/>
<menuitem name="&importCmd.label;" onclick="AbImport();"/>
<menuitem name="&exportCmd.label;" onclick="AbExport();"/>
<separator/>
<menuitem name="&closeCmd.label;" onclick="Close();"/>
<menuitem name="&exitCmd.label;" onclick="Exit();"/>
</menu>
<menu name="&editMenu.label;">
<menuitem name="&undoCmd.label;" onclick="AbEditUndo();"/>
<menuitem name="&redoCmd.label;" onclick="AbEditRedo();"/>
<separator/>
<menuitem name="&cutCmd.label;" onclick="AbEditCut();"/>
<menuitem name="&copyCmd.label;" onclick="AbEditCopy();"/>
<menuitem name="&pasteCmd.label;" onclick="AbEditPaste();"/>
<menuitem name="&deleteCmd.label;" onclick="AbDelete();"/>
<menuitem name="&selectAllCmd.label;" onclick="AbSelectAll();"/>
<separator/>
<menuitem name="&selectMenu.label;" onclick="AbSearchFor();"/>
<menuitem name="&findAgainCmd.label;" onclick="AbFindAgain();"/>
<separator/>
<menuitem name="&htmlDomainCmd.label;" onclick="AbHTMLDomain();"/>
<menuitem name="&abPropsCmd.label;" onclick="AbProperties();"/>
<separator/>
<menuitem name="&prefsCmd.label;" onclick="MsgPreferences();"/>
</menu>
<menu name="&viewMenu.label;">
<menu name="&showMenu.label;">
<menuitem name="&showAbToolbarCmd.label;" onclick="AbShowToolbar();"/>
<menuitem name="&showAddressBook.label;" onclick="AbShowAddressBooks();"/>
</menu>
<menu name="&sortMenu.label;">
<menuitem name="&sortByTypeCmd.label;" onclick="AbSortByType();"/>
<menuitem name="&sortByNameCmd.label;" onclick="AbSortByName();"/>
<menuitem name="&sortByEmailCmd.label;" onclick="AbSortByEmail();"/>
<menuitem name="&sortByOrganizationCmd.label;" onclick="AbSortByOrganization();"/>
<menuitem name="&sortByNicknameCmd.label;" onclick="AbSortByNickname();"/>
<menuitem name="&sortByPhoneCmd.label;" onclick="AbSortByPhoneNumber();"/>
<menuitem name="&sortByCityCmd.label;" onclick="AbSortByCity();"/>
<separator/>
<menuitem name="&sortAscendingCmd.label;" onclick="AbSortAscending();"/>
<menuitem name="&sortDescendingCmd.label;" onclick="AbSortDescending();"/>
</menu>
</menu>
<menu name="&communicatorMenu.label;">
<menuitem name="&navigatorCmd.label;" onclick="NavigatorWindow();"/>
<menuitem name="&messengerCmd.label;" onclick="MessengerWindow();"/>
<menuitem name="&composerCmd.label;" onclick="ComposerWindow();"/>
<menuitem name="&aimCmd.label;" onclick="AIMService();"/>
<separator/>
<menu name="&bookmarkMenu.label;">
<menuitem name="&addBookmarkCmd.label;" onclick="AddBookmark();"/>
<menuitem name="&fileBookmarkCmd.label;" onclick="FileBookmark();"/>
<menuitem name="&editBookmarkCmd.label;" onclick="EditBookmark();"/>
</menu>
<menuitem name="&newsgroupsCmd.label;" onclick="Newsgroups();"/>
<menuitem name="&addressBookCmd.label;" onclick="AddressBook();"/>
<separator/>
<menu name="&toolsMenu.label;">
<menuitem name="&historyCmd.label;" onclick="History();"/>
<menuitem name="&securityInfoCmd.label;" onclick="SecurityInfo();"/>
<menuitem name="&messageCenterCmd.label;" onclick="MessengerCenter();"/>
<menuitem name="&importUtilCmd.label;" onclick="Import();"/>
<menuitem name="&javaConsoleCmd.label;" onclick="JavaConsole();"/>
</menu>
<separator/>
<menuitem name="&windowCmd.label;" onclick="WindowList();"/>
</menu>
<menu name="&helpMenu.label;">
<menuitem name="&helpContentCmd.label;" onclick="Help();"/>
<menuitem name="&referenceLibraryCmd.label;" onclick="Help();"/>
<menuitem name="&releaseNotesCmd.label;" onclick="Help();"/>
<menuitem name="&productInfoCmd.label;" onclick="Help();"/>
<separator/>
<menuitem name="&softwareUpdatesCmd.label;" onclick="Help();"/>
<menuitem name="&registerCmd.label;" onclick="Help();"/>
<menuitem name="&memberServicesCmd.label;" onclick="Help();"/>
<separator/>
<menuitem name="&internationalCmd.label;" onclick="Help();"/>
<menuitem name="&securityCmd.label;" onclick="Help();"/>
<menuitem name="&netwatchCmd.label;" onclick="Help();"/>
<separator/>
<menuitem name="&aboutPluginsCmd.label;" onclick="About();"/>
<menuitem name="&aboutFontCmd.label;" onclick="About();"/>
<menuitem name="&aboutCmd.label;" onclick="About();"/>
</menu>
</menubar>
<menu name="&editMenu.label;">
<menuitem name="&undoCmd.label;" onclick="AbEditUndo()"/>
<menuitem name="&redoCmd.label;" onclick="AbEditRedo()"/>
<separator/>
<menuitem name="&cutCmd.label;" onclick="AbEditCut();"/>
<menuitem name="&copyCmd.label;" onclick="AbEditCopy();"/>
<menuitem name="&pasteCmd.label;" onclick="AbEditPaste();"/>
<menuitem name="&deleteCmd.label;" onclick="AbDelete();"/>
<menuitem name="&selectAllCmd.label;" onclick="AbSelectAll();"/>
<separator/>
<menuitem name="&searchCmd.label;" onclick="AbSearch();"/>
<separator/>
<menuitem name="&htmlDomainCmd.label;" onclick="AbHTMLDomain();"/>
<menuitem name="&abPropsCmd.label;" onclick="EditCard();"/>
<separator/>
<menuitem name="&prefsCmd.label;" onclick="MsgPreferences();"/>
</menu>
<menu name="&viewMenu.label;">
<menu name="&showMenu.label;">
<menuitem name="&showAbToolbarCmd.label;" onclick="AbShowToolbar()"/>
<menuitem name="&showCardPane.label;" onclick="AbShowCardPane()"/>
<menuitem name="&showTaskbar.label;" onclick="AbShowTaskbar()"/>
</menu>
<menu name="&sortMenu.label;">
<menuitem name="&sortByNameCmd.label;" onclick="AbSortByName()"/>
<menuitem name="&sortByEmailCmd.label;" onclick="AbSortByEmail()"/>
<menuitem name="&sortByOrganizationCmd.label;" onclick="AbSortByOrganization()"/>
<menuitem name="&sortByNicknameCmd.label;" onclick="AbSortByNickname()"/>
<menuitem name="&sortByPhoneCmd.label;" onclick="AbSortByPhoneNumber()"/>
<menuitem name="&sortByCityCmd.label;" onclick="AbSortByCity()"/>
<separator/>
<menuitem name="&sortAscendingCmd.label;" onclick="AbSortAscending()"/>
<menuitem name="&sortDescendingCmd.label;" onclick="AbSortDescending()"/>
</menu>
</menu>
<menu name="&tasksMenu.label;">
<menuitem name="&navigatorCmd.label;" onclick="NavigatorWindow()"/>
<menuitem name="&messengerCmd.label;" onclick="MessengerWindow()"/>
<menuitem name="&addressBookCmd.label;" onclick="AddressBook()"/>
<separator/>
<menu name="&bookmarkMenu.label;">
<menuitem name="&addBookmarkCmd.label;" onclick="AddBookmark()"/>
<menuitem name="&fileBookmarkCmd.label;" onclick="FileBookmark()"/>
<menuitem name="&editBookmarkCmd.label;" onclick="EditBookmark()"/>
</menu>
<menuitem name="&newsgroupsCmd.label;" onclick="Newsgroups()"/>
<separator/>
<menu name="&toolsMenu.label;">
<menuitem name="&historyCmd.label;" onclick="History()"/>
<menuitem name="&securityInfoCmd.label;" onclick="SecurityInfo()"/>
<menuitem name="&messageCenterCmd.label;" onclick="MessengerCenter()"/>
<menuitem name="&importUtilCmd.label;" onclick="Import()"/>
<menuitem name="&javaConsoleCmd.label;" onclick="JavaConsole()"/>
</menu>
<separator/>
<menu name="&windowMenu.label;">
</menu>
</menu>
<menu name="&helpMenu.label;">
<menuitem name="&helpContentCmd.label;" onclick="Help()"/>
<menuitem name="&referenceLibraryCmd.label;" onclick="Help()"/>
<menuitem name="&releaseNotesCmd.label;" onclick="Help()"/>
<menuitem name="&productInfoCmd.label;" onclick="Help()"/>
<separator/>
<menuitem name="&softwareUpdatesCmd.label;" onclick="Help()"/>
<menuitem name="&registerCmd.label;" onclick="Help()"/>
<menuitem name="&memberServicesCmd.label;" onclick="Help()"/>
<separator/>
<menuitem name="&internationalCmd.label;" onclick="Help()"/>
<menuitem name="&securityCmd.label;" onclick="Help()"/>
<menuitem name="&netwatchCmd.label;" onclick="Help()"/>
<separator/>
<menuitem name="&aboutPluginsCmd.label;" onclick="About()"/>
<menuitem name="&aboutFontCmd.label;" onclick="About()"/>
<menuitem name="&aboutCmd.label;" onclick="About()"/>
</menu>
</menubar>
<toolbox>
<toolbar>
<titledbutton src="&newcardButton.img;" align="bottom" value="&newcardButton.label;" onclick="AbNewCard()"/>
<titledbutton src="&newcardButton.img;" align="bottom" value="&newcardButton.label;" onclick="AbNewCardDialog()"/>
<titledbutton src="&newlistButton.img;" align="bottom" value="&newlistButton.label;" onclick="AbNewList()"/>
<titledbutton src="&propertiesButton.img;" align="bottom" value="&propertiesButton.label;" onclick="AbProperties()"/>
<titledbutton src="&newmsgButton.img;" align="bottom" value="&newmsgButton.label;" onclick="NewMessage()"/>
<titledbutton src="&editButton.img;" align="bottom" value="&editButton.label;" onclick="EditCard()"/>
<titledbutton src="&newmsgButton.img;" align="bottom" value="&newmsgButton.label;" onclick="AbNewMessage()"/>
<titledbutton src="&deleteButton.img;" align="bottom" value="&deleteButton.label;" onclick="AbDelete()"/>
<box align="vertical" flex="100%">
<spring flex="100%"/>
<html:input id="searchtext" type="text" style="min-width: 100px; min-height: 25px"/>
<box align="vertical">
<spring flex="100%"/>
<html:div style="padding-left:5px; padding-bottom:2px">&showNames.label;</html:div>
<html:input id="searchtext" type="text" align="bottom" style="min-width:100px; min-height:25px; padding-bottom:0px"/>
</box>
<titledbutton src="&stopButton.img;" align="bottom" value="&stopButton.label;" onclick="AbStop()"/>
<titledbutton src="&searchButton.img;" align="bottom" value="&searchButton.label;" onclick="AbSearch()"/>
<spring flex="100%"/>
<titledbutton src="&throbber.img;" align="right" onclick="MsgHome('&throbber.url;')"/>

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

@ -1,10 +1,12 @@
var card;
var newCard = -1;
var okCallback;
var editCardTitlePrefix = "Card for ";
function OnLoadNewCard()
{
top.card = newCard;
top.okCallback = 0;
}
@ -14,14 +16,13 @@ function OnLoadEditCard()
if (window.arguments && window.arguments[0])
{
if ( window.arguments[0].card )
{
// keep card in global for later
top.card = window.arguments[0].card;
if ( window.arguments[0].okCallback )
top.okCallback = window.arguments[0].okCallback;
GetCardValues(top.card, frames["browser.editcard"].document);
GetCardValues(top.card, frames["browser.editcard"].document);
//top.window.setAttribute('title', editCardTitlePrefix + top.card.DisplayName);
}
//top.window.setAttribute('title', editCardTitlePrefix + top.card.DisplayName);
}
}
@ -47,15 +48,17 @@ function EditCardOKButton()
{
SetCardValues(top.card, frames["browser.editcard"].document);
// Need to commit changes here Candice.
top.card.EditCardToDatabase();
// callback to allow caller to update
if ( top.okCallback )
top.okCallback();
top.window.close();
}
// Move the data from the cardproperty to the dialog
function GetCardValues(cardproperty, doc)
{
if ( cardproperty )
@ -104,7 +107,6 @@ function GetCardValues(cardproperty, doc)
// Move the data from the dialog to the cardproperty to be stored in the database
function SetCardValues(cardproperty, doc)
{
if (cardproperty)

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

@ -1,3 +1,119 @@
var composeWindow = 0;
var msgCompFields = 0;
// localization strings
var prefixTo = "To: ";
var prefixCc = "Cc: ";
var prefixBcc = "Bcc: ";
function OnLoadSelectAddress()
{
var toAddress="", ccAddress="", bccAddress="";
// look in arguments[0] for parameters
if (window.arguments && window.arguments[0])
{
// keep parameters in global for later
if ( window.arguments[0].composeWindow )
top.composeWindow = window.arguments[0].composeWindow;
if ( window.arguments[0].msgCompFields )
top.msgCompFields = window.arguments[0].msgCompFields;
if ( window.arguments[0].toAddress )
toAddress = window.arguments[0].toAddress;
if ( window.arguments[0].ccAddress )
ccAddress = window.arguments[0].ccAddress;
if ( window.arguments[0].bccAddress )
bccAddress = window.arguments[0].bccAddress;
dump("onload top.composeWindow: " + top.composeWindow + "\n");
dump("onload toAddress: " + toAddress + "\n");
// put the addresses into the bucket
AddAddressFromComposeWindow(toAddress, prefixTo);
AddAddressFromComposeWindow(ccAddress, prefixCc);
AddAddressFromComposeWindow(bccAddress, prefixBcc);
}
}
function AddAddressFromComposeWindow(addresses, prefix)
{
if ( addresses )
{
var bucketDoc = frames["browser.addressbucket"].document;
var addressArray = addresses.split(",");
for ( var index = 0; index < addressArray.length; index++ )
{
// remove leading spaces
while ( addressArray[index][0] == " " )
addressArray[index] = addressArray[index].substring(1, addressArray[index].length);
AddAddressIntoBucket(bucketDoc, prefix + addressArray[index]);
}
}
}
function SelectAddressOKButton()
{
var bucketDoc = frames["browser.addressbucket"].document;
var body = bucketDoc.getElementById('bucketBody');
var item, row, cell, text, colon;
var toAddress="", ccAddress="", bccAddress="";
for ( var index = 0; index < body.childNodes.length; index++ )
{
item = body.childNodes[index];
if ( item.childNodes && item.childNodes.length )
{
row = item.childNodes[0];
if ( row.childNodes && row.childNodes.length )
{
cell = row.childNodes[0];
if ( cell.childNodes && cell.childNodes.length )
{
text = cell.childNodes[0];
if ( text && text.data && text.data.length )
{
switch ( text.data[0] )
{
case prefixTo[0]:
if ( toAddress )
toAddress += ", ";
toAddress += text.data.substring(prefixTo.length, text.data.length);
break;
case prefixCc[0]:
if ( ccAddress )
ccAddress += ", ";
ccAddress += text.data.substring(prefixCc.length, text.data.length);
break;
case prefixBcc[0]:
if ( bccAddress )
bccAddress += ", ";
bccAddress += text.data.substring(prefixBcc.length, text.data.length);
break;
}
}
}
}
}
}
// reset the UI in compose window
msgCompFields.SetTo(toAddress);
msgCompFields.SetCc(ccAddress);
msgCompFields.SetBcc(bccAddress);
top.composeWindow.CompFields2Recipients(top.msgCompFields);
top.window.close();
}
function SelectAddressCancelButton()
{
top.window.close();
}
function saChangeDirectoryByDOMNode(dirNode)
{
var uri = dirNode.getAttribute('id');
@ -21,33 +137,22 @@ function saChangeDirectoryByURI(uri)
function SelectAddressToButton()
{
AddSelectedAddressesIntoBucket("To: ");
AddSelectedAddressesIntoBucket(prefixTo);
}
function SelectAddressCcButton()
{
AddSelectedAddressesIntoBucket("Cc: ");
AddSelectedAddressesIntoBucket(prefixCc);
}
function SelectAddressBccButton()
{
AddSelectedAddressesIntoBucket("Bcc: ");
AddSelectedAddressesIntoBucket(prefixBcc);
}
function SelectAddressOKButton()
{
top.window.close();
}
function SelectAddressCancelButton()
{
top.window.close();
}
function SelectAddressNewButton()
{
AbNewCard();
AbNewCardDialog();
}
function SelectAddressEditButton()
@ -63,7 +168,7 @@ function SelectAddressEditButton()
var uri = selArray[0].getAttribute('id');
var card = rdf.GetResource(uri);
card = card.QueryInterface(Components.interfaces.nsIAbCard);
AbEditCard(card);
AbEditCardDialog(card, 0);
}
}

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

@ -37,7 +37,7 @@ Rights Reserved.
<!ENTITY editButton.label "Edit...">
<!ENTITY viewButton.label ".View">
<!ENTITY removeButton.label "Remove">
<!ENTITY okButton.label ".OK">
<!ENTITY okButton.label "OK">
<!ENTITY cancelButton.label "Cancel">
<!ENTITY helpButton.label ".Help">
@ -58,16 +58,19 @@ Rights Reserved.
class="dialog"
width="640" height="480"
style="width:100%; height:100%; padding:0px"
onload="OnLoadSelectAddress()"
align="vertical">
<html:script language="JavaScript" src="chrome://addressbook/content/addressbook.js"/>
<html:script language="JavaScript" src="chrome://addressbook/content/selectaddress.js"/>
<html:script language="JavaScript" src="chrome://addressbook/content/resultPane.js"/>
<html:script language="JavaScript" src="chrome://messengercompose/content/MsgComposeCommands.js"/>
<!--
<html:script language="JavaScript" src="resource://res/samples/DumpDOM.js"/>
-->
<!-- Thin box across top, show names containing & stop, search buttons -->
<box align="horizontal" style="width:100%; padding:0.5em; padding-top:0px;">
<html:div style="vertical-align: middle;">
<box align="horizontal" style="width:100%; padding:0px; padding-top:2px; padding-bottom:2px">
<html:div flex="100%" style="vertical-align: middle;">
<html:label for="searchtext" tabindex="0">&search.label;</html:label>
<html:input type="text" id="searchtext" flex="100%"/>
</html:div>
@ -75,7 +78,7 @@ Rights Reserved.
<spring style="width: 1em;"/>
<titledbutton id="stop" value="&stopButton.label;" class="push" onclick="SelectAddressStopButton()"/>
<spring style="width:10px"/>
<spring style="width:5px"/>
<titledbutton id="search" value="&searchButton.label;" class="push" onclick="SelectAddressSearchButton()"/>
</box>

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

@ -18,7 +18,7 @@
* Rights Reserved.
*/
var msgComposeService = Components.classes['component://netscape/messengercompose'].getService();
var msgComposeService = Components.classes["component://netscape/messengercompose"].getService();
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
var msgCompose = null;
var MAX_RECIPIENTS = 0;
@ -113,12 +113,27 @@ function ComposeStartup()
// Now that we have an Editor AppCore, we can finish to initialize the Compose AppCore
msgCompose.editor = window.editorShell;
//Now we are ready to load all the fields (to, cc, subject, body, etc...)
msgCompose.LoadFields();
var msgCompFields = msgCompose.compFields;
if (msgCompFields)
{
if (args.body) //We need to set the body before calling LoadFields();
msgCompFields.SetBody(args.body);
//Now we are ready to load all the fields (to, cc, subject, body, etc...) depending of the type of the message
msgCompose.LoadFields();
if (args.to)
msgCompFields.SetTo(args.to);
if (args.cc)
msgCompFields.SetCc(args.cc);
if (args.bcc)
msgCompFields.SetBcc(args.bcc);
if (args.newsgroups)
msgCompFields.SetNewsgroups(args.newsgroups);
if (args.subject)
msgCompFields.SetSubject(args.subject);
CompFields2Recipients(msgCompFields);
var subjectValue = msgCompFields.GetSubject();
if (subjectValue != "")
@ -220,9 +235,24 @@ function SaveAsTemplate()
function SelectAddress()
{
var msgCompFields = msgCompose.compFields;
Recipients2CompFields(msgCompFields);
var toAddress = msgCompFields.GetTo();
var ccAddress = msgCompFields.GetCc();
var bccAddress = msgCompFields.GetBcc();
dump("toAddress: " + toAddress + "\n");
var dialog = window.openDialog("chrome://addressbook/content/selectaddress.xul",
"selectAddress",
"chrome");
"chrome",
{composeWindow:top.window,
msgCompFields:msgCompFields,
toAddress:toAddress,
ccAddress:ccAddress,
bccAddress:bccAddress});
return dialog;
}
@ -285,8 +315,9 @@ function FillRecipientTypeCombobox()
for (var j = 0; j < originalCombo.length; j ++)
combo.add(new Option(originalCombo.options[j].text,
originalCombo.options[j].value), null);
MAX_RECIPIENTS ++;
MAX_RECIPIENTS++;
}
MAX_RECIPIENTS--;
}
}
@ -361,9 +392,14 @@ function CompFields2Recipients(msgCompFields)
if (fieldValue != "" && i <= MAX_RECIPIENTS)
{
document.getElementById("msgRecipient#" + i).value = fieldValue;
document.getElementById("msgRecipientType#" + i).value = "addr_newsgroup";
document.getElementById("msgRecipientType#" + i).value = "addr_newsgroups";
i ++;
}
for (; i <= MAX_RECIPIENTS; i++)
{
document.getElementById("msgRecipient#" + i).value = "";
document.getElementById("msgRecipientType#" + i).value = "addrTo";
}
}
}

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

@ -116,8 +116,8 @@ Rights Reserved.
<html:script language="JavaScript" src="chrome://editor/content/EditorCommands.js"/>
<html:script language="JavaScript" src="MsgComposeCommands.js"/>
<html:script language="JavaScript" src="addressAutoComplete.js"/>
<html:script language="JavaScript" src="chrome://messengercompose/content/MsgComposeCommands.js"/>
<html:script language="JavaScript" src="chrome://messengercompose/content/addressAutoComplete.js"/>
<broadcaster id="args" value="editorType=default"/>
@ -263,16 +263,43 @@ Rights Reserved.
<box align="vertical" flex="100%">
<html:select id="msgRecipientType#3" flex="100%"/>
</box>
<box align="vertical" flex="100%">
<html:select id="msgRecipientType#4" flex="100%"/>
</box>
<box align="vertical" flex="100%">
<html:select id="msgRecipientType#5" flex="100%"/>
</box>
</box>
<box align="vertical" flex="80%">
<box align="vertical" flex="100%">
<html:input type="text" id="msgRecipient#1" flex="100%" onkeyup="if (event.which == 13) { AutoCompleteAddress('msgRecipientType#1','msgRecipient#1'); }"/>
<html:input type="text" id="msgRecipient#1" flex="100%"
onkeyup="if (event.which == 13)
{ AutoCompleteAddress('msgRecipientType#1',
'msgRecipient#1'); }"/>
</box>
<box align="vertical" flex="100%">
<html:input type="text" id="msgRecipient#2" flex="100%" onkeyup="if (event.which == 13) { AutoCompleteAddress('msgRecipientType#2','msgRecipient#2'); }"/>
<html:input type="text" id="msgRecipient#2" flex="100%"
onkeyup="if (event.which == 13)
{ AutoCompleteAddress('msgRecipientType#2',
'msgRecipient#2'); }"/>
</box>
<box align="vertical" flex="100%">
<html:input type="text" id="msgRecipient#3" flex="100%" onkeyup="if (event.which == 13) { AutoCompleteAddress('msgRecipientType#3','msgRecipient#3'); }"/>
<html:input type="text" id="msgRecipient#3" flex="100%"
onkeyup="if (event.which == 13)
{ AutoCompleteAddress('msgRecipientType#3',
'msgRecipient#3'); }"/>
</box>
<box align="vertical" flex="100%">
<html:input type="text" id="msgRecipient#4" flex="100%"
onkeyup="if (event.which == 13)
{ AutoCompleteAddress('msgRecipientType#4',
'msgRecipient#4'); }"/>
</box>
<box align="vertical" flex="100%">
<html:input type="text" id="msgRecipient#5" flex="100%"
onkeyup="if (event.which == 13)
{ AutoCompleteAddress('msgRecipientType#5',
'msgRecipient#5'); }"/>
</box>
</box>
</box>