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
This commit is contained in:
sspitzer%netscape.com 2001-10-28 04:21:46 +00:00
Родитель ce040d977a
Коммит efaadc9d6e
5 изменённых файлов: 65 добавлений и 19 удалений

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

@ -73,7 +73,9 @@ function OnLoadCardView()
cvData.cvhName = doc.getElementById("cvhName"); cvData.cvhName = doc.getElementById("cvhName");
cvData.cvNickname = doc.getElementById("cvNickname"); cvData.cvNickname = doc.getElementById("cvNickname");
cvData.cvDisplayName = doc.getElementById("cvDisplayName"); cvData.cvDisplayName = doc.getElementById("cvDisplayName");
cvData.cvEmail1Box = doc.getElementById("cvEmail1Box");
cvData.cvEmail1 = doc.getElementById("cvEmail1"); cvData.cvEmail1 = doc.getElementById("cvEmail1");
cvData.cvEmail2Box = doc.getElementById("cvEmail2Box");
cvData.cvEmail2 = doc.getElementById("cvEmail2"); cvData.cvEmail2 = doc.getElementById("cvEmail2");
// Home section // Home section
cvData.cvbHome = doc.getElementById("cvbHome"); cvData.cvbHome = doc.getElementById("cvbHome");
@ -152,17 +154,19 @@ function DisplayCardViewPane(abNode)
cvSetNode(data.cvhName, nameHeader); cvSetNode(data.cvhName, nameHeader);
cvSetNodeWithLabel(data.cvNickname, zNickname, card.nickName); cvSetNodeWithLabel(data.cvNickname, zNickname, card.nickName);
cvSetNodeWithLabel(data.cvDisplayName, zDisplayName, card.displayName); 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 // Home section
visible = cvSetNode(data.cvHomeAddress, card.homeAddress); visible = cvSetNode(data.cvHomeAddress, card.homeAddress);
visible = cvSetNode(data.cvHomeAddress2, card.homeAddress2) || visible; visible = cvSetNode(data.cvHomeAddress2, card.homeAddress2) || visible;
visible = cvSetCityStateZip(data.cvHomeCityStZip, card.homeCity, card.homeState, card.homeZipCode) || visible; visible = cvSetCityStateZip(data.cvHomeCityStZip, card.homeCity, card.homeState, card.homeZipCode) || visible;
visible = cvSetNode(data.cvHomeCountry, card.homeCountry) || visible; visible = cvSetNode(data.cvHomeCountry, card.homeCountry) || visible;
var homeWebPageVisible = cvSetNode(data.cvHomeWebPage, card.webPage2);
visible = homeWebPageVisible || visible; visible = HandleLink(data.cvHomeWebPage, card.webPage2, data.cvHomeWebPageBox, "") || visible;
data.cvHomeWebPage.setAttribute('href', card.webPage2);
cvSetVisible(data.cvHomeWebPageBox, homeWebPageVisible);
cvSetVisible(data.cvhHome, visible); cvSetVisible(data.cvhHome, visible);
cvSetVisible(data.cvbHome, visible); cvSetVisible(data.cvbHome, visible);
// Other section // Other section
@ -189,10 +193,9 @@ function DisplayCardViewPane(abNode)
visible = cvSetNode(data.cvWorkAddress2, card.workAddress2) || visible; visible = cvSetNode(data.cvWorkAddress2, card.workAddress2) || visible;
visible = cvSetCityStateZip(data.cvWorkCityStZip, card.workCity, card.workState, card.workZipCode) || visible; visible = cvSetCityStateZip(data.cvWorkCityStZip, card.workCity, card.workState, card.workZipCode) || visible;
visible = cvSetNode(data.cvWorkCountry, card.workCountry) || visible; visible = cvSetNode(data.cvWorkCountry, card.workCountry) || visible;
var workWebPageVisible = cvSetNode(data.cvWorkWebPage, card.webPage1);
visible = workWebPageVisible || visible; visible = HandleLink(data.cvWorkWebPage, card.webPage1, data.cvWorkWebPageBox, "") || visible;
data.cvWorkWebPage.setAttribute('href', card.webPage1);
cvSetVisible(data.cvWorkWebPageBox, workWebPageVisible);
cvSetVisible(data.cvhWork, visible); cvSetVisible(data.cvhWork, visible);
cvSetVisible(data.cvbWork, visible); cvSetVisible(data.cvbWork, visible);
@ -264,3 +267,21 @@ function cvSetVisible(node, visible)
node.setAttribute("collapsed", "true"); 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;
}

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

@ -40,8 +40,12 @@ Rights Reserved.
<html class="CardViewHeading" hide="true" id="cvhName"/> <html class="CardViewHeading" hide="true" id="cvhName"/>
<html class="CardViewText" hide="true" id="cvDisplayName"/> <html class="CardViewText" hide="true" id="cvDisplayName"/>
<html class="CardViewText" hide="true" id="cvNickname"/> <html class="CardViewText" hide="true" id="cvNickname"/>
<html class="CardViewText" hide="true" id="cvEmail1"/> <html class="CardViewLink" hide="true" id="cvEmail1Box">
<html class="CardViewText" hide="true" id="cvEmail2"/> <html:p><html:a href="" id="cvEmail1"/>
</html:p></html>
<html class="CardViewLink" hide="true" id="cvEmail2Box">
<html:p><html:a href="" id="cvEmail2"/>
</html:p></html>
</vbox> </vbox>
<vbox id="cvbHome" class="cardViewGroup"> <vbox id="cvbHome" class="cardViewGroup">
@ -50,8 +54,8 @@ Rights Reserved.
<html class="CardViewText" hide="true" id="cvHomeAddress2"/> <html class="CardViewText" hide="true" id="cvHomeAddress2"/>
<html class="CardViewText" hide="true" id="cvHomeCityStZip"/> <html class="CardViewText" hide="true" id="cvHomeCityStZip"/>
<html class="CardViewText" hide="true" id="cvHomeCountry"/> <html class="CardViewText" hide="true" id="cvHomeCountry"/>
<html class="CardViewText" hide="true" id="cvHomeWebPageBox"> <html class="CardViewLink" hide="true" id="cvHomeWebPageBox">
<html:p><html:a href="" id="cvHomeWebPage"/> <html:p><html:a onclick="return openLink('cvHomeWebPage');" href="" id="cvHomeWebPage"/>
</html:p></html> </html:p></html>
</vbox> </vbox>
@ -86,8 +90,8 @@ Rights Reserved.
<html class="CardViewText" hide="true" id="cvWorkAddress2"/> <html class="CardViewText" hide="true" id="cvWorkAddress2"/>
<html class="CardViewText" hide="true" id="cvWorkCityStZip"/> <html class="CardViewText" hide="true" id="cvWorkCityStZip"/>
<html class="CardViewText" hide="true" id="cvWorkCountry"/> <html class="CardViewText" hide="true" id="cvWorkCountry"/>
<html class="CardViewText" hide="true" id="cvWorkWebPageBox"> <html class="CardViewLink" hide="true" id="cvWorkWebPageBox">
<html:p><html:a href="" id="cvWorkWebPage"/> <html:p><html:a onclick="return openLink('cvWorkWebPage');" href="" id="cvWorkWebPage"/>
</html:p></html> </html:p></html>
</vbox> </vbox>
</vbox> </vbox>

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

@ -198,13 +198,20 @@ sidebarheader {
min-width: 30px; min-width: 30px;
} }
.CardViewText { .CardViewText,
.CardViewLink {
padding-left: 20px; padding-left: 20px;
padding-right: 2px; padding-right: 2px;
min-width: 30px; min-width: 30px;
margin: 0px; margin: 0px;
} }
.CardViewLink {
color: blue;
text-decoration: underline;
cursor: pointer;
}
html|a { html|a {
padding-left: 0px; padding-left: 0px;
padding-right: 2px; padding-right: 2px;

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

@ -203,13 +203,20 @@ sidebarheader {
min-width: 30px; min-width: 30px;
} }
.CardViewText { .CardViewText,
.CardViewLink {
padding-left: 20px; padding-left: 20px;
padding-right: 2px; padding-right: 2px;
min-width: 30px; min-width: 30px;
margin: 0px; margin: 0px;
} }
.CardViewLink {
color: blue;
text-decoration: underline;
cursor: pointer;
}
html|a { html|a {
padding-left: 0px; padding-left: 0px;
padding-right: 2px; padding-right: 2px;

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

@ -201,13 +201,20 @@ sidebarheader {
font-weight: bold; font-weight: bold;
} }
.CardViewText { .CardViewText,
.CardViewLink {
margin: 0px; margin: 0px;
padding-right: 2px; padding-right: 2px;
padding-left: 20px; padding-left: 20px;
min-width: 30px; min-width: 30px;
} }
.CardViewLink {
color: blue;
text-decoration: underline;
cursor: pointer;
}
html|a { html|a {
border: none !important; border: none !important;
padding-right: 2px; padding-right: 2px;