From efaadc9d6ebe8eb6c871abd87b409c50594f8706 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Sun, 28 Oct 2001 04:21:46 +0000 Subject: [PATCH] fix for #57756. when clicking on a link in the addressbook card page, it should open up a new window, or use and existing browser window. also, the links should look and act like links. initial patch by jessica blanco (jblanco@us.ibm.com), r=racham, sr=sspitzer,bienvenu --- .../resources/content/abCardViewOverlay.js | 41 ++++++++++++++----- .../resources/content/abCardViewOverlay.xul | 16 +++++--- .../messenger/addressbook/mac/addressbook.css | 9 +++- .../messenger/addressbook/win/addressbook.css | 9 +++- .../messenger/addressbook/addressbook.css | 9 +++- 5 files changed, 65 insertions(+), 19 deletions(-) diff --git a/mailnews/addrbook/resources/content/abCardViewOverlay.js b/mailnews/addrbook/resources/content/abCardViewOverlay.js index 106c6c9f51e6..fc84c08dd61f 100644 --- a/mailnews/addrbook/resources/content/abCardViewOverlay.js +++ b/mailnews/addrbook/resources/content/abCardViewOverlay.js @@ -73,7 +73,9 @@ function OnLoadCardView() cvData.cvhName = doc.getElementById("cvhName"); cvData.cvNickname = doc.getElementById("cvNickname"); cvData.cvDisplayName = doc.getElementById("cvDisplayName"); + cvData.cvEmail1Box = doc.getElementById("cvEmail1Box"); cvData.cvEmail1 = doc.getElementById("cvEmail1"); + cvData.cvEmail2Box = doc.getElementById("cvEmail2Box"); cvData.cvEmail2 = doc.getElementById("cvEmail2"); // Home section cvData.cvbHome = doc.getElementById("cvbHome"); @@ -152,17 +154,19 @@ function DisplayCardViewPane(abNode) cvSetNode(data.cvhName, nameHeader); cvSetNodeWithLabel(data.cvNickname, zNickname, card.nickName); cvSetNodeWithLabel(data.cvDisplayName, zDisplayName, card.displayName); - cvSetNode(data.cvEmail1, card.primaryEmail); - cvSetNode(data.cvEmail2, card.secondEmail); + + visible = HandleLink(data.cvEmail1, card.primaryEmail, data.cvEmail1Box, "mailto:") || visible; + + visible = HandleLink(data.cvEmail2, card.secondEmail, data.cvEmail2Box, "mailto:") || visible; + // Home section 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; - var homeWebPageVisible = cvSetNode(data.cvHomeWebPage, card.webPage2); - visible = homeWebPageVisible || visible; - data.cvHomeWebPage.setAttribute('href', card.webPage2); - cvSetVisible(data.cvHomeWebPageBox, homeWebPageVisible); + + visible = HandleLink(data.cvHomeWebPage, card.webPage2, data.cvHomeWebPageBox, "") || visible; + cvSetVisible(data.cvhHome, visible); cvSetVisible(data.cvbHome, visible); // Other section @@ -189,10 +193,9 @@ function DisplayCardViewPane(abNode) 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; - var workWebPageVisible = cvSetNode(data.cvWorkWebPage, card.webPage1); - visible = workWebPageVisible || visible; - data.cvWorkWebPage.setAttribute('href', card.webPage1); - cvSetVisible(data.cvWorkWebPageBox, workWebPageVisible); + + visible = HandleLink(data.cvWorkWebPage, card.webPage1, data.cvWorkWebPageBox, "") || visible; + cvSetVisible(data.cvhWork, visible); cvSetVisible(data.cvbWork, visible); @@ -264,3 +267,21 @@ function cvSetVisible(node, visible) node.setAttribute("collapsed", "true"); } +function HandleLink(node, value, box, prefix) +{ + var visible = cvSetNode(node, value); + if (visible) + node.setAttribute('href', prefix + value); + cvSetVisible(box, visible); + + return visible; +} + + +function openLink(id) +{ + openTopWin(document.getElementById(id).getAttribute("href")); + // return false, so we don't load the href in the addressbook window + return false; +} + diff --git a/mailnews/addrbook/resources/content/abCardViewOverlay.xul b/mailnews/addrbook/resources/content/abCardViewOverlay.xul index 2daff33772c1..5c58275517b2 100644 --- a/mailnews/addrbook/resources/content/abCardViewOverlay.xul +++ b/mailnews/addrbook/resources/content/abCardViewOverlay.xul @@ -40,8 +40,12 @@ Rights Reserved. - - + + + + + + @@ -50,8 +54,8 @@ Rights Reserved. - - + + @@ -86,8 +90,8 @@ Rights Reserved. - - + + diff --git a/themes/classic/messenger/addressbook/mac/addressbook.css b/themes/classic/messenger/addressbook/mac/addressbook.css index 08ea533e3c32..cb4b37e00c59 100644 --- a/themes/classic/messenger/addressbook/mac/addressbook.css +++ b/themes/classic/messenger/addressbook/mac/addressbook.css @@ -198,13 +198,20 @@ sidebarheader { min-width: 30px; } -.CardViewText { +.CardViewText, +.CardViewLink { padding-left: 20px; padding-right: 2px; min-width: 30px; margin: 0px; } +.CardViewLink { + color: blue; + text-decoration: underline; + cursor: pointer; +} + html|a { padding-left: 0px; padding-right: 2px; diff --git a/themes/classic/messenger/addressbook/win/addressbook.css b/themes/classic/messenger/addressbook/win/addressbook.css index 0588aba67972..9ba1489a2c86 100644 --- a/themes/classic/messenger/addressbook/win/addressbook.css +++ b/themes/classic/messenger/addressbook/win/addressbook.css @@ -203,13 +203,20 @@ sidebarheader { min-width: 30px; } -.CardViewText { +.CardViewText, +.CardViewLink { padding-left: 20px; padding-right: 2px; min-width: 30px; margin: 0px; } +.CardViewLink { + color: blue; + text-decoration: underline; + cursor: pointer; +} + html|a { padding-left: 0px; padding-right: 2px; diff --git a/themes/modern/messenger/addressbook/addressbook.css b/themes/modern/messenger/addressbook/addressbook.css index bb5a2c15d658..bdac3ea81ffe 100644 --- a/themes/modern/messenger/addressbook/addressbook.css +++ b/themes/modern/messenger/addressbook/addressbook.css @@ -201,13 +201,20 @@ sidebarheader { font-weight: bold; } -.CardViewText { +.CardViewText, +.CardViewLink { margin: 0px; padding-right: 2px; padding-left: 20px; min-width: 30px; } +.CardViewLink { + color: blue; + text-decoration: underline; + cursor: pointer; +} + html|a { border: none !important; padding-right: 2px;