<%
var displayName, jobTitle, orgName,
phoneMobile = [],
phoneHome = [],
phoneFax = [],
phoneWork = [],
phoneOther = [],
phonePager = [],
emailWork = [],
emailPersonal = [],
emailOther = [],
addressHome = [],
addressPersonal = [],
addressBusiness = [],
addressOther = [],
websitePersonal = [],
websiteBusiness = [],
websiteOther = [],
imYahoo = [],
imICQ = [],
imGoogle = [],
imMSN = [],
imSkype = [],
imJabber = [],
imOther = [];
var phoneMap = {
"businessfax" : phoneFax,
"business" : phoneWork,
"mobile" : phoneMobile,
"home" : phoneHome,
"other" : phoneOther,
"pager" : phonePager
}
var emailMap = {
"personal" : emailPersonal,
"business" : emailWork,
"other" : emailOther
};
var addressMap = {
"home" : addressHome,
"other" : addressOther,
"personal" : addressPersonal,
"business" : addressBusiness
};
var websiteMap = {
"personal" : websitePersonal,
"business" : websiteBusiness,
"other" : websiteOther
};
var imMap = {
"jabber" : imJabber,
"yahoo" : imYahoo,
"icq" : imICQ,
"google" : imGoogle,
"msn" : imMSN,
"skype" : imSkype,
"other" : imOther
};
if(contact.displayName != "" ) {
displayName = contact.displayName;
} else {
displayName = contact.lastName + " " +contact.firstName;
}
if (contact.jobTitle && contact.orgName){
jobTitle = contact.jobTitle + ",";
orgName = contact.orgName;
} else {
if (contact.jobTitle){
jobTitle = contact.jobTitle;
}
if (contact.orgName){
orgName = contact.orgName;
}
}
_.each(contact.phones, function(phone){
var arr = phoneMap[phone.phoneType] || phoneOther;
arr.push(phone.number);
});
_.each(contact.emails, function(email){
var arr = emailMap[email.emailType] || emailOther;
emailOther.push(email.address);
});
_.each(contact.addresses, function(address){
var arr = addressMap[address.addressType] || addressOther;
arr.push(address);
});
_.each(contact.webpages, function(webpage){
var arr = websiteMap[webpage.webPageType] || websiteOther;
arr.push(webpage.url);
});
_.each(contact.ims, function(im){
var arr = imMap[im.imType] || imOther;
arr.push(im.address);
});
%>
<%= displayName%>
<%= jobTitle %>
<%= orgName %>
<%= contact.defaultPhone %>
<%= contact.defaultEmail %>
<% if(contact.birthday != "" ) {%>
Birthday: <%=contact.birthday%>
<%}%>
<% if (contact.phones.length > 1){ %>
Phone
<% if (phoneHome.length){ %>
Home
<% _.each(phoneHome, function(phone){ %>
<%=phone%>
<%})%>
<%}%>
<% if (phoneMobile.length){ %>
Mobile
<% _.each(phoneMobile, function(phone){ %>
<%=phone%>
<%})%>
<%}%>
<% if (phoneWork.length){ %>
Work
<% _.each(phoneWork, function(phone){ %>
<%=phone%>
<%})%>
<%}%>
<% if (phoneFax.length){ %>
Business Fax
<% _.each(phoneFax, function(phone){ %>
<%=phone%>
<%})%>
<%}%>
<% if (phonePager.length){ %>
<%}%>
<% if (phoneOther.length){ %>
Other
<% _.each(phoneOther, function(phone){ %>
<%=phone%>
<%})%>
<%}%>
<%}%>
<% if (contact.emails.length > 1){ %>
Email
<% if (emailPersonal.length){ %>
Personal
<% _.each(emailPersonal, function(email){ %>
<%= email%>
<%})%>
<%}%>
<% if (emailWork.length){ %>
Work
<% _.each(emailWork, function(email){ %>
<%= email%>
<%})%>
<%}%>
<% if (emailOther.length){ %>
Other
<% _.each(emailOther, function(email){ %>
<%= email%>
<%})%>
<%}%>
<%}%>
<% if(contact.addresses.length){ %>
Address
<% if (addressPersonal.length){ %>
Personal
<% _.each(addressPersonal,function(address){%>
<%=formatAddress(address)%>
<%})%>
<%}%>
<% if (addressBusiness.length){ %>
Business
<% _.each(addressBusiness,function(address){%>
<%=formatAddress(address)%>
<%})%>
<%}%>
<% if (addressHome.length){ %>
Home
<% _.each(addressHome,function(address){%>
<%=formatAddress(address)%>
<%})%>
<%}%>
<% if (addressOther.length){ %>
Other
<% _.each(addressOther,function(address){%>
<%=formatAddress(address)%>
<%})%>
<%}%>
<% }%>
<% if (contact.webpages.length || contact.ims.length){ %>
Messages and Websites
<%if (imGoogle.length){%>
Google IM
<% _.each(imGoogle, function(im,i){ %>
<%if (imGoogle.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (imYahoo.length){%>
Yahoo IM
<% _.each(imYahoo, function(im,i){ %>
<%if (imYahoo.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (imMSN.length){%>
MSN IM
<% _.each(imMSN, function(im,i){ %>
<%if (imMSN.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (imICQ.length){%>
ICQ IM
<% _.each(imICQ, function(im,i){ %>
<%if (imICQ.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (imSkype.length){%>
Skype IM
<% _.each(imSkype, function(im, i){ %>
<%if (imSkype.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (imJabber.length){%>
Jabber IM
<% _.each(imJabber, function(im,i){ %>
<%if (imJabber.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (imOther.length){%>
Other IM
<% _.each(imOther, function(im,i){ %>
<%if (imOther.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (websiteBusiness.length){%>
<% _.each(websiteBusiness, function(im,i){ %>
Website - Business
<%if (websiteBusiness.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (websitePersonal.length){%>
<% _.each(websitePersonal, function(im,i){ %>
Website - Personal
<%if (websitePersonal.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<%if (websiteOther.length){%>
<% _.each(websiteOther, function(im,i){ %>
Website - Others
<%if (websiteOther.length-1==i){%>
<%=im%>
<%}else{%>
<%=im%>
<%}%>
<%});%>
<%}%>
<% } %>
<% if (contact.note){ %>
<% }%>
<% }); %>