<%
var print_css = "" +
".font-bold{font-family:Helvetica-Neue-Bold;font-size:12px}.font-medium{font-family:Helvetica-Neue-Medium;font-size:12px}.font-regular{font-family:Helvetica-Neue-Regular;font-size:12px}.width-100{float:left;width:100%}.color-585A5D{color:#585A5D}.color-999999{color:#999}.print_wrapper{border:1px solid #D2D3D4;margin-top: 10px;}.print_wrapper:first-child{margin-top: 0px;}.block{border-bottom:1px dashed #d2d3d4}.block:last-child{border-bottom:none}.addresses>div:nth-child(2)>div.head {border-top: none!important}.notes>div:last-child{padding:5px}.data_left{float:left;width:49%;padding:14px 0 5px 5px}.data_right{float:right;width:49%;padding:10px 5px 10px 0}.data_defaultEmail,.data_defaultNumber,.data_displayName{padding-bottom:5px}.data_displayName{font-size:16px;color:#333}.data_company,.data_jobPosition,.data_separator{float:left}.data_company{margin-top:-1px}.data_birthday,.data_defaultEmail,.data_defaultNumber{float:right;text-align:right;width:100%}.phones>div{width:calc(16.66% - 5px);float:left;padding:5px 0}.addresses>div,.emails>div,.msgWebsite>div{width:calc(33.3% - 5px);float:left;padding:5px 0}.addresses>div:last-child{width:100%;float:left;padding:5px}.addresses>div:nth-child(2),.emails>div:nth-child(2),.msgWebsite>div:nth-child(11),.msgWebsite>div:nth-child(2),.msgWebsite>div:nth-child(5),.msgWebsite>div:nth-child(8),.phones>div:nth-child(2){padding-left:5px}.block>div div.head{padding-bottom:5px}.block>div div.data{padding-bottom:3px}.addresses>div div.data{padding-bottom:8px}.addresses>div:first-Child,.emails>div:first-Child,.msgWebsite>div:first-Child,.notes>div:first-Child,.phones>div:first-Child{padding:5px 5px 0;width:100%}.addresses>div:last-child>div.head{border-top:1px solid #d2d3d4;width:calc(100% - 10px);padding-top:5px}.msgWebsite .msgType .data {border-bottom: 1px solid #d2d3d4;}.noborder{border:none !important;}";
%>
<% _.each(contacts.items,function(contact,key,list){%>
<%
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);
});
%>
<%= _.escape(displayName)%>
<%= _.escape(jobTitle) %>
<%= _.escape(orgName) %>
<%= contact.defaultPhone %>
<%= _.escape(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){ %>
<%= _.escape(email)%>
<%})%>
<%}%>
<% if (emailWork.length){ %>
Work
<% _.each(emailWork, function(email){ %>
<%= _.escape(email)%>
<%})%>
<%}%>
<% if (emailOther.length){ %>
Other
<% _.each(emailOther, function(email){ %>
<%= _.escape(email)%>
<%})%>
<%}%>
<%}%>
<% if(contact.addresses.length){ %>
Address
<% if (addressPersonal.length){ %>
Personal
<% _.each(addressPersonal,function(address){%>
<%=_.escape(formatAddress(address))%>
<%})%>
<%}%>
<% if (addressBusiness.length){ %>
Business
<% _.each(addressBusiness,function(address){%>
<%=_.escape(formatAddress(address))%>
<%})%>
<%}%>
<% if (addressHome.length){ %>
Home
<% _.each(addressHome,function(address){%>
<%=_.escape(formatAddress(address))%>
<%})%>
<%}%>
<% if (addressOther.length){ %>
Other
<% _.each(addressOther,function(address){%>
<%=_.escape(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){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (imYahoo.length){%>
Yahoo IM
<% _.each(imYahoo, function(im,i){ %>
<%if (imYahoo.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (imMSN.length){%>
MSN IM
<% _.each(imMSN, function(im,i){ %>
<%if (imMSN.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (imICQ.length){%>
ICQ IM
<% _.each(imICQ, function(im,i){ %>
<%if (imICQ.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (imSkype.length){%>
Skype IM
<% _.each(imSkype, function(im, i){ %>
<%if (imSkype.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (imJabber.length){%>
Jabber IM
<% _.each(imJabber, function(im,i){ %>
<%if (imJabber.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (imOther.length){%>
Other IM
<% _.each(imOther, function(im,i){ %>
<%if (imOther.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (websiteBusiness.length){%>
<% _.each(websiteBusiness, function(im,i){ %>
Website - Business
<%if (websiteBusiness.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (websitePersonal.length){%>
<% _.each(websitePersonal, function(im,i){ %>
Website - Personal
<%if (websitePersonal.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<%if (websiteOther.length){%>
<% _.each(websiteOther, function(im,i){ %>
Website - Others
<%if (websiteOther.length-1==i){%>
<%=_.escape(im)%>
<%}else{%>
<%=_.escape(im)%>
<%}%>
<%});%>
<%}%>
<% } %>
<% if (contact.note){ %>
Notes
<%=_.escape(contact.note)%>
<% }%>