зеркало из https://github.com/mozilla/gecko-dev.git
Improvements to card view and edit view UI for address book.
This commit is contained in:
Родитель
0e3447b763
Коммит
ec1f6b8b18
|
@ -1,3 +1,13 @@
|
|||
var zWork = "Work: ";
|
||||
var zHome = "Home: ";
|
||||
var zFax = "Fax: ";
|
||||
var zCellular = "Cellular: ";
|
||||
var zPager = "Pager: ";
|
||||
var zCustom1 = "Custom 1: ";
|
||||
var zCustom2 = "Custom 2: ";
|
||||
var zCustom3 = "Custom 3: ";
|
||||
var zCustom4 = "Custom 4: ";
|
||||
|
||||
var rdf;
|
||||
var cvData;
|
||||
|
||||
|
@ -26,9 +36,15 @@ function OnLoadAddressBook()
|
|||
// Home section
|
||||
cvData.cvhHome = doc.getElementById("cvhHome");
|
||||
cvData.cvHomeAddress = doc.getElementById("cvHomeAddress");
|
||||
cvData.cvHomeAddress2 = doc.getElementById("cvHomeAddress2");
|
||||
cvData.cvHomeCityStZip = doc.getElementById("cvHomeCityStZip");
|
||||
cvData.cvHomeCountry = doc.getElementById("cvHomeCountry");
|
||||
// Other section
|
||||
cvData.cvhOther = doc.getElementById("cvhOther");
|
||||
cvData.cvCustom1 = doc.getElementById("cvCustom1");
|
||||
cvData.cvCustom2 = doc.getElementById("cvCustom2");
|
||||
cvData.cvCustom3 = doc.getElementById("cvCustom3");
|
||||
cvData.cvCustom4 = doc.getElementById("cvCustom4");
|
||||
cvData.cvNotes = doc.getElementById("cvNotes");
|
||||
// Phone section
|
||||
cvData.cvhPhone = doc.getElementById("cvhPhone");
|
||||
|
@ -40,9 +56,12 @@ function OnLoadAddressBook()
|
|||
// Work section
|
||||
cvData.cvhWork = doc.getElementById("cvhWork");
|
||||
cvData.cvJobTitle = doc.getElementById("cvJobTitle");
|
||||
cvData.cvDepartment = doc.getElementById("cvDepartment");
|
||||
cvData.cvCompany = doc.getElementById("cvCompany");
|
||||
cvData.cvWorkAddress = doc.getElementById("cvWorkAddress");
|
||||
cvData.cvWorkAddress2 = doc.getElementById("cvWorkAddress2");
|
||||
cvData.cvWorkCityStZip = doc.getElementById("cvWorkCityStZip");
|
||||
cvData.cvWorkCountry = doc.getElementById("cvWorkCountry");
|
||||
}
|
||||
|
||||
function DisplayCardViewPane(abNode)
|
||||
|
@ -51,7 +70,11 @@ function DisplayCardViewPane(abNode)
|
|||
var cardResource = parent.parent.rdf.GetResource(uri);
|
||||
var card = cardResource.QueryInterface(Components.interfaces.nsIAbCard);
|
||||
|
||||
var name = card.DisplayName;// FIX ME - this should be displayName
|
||||
var name = card.DisplayName;
|
||||
|
||||
var nickname;
|
||||
if ( card.NickName )
|
||||
nickname = "\"" + card.NickName + "\"";
|
||||
|
||||
var data = parent.parent.cvData;
|
||||
var visible;
|
||||
|
@ -66,28 +89,37 @@ function DisplayCardViewPane(abNode)
|
|||
|
||||
/* Name section */
|
||||
cvSetNode(data.cvhName, name);
|
||||
cvSetNode(data.cvNickname, "\"" + card.NickName + "\"");
|
||||
cvSetNode(data.cvNickname, nickname);
|
||||
cvSetNode(data.cvEmail1, card.PrimaryEmail);
|
||||
cvSetNode(data.cvEmail2, card.SecondEmail);
|
||||
/* Home section */
|
||||
visible = cvSetNode(data.cvHomeAddress, "not yet supported");
|
||||
visible = cvSetNode(data.cvHomeCityStZip, "not yet supported") || visible;
|
||||
visible = cvSetNode(data.cvHomeAddress, card.HomeAddress);
|
||||
visible = cvSetNode(data.cvHomeAddress2, card.HomeAddress2) || visible;
|
||||
visible = cvSetCityStateZip(data.cvHomeCityStZip, card.HomeCity, card.HomeState, card.HomeZipCode) || visible;
|
||||
visible = cvSetNode(data.cvHomeCountry, card.HomeCountry) || visible;
|
||||
cvSetVisible(data.cvhHome, visible);
|
||||
/* Other section */
|
||||
visible = cvSetNode(data.cvNotes, "not yet supported");
|
||||
visible = cvSetNodeWithLabel(data.cvCustom1, zCustom1, card.Custom1);
|
||||
visible = cvSetNodeWithLabel(data.cvCustom2, zCustom2, card.Custom2) || visible;
|
||||
visible = cvSetNodeWithLabel(data.cvCustom3, zCustom3, card.Custom3) || visible;
|
||||
visible = cvSetNodeWithLabel(data.cvCustom4, zCustom4, card.Custom4) || visible;
|
||||
visible = cvSetNode(data.cvNotes, card.Notes) || visible;
|
||||
cvSetVisible(data.cvhOther, visible);
|
||||
/* Phone section */
|
||||
visible = cvSetPhone(data.cvPhWork, "Work: ", card.WorkPhone);
|
||||
visible = cvSetPhone(data.cvPhHome, "Home: ", card.HomePhone) || visible;
|
||||
visible = cvSetPhone(data.cvPhFax, "Fax: ", card.FaxNumber) || visible;
|
||||
visible = cvSetPhone(data.cvPhCellular, "Cellular: ", card.CellularNumber) || visible;
|
||||
visible = cvSetPhone(data.cvPhPager, "Pager: ", card.PagerNumber) || visible;
|
||||
visible = cvSetNodeWithLabel(data.cvPhWork, zWork, card.WorkPhone);
|
||||
visible = cvSetNodeWithLabel(data.cvPhHome, zHome, card.HomePhone) || visible;
|
||||
visible = cvSetNodeWithLabel(data.cvPhFax, zFax, card.FaxNumber) || visible;
|
||||
visible = cvSetNodeWithLabel(data.cvPhCellular, zCellular, card.CellularNumber) || visible;
|
||||
visible = cvSetNodeWithLabel(data.cvPhPager, zPager, card.PagerNumber) || visible;
|
||||
cvSetVisible(data.cvhPhone, visible);
|
||||
/* Work section */
|
||||
visible = cvSetNode(data.cvJobTitle, "not yet supported");
|
||||
visible = cvSetNode(data.cvJobTitle, card.JobTitle);
|
||||
visible = cvSetNode(data.cvDepartment, card.Department) || visible;
|
||||
visible = cvSetNode(data.cvCompany, card.Company) || visible;
|
||||
visible = cvSetNode(data.cvWorkAddress, "not yet supported") || visible;
|
||||
visible = cvSetNode(data.cvWorkCityStZip, "not yet supported") || visible;
|
||||
visible = cvSetNode(data.cvWorkAddress, card.WorkAddress) || visible;
|
||||
visible = cvSetNode(data.cvWorkAddress2, card.WorkAddress2) || visible;
|
||||
visible = cvSetCityStateZip(data.cvWorkCityStZip, card.WorkCity, card.WorkState, card.WorkZipCode) || visible;
|
||||
visible = cvSetNode(data.cvWorkCountry, card.WorkCountry) || visible;
|
||||
cvSetVisible(data.cvhWork, visible);
|
||||
}
|
||||
|
||||
|
@ -127,14 +159,32 @@ function ClearCardViewPane()
|
|||
cvSetVisible(data.cvWorkCityStZip, false);
|
||||
}
|
||||
|
||||
function cvSetPhone(node, phone, text)
|
||||
function cvSetNodeWithLabel(node, label, text)
|
||||
{
|
||||
if ( text )
|
||||
return cvSetNode(node, phone + text);
|
||||
return cvSetNode(node, label + text);
|
||||
else
|
||||
return cvSetNode(node, "");
|
||||
}
|
||||
|
||||
function cvSetCityStateZip(node, city, state, zip)
|
||||
{
|
||||
var text;
|
||||
|
||||
if ( city )
|
||||
{
|
||||
text = city;
|
||||
if ( state || zip )
|
||||
text += ", ";
|
||||
}
|
||||
if ( state )
|
||||
text += state + " ";
|
||||
if ( zip )
|
||||
text += zip;
|
||||
|
||||
return cvSetNode(node, text);
|
||||
}
|
||||
|
||||
function cvSetNode(node, text)
|
||||
{
|
||||
node.childNodes[0].nodeValue = text;
|
||||
|
|
|
@ -36,11 +36,17 @@
|
|||
<html:div class="CardViewHeading" id="cvhHome">Home</html:div>
|
||||
<spring class="CardViewHeadingSpace"/>
|
||||
<html:div class="CardViewText" id="cvHomeAddress">*</html:div>
|
||||
<html:div class="CardViewText" id="cvHomeAddress2">*</html:div>
|
||||
<html:div class="CardViewText" id="cvHomeCityStZip">*</html:div>
|
||||
<html:div class="CardViewText" id="cvHomeCountry">*</html:div>
|
||||
</box>
|
||||
|
||||
<box id="cvbOther" align="vertical" class="CardView">
|
||||
<html:div class="CardViewHeading" id="cvhOther">Other</html:div>
|
||||
<html:div class="CardViewText" id="cvCustom1">*</html:div>
|
||||
<html:div class="CardViewText" id="cvCustom2">*</html:div>
|
||||
<html:div class="CardViewText" id="cvCustom3">*</html:div>
|
||||
<html:div class="CardViewText" id="cvCustom4">*</html:div>
|
||||
<html:div class="CardViewText" id="cvNotes">*</html:div>
|
||||
</box>
|
||||
</box>
|
||||
|
@ -63,9 +69,12 @@
|
|||
<html:div class="CardViewHeading" id="cvhWork">Work</html:div>
|
||||
<spring class="CardViewHeadingSpace"/>
|
||||
<html:div class="CardViewText" id="cvJobTitle">*</html:div>
|
||||
<html:div class="CardViewText" id="cvComapny">*</html:div>
|
||||
<html:div class="CardViewText" id="cvDepartment">*</html:div>
|
||||
<html:div class="CardViewText" id="cvCompany">*</html:div>
|
||||
<html:div class="CardViewText" id="cvWorkAddress">*</html:div>
|
||||
<html:div class="CardViewText" id="cvWorkAddress2">*</html:div>
|
||||
<html:div class="CardViewText" id="cvWorkCityStZip">*</html:div>
|
||||
<html:div class="CardViewText" id="cvWorkCountry">*</html:div>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
var card;
|
||||
var newCard = -1;
|
||||
var editCardTitlePrefix = "Card for ";
|
||||
|
||||
function OnLoadNewCard()
|
||||
{
|
||||
top.card = newCard;
|
||||
}
|
||||
|
||||
|
||||
function OnLoadEditCard()
|
||||
{
|
||||
|
@ -10,7 +18,9 @@ function OnLoadEditCard()
|
|||
// keep card in global for later
|
||||
top.card = window.arguments[0].card;
|
||||
|
||||
GetCardValues(top.card, frames["browser.editcard"].document)
|
||||
GetCardValues(top.card, frames["browser.editcard"].document);
|
||||
|
||||
//top.window.setAttribute('title', editCardTitlePrefix + top.card.DisplayName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
|
||||
<window xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="top.OnLoadEditCard()"
|
||||
flex="100%"
|
||||
style="width:100%; height:100%; border:none"
|
||||
align="vertical">
|
||||
|
||||
<tabcontrol align="vertical" style="margin: 5px; border: 2px groove white">
|
||||
|
@ -64,7 +63,7 @@
|
|||
<tab>&Other.tab;</tab>
|
||||
</tabbox>
|
||||
|
||||
<tabpanel include="chrome://addressbook/content/nsFrag2.xul" align="vertical" style="width:100%">
|
||||
<tabpanel include="chrome://addressbook/content/nsFrag2.xul" align="vertical" flex="100%">
|
||||
|
||||
<!-- ** Name Tab ** -->
|
||||
<box index="name" align="vertical" flex="100%">
|
||||
|
@ -134,12 +133,12 @@
|
|||
</box>
|
||||
<box align="horizontal">
|
||||
<spring flex="100%"/>
|
||||
<html:label for="WorkPhone">&WorkPhone.label;</html:label>
|
||||
<html:label for="HomePhone">&WorkPhone.label;</html:label>
|
||||
<html:input id="HomePhone" type="text" class="CardEdit"/>
|
||||
</box>
|
||||
<box align="horizontal">
|
||||
<spring flex="100%"/>
|
||||
<html:label for="WorkPhone">&WorkPhone.label;</html:label>
|
||||
<html:label for="FaxPhone">&WorkPhone.label;</html:label>
|
||||
<html:input id="FaxNumber" type="text" class="CardEdit"/>
|
||||
</box>
|
||||
<box align="horizontal">
|
||||
|
|
|
@ -3,15 +3,13 @@
|
|||
|
||||
<!DOCTYPE window
|
||||
[
|
||||
<!-- Title -->
|
||||
<!ENTITY editcardWindow.title "Card for *********">
|
||||
]>
|
||||
|
||||
<window xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&editcardWindow.title;"
|
||||
onload="OnLoadEditCard()"
|
||||
class="dialog"
|
||||
width="400" style="height:100%"
|
||||
width="400" style="height:100%; padding:0px"
|
||||
align="vertical">
|
||||
|
||||
<html:script language="JavaScript" src="chrome://addressbook/content/editcard.js"/>
|
||||
|
@ -24,7 +22,7 @@
|
|||
|
||||
<spring style="height:10px"/>
|
||||
|
||||
<box align="horizontal" flex="100%">
|
||||
<box align="horizontal">
|
||||
<spring flex="100%"/>
|
||||
<titledbutton id="ok" value="OK" class="push" onclick="EditCardOKButton()" />
|
||||
<spring style="width:10px"/>
|
||||
|
|
|
@ -5,26 +5,39 @@
|
|||
[
|
||||
<!-- Title -->
|
||||
<!ENTITY editcardWindow.title "New Card">
|
||||
<!-- Labels -->
|
||||
<!ENTITY chooseAddressBook.label "Add to: ">
|
||||
]>
|
||||
|
||||
<window xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&editcardWindow.title;"
|
||||
onload="OnLoadNewCard()"
|
||||
class="dialog"
|
||||
width="400" style="height:100%"
|
||||
width="400" style="height:100%; padding:0px"
|
||||
align="vertical">
|
||||
|
||||
<html:script language="JavaScript" src="chrome://addressbook/content/editcard.js"/>
|
||||
|
||||
|
||||
<!-- Results pane -->
|
||||
<box align="horizontal">
|
||||
<html:label for="chooseAddressBook">&chooseAddressBook.label;</html:label>
|
||||
<html:select id="chooseAddressBook">
|
||||
<html:option>Personal Address Book</html:option>
|
||||
</html:select>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
<spring style="height:1em"/>
|
||||
|
||||
<!-- editcard -->
|
||||
<html:iframe flex="100%"
|
||||
style="border:none"
|
||||
name="browser.newcard"
|
||||
src="chrome://addressbook/content/editcard.xul"/>
|
||||
|
||||
<spring style="height:10px"/>
|
||||
|
||||
<box align="horizontal" flex="100%">
|
||||
<box align="horizontal">
|
||||
<spring flex="100%"/>
|
||||
<titledbutton id="ok" value="OK" class="push" onclick="NewCardOKButton()" />
|
||||
<spring style="width:10px"/>
|
||||
|
|
|
@ -44,6 +44,12 @@ function SelectAddressCancelButton()
|
|||
top.window.close();
|
||||
}
|
||||
|
||||
|
||||
function SelectAddressNewButton()
|
||||
{
|
||||
AbNewCard();
|
||||
}
|
||||
|
||||
function SelectAddressEditButton()
|
||||
{
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
|
|
|
@ -33,8 +33,8 @@ Rights Reserved.
|
|||
<!ENTITY bccButton.label "Bcc:">
|
||||
<!ENTITY stopButton.label ".Stop">
|
||||
<!ENTITY searchButton.label ".Search...">
|
||||
<!ENTITY newButton.label ".New...">
|
||||
<!ENTITY editButton.label ".Edit...">
|
||||
<!ENTITY newButton.label "New...">
|
||||
<!ENTITY editButton.label "Edit...">
|
||||
<!ENTITY viewButton.label ".View">
|
||||
<!ENTITY removeButton.label "Remove">
|
||||
<!ENTITY okButton.label ".OK">
|
||||
|
|
Загрузка…
Ссылка в новой задаче