Created a New Card Dialog and an Edit Card Dialog.

This commit is contained in:
hangas%netscape.com 1999-07-02 22:25:01 +00:00
Родитель c6a6166c4a
Коммит 8c313826ea
6 изменённых файлов: 130 добавлений и 71 удалений

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

@ -27,6 +27,8 @@ cardviewPane.js
addresspanes.html
editcard.xul
editcard.js
newcardDialog.xul
editcardDialog.xul
selectaddress.xul
selectaddress.js
addressbucket.xul

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

@ -40,6 +40,8 @@ EXPORT_RESOURCE_SAMPLES = \
$(srcdir)/addresspanes.html \
$(srcdir)/editcard.xul \
$(srcdir)/editcard.js \
$(srcdir)/newcardDialog.xul \
$(srcdir)/editcardDialog.xul \
$(srcdir)/selectaddress.xul \
$(srcdir)/selectaddress.js \
$(srcdir)/addressbucket.xul \

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

@ -1,14 +1,17 @@
function EditCard()
function AbNewCard()
{
var dialog = window.openDialog("chrome://addressbook/content/editcard.xul",
"editCard",
var dialog = window.openDialog("chrome://addressbook/content/newcardDialog.xul",
"abNewCard",
"chrome");
return dialog;
}
function AbNewCard()
function AbEditCard()
{
EditCard();
var dialog = window.openDialog("chrome://addressbook/content/editcardDialog.xul",
"abEditCard",
"chrome");
return dialog;
}

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

@ -1,60 +1,128 @@
function EditCardOKButton()
function NewCardOKButton()
{
var cardproperty = Components.classes["component://netscape/addressbook/cardproperty"].createInstance();
cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);
//var addressbook = Components.classes["component://netscape/addressbook"].createInstance();
//addressbook = addressbook.QueryInterface(Components.interfaces.nsIAddressBook);
dump("cardproperty = " + cardproperty + "\n");
if (cardproperty)
if ( cardproperty )
{
cardproperty.FirstName = document.getElementById('FirstName').value;
cardproperty.LastName = document.getElementById('LastName').value;
cardproperty.DisplayName = document.getElementById('DisplayName').value;
cardproperty.NickName = document.getElementById('NickName').value;
cardproperty.PrimaryEmail = document.getElementById('PrimaryEmail').value;
cardproperty.SecondEmail = document.getElementById('SecondEmail').value;
//cardproperty.SendPlainText = document.getElementById('SendPlainText').value;
cardproperty.WorkPhone = document.getElementById('WorkPhone').value;
cardproperty.HomePhone = document.getElementById('HomePhone').value;
cardproperty.FaxNumber = document.getElementById('FaxNumber').value;
cardproperty.PagerNumber = document.getElementById('PagerNumber').value;
cardproperty.CellularNumber = document.getElementById('CellularNumber').value;
cardproperty.HomeAddress = document.getElementById('HomeAddress').value;
cardproperty.HomeAddress2 = document.getElementById('HomeAddress2').value;
cardproperty.HomeCity = document.getElementById('HomeCity').value;
cardproperty.HomeState = document.getElementById('HomeState').value;
cardproperty.HomeZipCode = document.getElementById('HomeZipCode').value;
cardproperty.HomeCountry = document.getElementById('HomeCountry').value;
cardproperty.JobTitle = document.getElementById('JobTitle').value;
cardproperty.Department = document.getElementById('Department').value;
cardproperty.Company = document.getElementById('Company').value;
cardproperty.WorkAddress = document.getElementById('WorkAddress').value;
cardproperty.WorkAddress2 = document.getElementById('WorkAddress2').value;
cardproperty.WorkCity = document.getElementById('WorkCity').value;
cardproperty.WorkState = document.getElementById('WorkState').value;
cardproperty.WorkZipCode = document.getElementById('WorkZipCode').value;
cardproperty.WorkCountry = document.getElementById('WorkCountry').value;
cardproperty.WebPage1 = document.getElementById('WebPage1').value;
cardproperty.Custom1 = document.getElementById('Custom1').value;
cardproperty.Custom2 = document.getElementById('Custom2').value;
cardproperty.Custom3 = document.getElementById('Custom3').value;
cardproperty.Custom4 = document.getElementById('Custom4').value;
cardproperty.Notes = document.getElementById('Notes').value;
SetCardValues(cardproperty, frames["browser.newcard"].document);
cardproperty.AddCardToDatabase();
// addressbook.NewaCard();
}
top.window.close();
}
function EditCardOKButton()
{
}
// Move the data from the cardproperty to the dialog
function GetCardValues(cardproperty, doc)
{
if ( cardproperty )
{
doc.getElementById('FirstName').value = cardproperty.FirstName;
doc.getElementById('LastName').value = cardproperty.LastName;
doc.getElementById('DisplayName').value = cardproperty.DisplayName;
doc.getElementById('NickName').value = cardproperty.NickName;
doc.getElementById('PrimaryEmail').value = cardproperty.PrimaryEmail;
doc.getElementById('SecondEmail').value = cardproperty.SecondEmail;
//doc.getElementById('SendPlainText').value = cardproperty.SendPlainText;
doc.getElementById('WorkPhone').value = cardproperty.WorkPhone;
doc.getElementById('HomePhone').value = cardproperty.HomePhone;
doc.getElementById('FaxNumber').value = cardproperty.FaxNumber;
doc.getElementById('PagerNumber').value = cardproperty.PagerNumber;
doc.getElementById('CellularNumber').value = cardproperty.CellularNumber;
doc.getElementById('HomeAddress').value = cardproperty.HomeAddress;
doc.getElementById('HomeAddress2').value = cardproperty.HomeAddress2;
doc.getElementById('HomeCity').value = cardproperty.HomeCity;
doc.getElementById('HomeState').value = cardproperty.HomeState;
doc.getElementById('HomeZipCode').value = cardproperty.HomeZipCode;
doc.getElementById('HomeCountry').value = cardproperty.HomeCountry;
doc.getElementById('JobTitle').value = cardproperty.JobTitle;
doc.getElementById('Department').value = cardproperty.Department;
doc.getElementById('Company').value = cardproperty.Company;
doc.getElementById('WorkAddress').value = cardproperty.WorkAddress;
doc.getElementById('WorkAddress2').value = cardproperty.WorkAddress2;
doc.getElementById('WorkCity').value = cardproperty.WorkCity;
doc.getElementById('WorkState').value = cardproperty.WorkState;
doc.getElementById('WorkZipCode').value = cardproperty.WorkZipCode;
doc.getElementById('WorkCountry').value = cardproperty.WorkCountry;
doc.getElementById('WebPage1').value = cardproperty.WebPage1;
doc.getElementById('Custom1').value = cardproperty.Custom1;
doc.getElementById('Custom2').value = cardproperty.Custom2;
doc.getElementById('Custom3').value = cardproperty.Custom3;
doc.getElementById('Custom4').value = cardproperty.Custom4;
doc.getElementById('Notes').value = cardproperty.Notes;
}
}
// Move the data from the dialog to the cardproperty to be stored in the database
function SetCardValues(cardproperty, doc)
{
if (cardproperty)
{
cardproperty.FirstName = doc.getElementById('FirstName').value;
cardproperty.LastName = doc.getElementById('LastName').value;
cardproperty.DisplayName = doc.getElementById('DisplayName').value;
cardproperty.NickName = doc.getElementById('NickName').value;
cardproperty.PrimaryEmail = doc.getElementById('PrimaryEmail').value;
cardproperty.SecondEmail = doc.getElementById('SecondEmail').value;
//cardproperty.SendPlainText = doc.getElementById('SendPlainText').value;
cardproperty.WorkPhone = doc.getElementById('WorkPhone').value;
cardproperty.HomePhone = doc.getElementById('HomePhone').value;
cardproperty.FaxNumber = doc.getElementById('FaxNumber').value;
cardproperty.PagerNumber = doc.getElementById('PagerNumber').value;
cardproperty.CellularNumber = doc.getElementById('CellularNumber').value;
cardproperty.HomeAddress = doc.getElementById('HomeAddress').value;
cardproperty.HomeAddress2 = doc.getElementById('HomeAddress2').value;
cardproperty.HomeCity = doc.getElementById('HomeCity').value;
cardproperty.HomeState = doc.getElementById('HomeState').value;
cardproperty.HomeZipCode = doc.getElementById('HomeZipCode').value;
cardproperty.HomeCountry = doc.getElementById('HomeCountry').value;
cardproperty.JobTitle = doc.getElementById('JobTitle').value;
cardproperty.Department = doc.getElementById('Department').value;
cardproperty.Company = doc.getElementById('Company').value;
cardproperty.WorkAddress = doc.getElementById('WorkAddress').value;
cardproperty.WorkAddress2 = doc.getElementById('WorkAddress2').value;
cardproperty.WorkCity = doc.getElementById('WorkCity').value;
cardproperty.WorkState = doc.getElementById('WorkState').value;
cardproperty.WorkZipCode = doc.getElementById('WorkZipCode').value;
cardproperty.WorkCountry = doc.getElementById('WorkCountry').value;
cardproperty.WebPage1 = doc.getElementById('WebPage1').value;
cardproperty.Custom1 = doc.getElementById('Custom1').value;
cardproperty.Custom2 = doc.getElementById('Custom2').value;
cardproperty.Custom3 = doc.getElementById('Custom3').value;
cardproperty.Custom4 = doc.getElementById('Custom4').value;
cardproperty.Notes = doc.getElementById('Notes').value;
}
}
function NewCardCancelButton()
{
top.window.close();
}
function EditCardCancelButton()
{
top.window.close();

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

@ -4,11 +4,6 @@
<!DOCTYPE window
[
<!-- Title -->
<!ENTITY addressbookWindow.title "New Card">
<!-- Tabs -->
<!-- Labels -->
<!ENTITY Name.tab "Name">
<!ENTITY Name.box "Name">
@ -58,14 +53,9 @@
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&addressbookWindow.title;"
class="dialog"
width="400" style="height:100%"
flex="100%"
align="vertical">
<html:script language="JavaScript" src="chrome://addressbook/content/editcard.js"/>
<html:script language="JavaScript" src="resource://res/samples/DumpDOM.js"/>
<tabcontrol align="vertical" style="margin: 5px; border: 2px groove white">
<tabbox include="chrome://addressbook/content/nsFrag1.xul" align="horizontal">
<tab>&Name.tab;</tab>
@ -316,15 +306,5 @@
</tabpanel>
</tabcontrol>
<spring style="height:10px"/>
<box align="horizontal" flex="100%">
<spring flex="100%"/>
<titledbutton id="ok" value="OK" class="push" onclick="EditCardOKButton()" />
<spring style="width:10px"/>
<titledbutton id="cancel" value="Cancel" class="push" onclick="EditCardCancelButton()" />
<spring style="width:10px"/>
</box>
</window>

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

@ -31,6 +31,8 @@ install::
$(MAKE_INSTALL) addresspanes.html $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) editcard.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) editcard.js $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) newcardDialog.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) editcardDialog.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) selectaddress.xul $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) selectaddress.js $(DIST)\bin\chrome\addressbook\content\default
$(MAKE_INSTALL) addressbucket.xul $(DIST)\bin\chrome\addressbook\content\default
@ -47,6 +49,8 @@ clobber::
rm -f $(DIST)\chrome\addressbook\content\default\addresspanes.html
rm -f $(DIST)\chrome\addressbook\content\default\editcard.xul
rm -f $(DIST)\chrome\addressbook\content\default\editcard.js
rm -f $(DIST)\chrome\addressbook\content\default\newcardDialog.xul
rm -f $(DIST)\chrome\addressbook\content\default\editcardDialog.xul
rm -f $(DIST)\chrome\addressbook\content\default\selectaddress.xul
rm -f $(DIST)\chrome\addressbook\content\default\selectaddress.js
rm -f $(DIST)\chrome\addressbook\content\default\addressbucket.xul