more Edit mail list dialog front end

This commit is contained in:
chuang%netscape.com 2000-05-11 21:09:52 +00:00
Родитель 83e45c100e
Коммит a990de1d01
9 изменённых файлов: 164 добавлений и 116 удалений

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

@ -38,3 +38,5 @@ addressbook.xul
abDragDrop.js
abMailListDialog.js
abMailListDialog.xul
abListOverlay.xul
abEditListDialog.xul

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

@ -47,6 +47,8 @@ EXPORT_RESOURCE_SAMPLES = \
abDragDrop.js \
abMailListDialog.js \
abMailListDialog.xul \
abListOverlay.xul \
abEditListDialog.xul \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -133,7 +133,8 @@ var DirPaneController =
case "cmd_delete":
case "button_delete":
if ( dirTree )
top.addressbook.deleteAddressBooks(dirTree.database, dirTree, dirTree.selectedItems);
AbDeleteDirectory();
// top.addressbook.deleteAddressBooks(dirTree.database, dirTree, dirTree.selectedItems);
break;
}
},
@ -186,7 +187,16 @@ function AbEditCard()
var uri = resultsTree.selectedItems[0].getAttribute('id');
var card = rdf.GetResource(uri);
card = card.QueryInterface(Components.interfaces.nsIAbCard);
goEditCardDialog(resultsTree.getAttribute('ref'), card, top.gUpdateCardView);
if (card.isMailList)
{
var dirUri = dirTree.selectedItems[0].getAttribute('id');
listUri = dirUri + "/MailList" + card.dbRowID;
goEditListDialog(resultsTree.getAttribute('ref'), listUri);
}
else
{
goEditCardDialog(resultsTree.getAttribute('ref'), card, top.gUpdateCardView);
}
}
}
@ -531,3 +541,11 @@ function AbNewList()
{selectedAB:selectedAB});
}
function goEditListDialog(abURI, listURI)
{
window.openDialog("chrome://messenger/content/addressbook/abEditListDialog.xul",
"",
"chrome,resizeable=no",
{abURI:abURI, listURI:listURI});
}

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

@ -45,8 +45,8 @@ Rights Reserved.
<rule>
<treechildren>
<treeitem uri="...">
<treerow >
<treecell indent="true" value="rdf:http://home.netscape.com/NC-rdf#DirName"/>
<treerow>
<treecell indent="true" class="treecell-indent" value="rdf:http://home.netscape.com/NC-rdf#DirName"/>
</treerow>
</treeitem>
</treechildren>

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

@ -30,11 +30,13 @@ Rights Reserved.
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
title="&mailListWindow.title;"
class="dialog"
onload="OnLoadEditList()"
ondragover="return DragOverTree(event);"
ondragdrop="return DropOnAddressListTree(event);"
align="vertical">
<script language="JavaScript" src="chrome://messenger/content/addressbook/abMailListDialog.js"/>
<script language="JavaScript" src="chrome://global/content/strres.js"/>
<keyset id="keyset"/>

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

@ -21,7 +21,46 @@
top.MAX_RECIPIENTS = 1;
var inputElementType = "";
var strBundle = srGetStrBundle("chrome://messenger/locale/addressBook.properties");
var parentURI;
var editList;
function GetListValue(mailList)
{
mailList.listName = document.getElementById('ListName').value;
if (mailList.listName.length == 0)
{
var strBundle = srGetStrBundle("chrome://messenger/locale/addressbook/addressBook.properties");
var alertText = strBundle.GetStringFromName("emptyListName");
alert(alertText);
return false;
}
mailList.listNickName = document.getElementById('ListNickName').value;
mailList.description = document.getElementById('ListDescription').value;
var i = 1;
while ((inputField = awGetInputElement(i)))
{
fieldValue = inputField.value;
if (fieldValue != "")
{
var cardproperty = Components.classes["component://netscape/addressbook/cardproperty"].createInstance();
if (cardproperty)
{
cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);
if (cardproperty)
{
cardproperty.primaryEmail = fieldValue
mailList.addressLists.AppendElement(cardproperty);
}
}
}
i++;
}
return true;
}
function MailListOKButton()
{
@ -40,40 +79,11 @@ function MailListOKButton()
var mailList = Components.classes["component://netscape/addressbook/directoryproperty"].createInstance();
mailList = mailList.QueryInterface(Components.interfaces.nsIAbDirectory);
mailList.listName = document.getElementById('ListName').value;
if (mailList.listName.length == 0)
{
var alertText = strBundle.GetStringFromName("emptyListName");
alert(alertText);
if (GetListValue(mailList))
mailList.addMailListToDatabase(uri);
else
return false;
}
mailList.listNickName = document.getElementById('ListNickName').value;
mailList.description = document.getElementById('ListDescription').value;
var i = 1;
while ((inputField = awGetInputElement(i)))
{
fieldValue = inputField.value;
if (fieldValue != "")
{
var cardproperty = Components.classes["component://netscape/addressbook/cardproperty"].createInstance();
if (cardproperty)
{
cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);
if (cardproperty)
{
cardproperty.primaryEmail = fieldValue
mailList.addressLists.AppendElement(cardproperty);
}
}
}
i++;
}
mailList.addMailListToDatabase(uri);
}
}
return true; // close the window
}
@ -81,7 +91,6 @@ function OnLoadMailList()
{
doSetOKCancel(MailListOKButton, 0);
var selectedAB;
if (window.arguments && window.arguments[0])
{
if ( window.arguments[0].selectedAB )
@ -109,11 +118,6 @@ function OnLoadMailList()
}
}
}
// 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 name
var listName = document.getElementById('ListName');
@ -121,6 +125,60 @@ function OnLoadMailList()
listName.focus();
}
function EditListOKButton()
{
//Add mailing list to database
var parentURI = selectedAB.GetAttribute('id');
if (GetListValue(editList))
{
editList.editMailListToDatabase(parentURI);
return true; // close the window
}
else
return false;
}
function OnLoadEditList()
{
dump("***** OnLoadEditList\n");
doSetOKCancel(EditListOKButton, 0);
parentUri = window.arguments[0].abURI;
var listUri = window.arguments[0].listURI;
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
editList = rdf.GetResource(listUri);
editList = editList.QueryInterface(Components.interfaces.nsIAbDirectory);
document.getElementById('ListName').value = editList.listName;
document.getElementById('ListNickName').value = editList.listNickName;
document.getElementById('ListDescription').value = editList.description;
top.MAX_RECIPIENTS = 0;
var treeChildren = document.getElementById('addressList');
var newTreeChildrenNode = treeChildren.cloneNode(false);
var templateNode = treeChildren.firstChild;
if (editList.addressLists)
{
var total = editList.addressLists.Count();
for ( var i = 0; i < total; i++ )
{
var card = editList.addressLists.GetElementAt(i);
card = card.QueryInterface(Components.interfaces.nsIAbCard);
}
}
// focus on first name
var listName = document.getElementById('ListName');
if ( listName )
listName.focus();
}
function awNotAnEmptyArea(event)
{
//This is temporary until i figure out how to ensure to always having an empty space after the last row

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

@ -22,11 +22,11 @@ Rights Reserved.
<?xml-stylesheet href="chrome://messenger/skin/addressbook/addressbook.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/addressbook/abListOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/addressbook/abMailListDialog.dtd">
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
title="&mailListWindow.title;"
class="dialog"
@ -36,6 +36,7 @@ Rights Reserved.
align="vertical">
<script language="JavaScript" src="chrome://messenger/content/addressbook/abMailListDialog.js"/>
<script language="JavaScript" src="chrome://global/content/strres.js"/>
<keyset id="keyset"/>
@ -53,70 +54,9 @@ Rights Reserved.
</box>
<spring style="height:1em"/>
<box align="vertical" style="width:100%">
<box orient="horizontal">
<spring flex="1"/>
<text for="ListName" value="&ListName.label;" class="CardEditLabel"/>
<box class="CardEditWidth">
<textfield id="ListName" flex="1"/>
</box>
</box>
<box orient="horizontal">
<spring flex="1"/>
<text for="ListNickName" value="&ListNickName.label;" class="CardEditLabel"/>
<box class="CardEditWidth">
<textfield id="ListNickName" flex="1"/>
</box>
</box>
<box orient="horizontal">
<spring flex="1"/>
<text for="ListDescription" value="&ListDescription.label;" class="CardEditLabel"/>
<box class="CardEditWidth">
<textfield id="ListDescription" flex="1"/>
</box>
</box>
</box>
<spring style="height:1em"/>
<box id="editlist"/>
<text value="&AddressTitle.label;"/>
<spring style="height:0.1em"/>
<box orient="horizontal" flex="100%">
<box orient="vertical" flex="80%">
<tree id="addressListTree"
rows="8"
flex="100%"
onclick="awClickEmptySpace(true)"
style="border:solid black 1px">
<treechildren id="addressList">
<treeitem>
<treerow>
<treecell allowevents="true">
<textfield id="address#1"
flex="100%"
onkeydown="if (event.which == 9) awReturnHit(this);"
onclick="awNotAnEmptyArea(event);"
autocomplete="true"
timeout="300"
searchSessionType="addrbook"
/>
</treecell>
</treerow>
</treeitem>
</treechildren>
</tree>
</box>
<spring style="width:1em"/>
<box orient="vertical" flex="20%">
<spring style="height:30px"/>
<button id="button_remove" disabled="true" value="&RemoveButton.label;" />
<spring style="height:40px"/>
<button id="button_up" disabled="true" value="&UpButton.label;" />
<spring style="height:10px"/>
<button id="button_down" disabled="true" value="&DownButton.label;"/>
</box>
</box>
<spring style="height:1em"/>
<box id="okCancelButtons"/>

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

@ -241,16 +241,38 @@ function AbDelete()
}
*/
/*
function AbDeleteDirectory()
{
// dump("\AbDeleteDirectory from XUL\n");
var tree = document.getElementById('dirTree');
// if ( tree && tree.selectedItems && tree.selectedItems.length )
if ( tree )
top.addressbook.deleteAddressBooks(tree.database, tree, tree.selectedItems);
dump("\AbDeleteDirectory from XUL\n");
var selArray = dirTree.selectedItems;
var count = selArray.length;
debugDump("selArray.length = " + count + "\n");
if (count == 0)
return;
var parentArray = Components.classes["component://netscape/supports-array"].createInstance(Components.interfaces.nsISupportsArray);
if ( !parentArray ) return (false);
for ( var i = 0; i < count; ++i )
{
var parent = selArray[i].parentNode.parentNode;
if (parent)
{
if (parent == dirTree)
var parentId = "abdirectory://";
else
var parentId = parent.getAttribute("id");
debugDump(" parentId #" + i + " = " + parentId + "\n");
var dirResource = rdf.GetResource(parentId);
var parentDir = dirResource.QueryInterface(Components.interfaces.nsIAbDirectory);
parentArray.AppendElement(parentDir);
}
}
top.addressbook.deleteAddressBooks(dirTree.database, parentArray, dirTree.selectedItems);
}
*/

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

@ -42,6 +42,8 @@ install::
$(MAKE_INSTALL) abDragDrop.js $(DIST)\bin\chrome\messenger\content\addressbook
$(MAKE_INSTALL) abMailListDialog.xul $(DIST)\bin\chrome\messenger\content\addressbook
$(MAKE_INSTALL) abMailListDialog.js $(DIST)\bin\chrome\messenger\content\addressbook
$(MAKE_INSTALL) abListOverlay.xul $(DIST)\bin\chrome\messenger\content\addressbook
$(MAKE_INSTALL) abEditListDialog.xul $(DIST)\bin\chrome\messenger\content\addressbook
clobber::
rm -f $(DIST)\chrome\messenger\content\addressbook\abAddressBookNameDialog.js
@ -62,6 +64,8 @@ clobber::
rm -f $(DIST)\chrome\messenger\content\addressbook\abDragDrop.js
rm -f $(DIST)\chrome\messenger\content\addressbook\abMailListDialog.xul
rm -f $(DIST)\chrome\messenger\content\addressbook\abMailListDialog.js
rm -f $(DIST)\chrome\messenger\content\addressbook\abListOverlay.xul
rm -f $(DIST)\chrome\messenger\content\addressbook\abEditListDialog.xul