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

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

@ -1,10 +1,12 @@
var card; var card;
var newCard = -1; var newCard = -1;
var okCallback;
var editCardTitlePrefix = "Card for "; var editCardTitlePrefix = "Card for ";
function OnLoadNewCard() function OnLoadNewCard()
{ {
top.card = newCard; top.card = newCard;
top.okCallback = 0;
} }
@ -14,14 +16,13 @@ function OnLoadEditCard()
if (window.arguments && window.arguments[0]) if (window.arguments && window.arguments[0])
{ {
if ( window.arguments[0].card ) if ( window.arguments[0].card )
{
// keep card in global for later
top.card = window.arguments[0].card; 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); SetCardValues(top.card, frames["browser.editcard"].document);
// Need to commit changes here Candice.
top.card.EditCardToDatabase(); top.card.EditCardToDatabase();
// callback to allow caller to update
if ( top.okCallback )
top.okCallback();
top.window.close(); top.window.close();
} }
// Move the data from the cardproperty to the dialog // Move the data from the cardproperty to the dialog
function GetCardValues(cardproperty, doc) function GetCardValues(cardproperty, doc)
{ {
if ( cardproperty ) 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 // Move the data from the dialog to the cardproperty to be stored in the database
function SetCardValues(cardproperty, doc) function SetCardValues(cardproperty, doc)
{ {
if (cardproperty) 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) function saChangeDirectoryByDOMNode(dirNode)
{ {
var uri = dirNode.getAttribute('id'); var uri = dirNode.getAttribute('id');
@ -21,33 +137,22 @@ function saChangeDirectoryByURI(uri)
function SelectAddressToButton() function SelectAddressToButton()
{ {
AddSelectedAddressesIntoBucket("To: "); AddSelectedAddressesIntoBucket(prefixTo);
} }
function SelectAddressCcButton() function SelectAddressCcButton()
{ {
AddSelectedAddressesIntoBucket("Cc: "); AddSelectedAddressesIntoBucket(prefixCc);
} }
function SelectAddressBccButton() function SelectAddressBccButton()
{ {
AddSelectedAddressesIntoBucket("Bcc: "); AddSelectedAddressesIntoBucket(prefixBcc);
} }
function SelectAddressOKButton()
{
top.window.close();
}
function SelectAddressCancelButton()
{
top.window.close();
}
function SelectAddressNewButton() function SelectAddressNewButton()
{ {
AbNewCard(); AbNewCardDialog();
} }
function SelectAddressEditButton() function SelectAddressEditButton()
@ -63,7 +168,7 @@ function SelectAddressEditButton()
var uri = selArray[0].getAttribute('id'); var uri = selArray[0].getAttribute('id');
var card = rdf.GetResource(uri); var card = rdf.GetResource(uri);
card = card.QueryInterface(Components.interfaces.nsIAbCard); card = card.QueryInterface(Components.interfaces.nsIAbCard);
AbEditCard(card); AbEditCardDialog(card, 0);
} }
} }

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

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

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

@ -18,7 +18,7 @@
* Rights Reserved. * Rights Reserved.
*/ */
var msgComposeService = Components.classes['component://netscape/messengercompose'].getService(); var msgComposeService = Components.classes["component://netscape/messengercompose"].getService();
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService); msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
var msgCompose = null; var msgCompose = null;
var MAX_RECIPIENTS = 0; 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 // Now that we have an Editor AppCore, we can finish to initialize the Compose AppCore
msgCompose.editor = window.editorShell; msgCompose.editor = window.editorShell;
//Now we are ready to load all the fields (to, cc, subject, body, etc...)
msgCompose.LoadFields();
var msgCompFields = msgCompose.compFields; var msgCompFields = msgCompose.compFields;
if (msgCompFields) 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); CompFields2Recipients(msgCompFields);
var subjectValue = msgCompFields.GetSubject(); var subjectValue = msgCompFields.GetSubject();
if (subjectValue != "") if (subjectValue != "")
@ -220,9 +235,24 @@ function SaveAsTemplate()
function SelectAddress() 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", var dialog = window.openDialog("chrome://addressbook/content/selectaddress.xul",
"selectAddress", "selectAddress",
"chrome"); "chrome",
{composeWindow:top.window,
msgCompFields:msgCompFields,
toAddress:toAddress,
ccAddress:ccAddress,
bccAddress:bccAddress});
return dialog; return dialog;
} }
@ -285,8 +315,9 @@ function FillRecipientTypeCombobox()
for (var j = 0; j < originalCombo.length; j ++) for (var j = 0; j < originalCombo.length; j ++)
combo.add(new Option(originalCombo.options[j].text, combo.add(new Option(originalCombo.options[j].text,
originalCombo.options[j].value), null); originalCombo.options[j].value), null);
MAX_RECIPIENTS ++; MAX_RECIPIENTS++;
} }
MAX_RECIPIENTS--;
} }
} }
@ -361,9 +392,14 @@ function CompFields2Recipients(msgCompFields)
if (fieldValue != "" && i <= MAX_RECIPIENTS) if (fieldValue != "" && i <= MAX_RECIPIENTS)
{ {
document.getElementById("msgRecipient#" + i).value = fieldValue; document.getElementById("msgRecipient#" + i).value = fieldValue;
document.getElementById("msgRecipientType#" + i).value = "addr_newsgroup"; document.getElementById("msgRecipientType#" + i).value = "addr_newsgroups";
i ++; 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="chrome://editor/content/EditorCommands.js"/>
<html:script language="JavaScript" src="MsgComposeCommands.js"/> <html:script language="JavaScript" src="chrome://messengercompose/content/MsgComposeCommands.js"/>
<html:script language="JavaScript" src="addressAutoComplete.js"/> <html:script language="JavaScript" src="chrome://messengercompose/content/addressAutoComplete.js"/>
<broadcaster id="args" value="editorType=default"/> <broadcaster id="args" value="editorType=default"/>
@ -263,16 +263,43 @@ Rights Reserved.
<box align="vertical" flex="100%"> <box align="vertical" flex="100%">
<html:select id="msgRecipientType#3" flex="100%"/> <html:select id="msgRecipientType#3" flex="100%"/>
</box> </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>
<box align="vertical" flex="80%"> <box align="vertical" flex="80%">
<box align="vertical" flex="100%"> <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>
<box align="vertical" flex="100%"> <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>
<box align="vertical" flex="100%"> <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> </box>
</box> </box>