Bug 360288 SeaMonkey Front End Support for New Remote Content Policy

p=me r=neil sr=bienvenu
This commit is contained in:
bugzilla%arlen.demon.co.uk 2006-11-28 21:26:08 +00:00
Родитель ecbee8f960
Коммит f7b3d7283e
9 изменённых файлов: 140 добавлений и 117 удалений

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

@ -138,11 +138,12 @@ function OnLoadNewCard()
}
if ("aimScreenName" in window.arguments[0])
gEditCard.card.aimScreenName = window.arguments[0].aimScreenName;
if ("allowRemoteContent" in window.arguments[0])
document.getElementById('allowRemoteContent').checked =
window.arguments[0].allowRemoteContent == 'true';
if ("allowRemoteContent" in window.arguments[0]) {
gEditCard.card.allowRemoteContent = window.arguments[0].allowRemoteContent;
window.arguments[0].allowRemoteContent = false;
}
if ("okCallback" in window.arguments[0])
gOkCallback = window.arguments[0].okCallback;
@ -305,9 +306,9 @@ function OnLoadEditCard()
document.documentElement.buttons = "accept";
document.documentElement.removeAttribute("ondialogaccept");
}
// hide remote content in HTML field for remote directories
if (directory.isRemote)
// hide remote content in HTML field for remote directories
if (directory.isRemote)
document.getElementById('allowRemoteContent').hidden = true;
}
}
@ -407,6 +408,8 @@ function NewCardOKButton()
// the card that got created.
gEditCard.card = GetDirectoryFromURI(uri).addCard(gEditCard.card);
NotifySaveListeners();
if ("arguments" in window && window.arguments[0])
window.arguments[0].allowRemoteContent = gEditCard.card.allowRemoteContent;
}
}
@ -427,8 +430,8 @@ function GetCardValues(cardproperty, doc)
if (popup)
popup.value = cardproperty.preferMailFormat;
var allowRemoteContentEl = document.getElementById("allowRemoteContent");
if (allowRemoteContentEl)
var allowRemoteContentEl = document.getElementById("allowRemoteContent");
if (allowRemoteContentEl)
allowRemoteContentEl.checked = cardproperty.allowRemoteContent;
// get phonetic fields if exist
@ -468,8 +471,8 @@ function CheckAndSetCardValues(cardproperty, doc, check)
if (popup)
cardproperty.preferMailFormat = popup.value;
var allowRemoteContentEl = document.getElementById("allowRemoteContent");
if (allowRemoteContentEl)
var allowRemoteContentEl = document.getElementById("allowRemoteContent");
if (allowRemoteContentEl)
cardproperty.allowRemoteContent = allowRemoteContentEl.checked;
// set phonetic fields if exist

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

@ -6,7 +6,6 @@
<!DOCTYPE page SYSTEM "chrome://messenger/locale/pref-viewing_messages.dtd">
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:nc="http://home.netscape.com/NC-rdf#"
onload="parent.initPanel('chrome://messenger/content/pref-viewing_messages.xul');"
headertitle="&pref.viewing.messages.title;">
@ -16,43 +15,21 @@
"mailQuotedSize", "mailCitationColor",
"wrapLongLines", "displayGlyph",
"reuseMessageWindow", "disableContent",
"useWhiteList", "whiteListAbURI",
"markMessagesRead", "markMessagesReadAfter"];
var gMarkMessagesReadAfter;
function Startup() {
gMarkMessagesReadAfter = document.getElementById("markMessagesReadAfter");
enableTextbox(document.getElementById("markMessagesRead"), gMarkMessagesReadAfter, true);
enableWhiteList(document.getElementById("disableContent").checked);
}
function enableTextbox(checkbox, textbox, startingUp) {
textbox.disabled = isDisabled(checkbox.checked, textbox);
textbox.disabled = (!checkbox.checked ||
parent.hPrefWindow.getPrefIsLocked(textbox.getAttribute("prefstring")));
if (!textbox.disabled && !startingUp)
textbox.focus();
}
function isDisabled(aChecked, aElement) {
return (!aChecked ||
parent.hPrefWindow.getPrefIsLocked(aElement.getAttribute("prefstring")));
}
function enableCheckbox(aChecked, aCheckbox) {
var disabled = isDisabled(aChecked, aCheckbox);
aCheckbox.disabled = disabled;
return disabled;
}
function enableWhiteList(aChecked) {
var useWhiteList = document.getElementById("useWhiteList");
var disabled = enableCheckbox(aChecked, useWhiteList);
enableWLPopup(useWhiteList.checked && !disabled);
}
function enableWLPopup(aChecked) {
enableCheckbox(aChecked, document.getElementById("whiteListAbURI"));
}
]]>
</script>
@ -74,34 +51,7 @@
<checkbox id="disableContent" label="&disableContent.label;"
accesskey="&disableContent.accesskey;"
prefstring="mailnews.message_display.disable_remote_image"
prefattribute="checked" pref="true" preftype="bool"
oncommand="enableWhiteList(this.checked);"/>
<vbox class="indent">
<checkbox id="useWhiteList" label="&useWhiteList.label;"
accesskey="&useWhiteList.accesskey;"
prefstring="mailnews.message_display.disable_remote_images.useWhitelist"
prefattribute="checked" pref="true" preftype="bool"
oncommand="enableWLPopup(this.checked);"/>
<hbox class="indent">
<menulist id="whiteListAbURI" preftype="string"
prefstring="mailnews.message_display.disable_remote_images.whiteListAbURI"
ref="moz-abdirectory://"
datasources="rdf:addressdirectory"
sortActive="true" sortDirection="ascending"
sortResource="http://home.netscape.com/NC-rdf#DirTreeNameSort">
<template>
<rule nc:IsWriteable="false"/>
<rule nc:IsMailList="false">
<menupopup>
<menuitem uri="rdf:*"
label="rdf:http://home.netscape.com/NC-rdf#DirName"
value="rdf:http://home.netscape.com/NC-rdf#DirUri"/>
</menupopup>
</rule>
</template>
</menulist>
</hbox>
</vbox>
prefattribute="checked" pref="true" preftype="bool"/>
<separator class="thin"/>

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

@ -78,5 +78,3 @@
<!ENTITY existingWindowRadio.accesskey "e">
<!ENTITY disableContent.label "Block images and other content from remote sources">
<!ENTITY disableContent.accesskey "B">
<!ENTITY useWhiteList.label "but allow if the sender is in this address book:">
<!ENTITY useWhiteList.accesskey "a">

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

@ -2196,9 +2196,13 @@ var gMessageNotificationBar =
setRemoteContentMsg: function(aMsgHdr)
{
var blockRemote = aMsgHdr &&
aMsgHdr.getUint32Property("remoteContentPolicy") == kBlockRemoteContent;
this.updateMsgNotificationBar(kMsgNotificationRemoteImages, blockRemote);
// update the allow remote content for sender string
var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"]
.getService(Components.interfaces.nsIMsgHeaderParser);
var emailAddress = headerParser.extractHeaderAddressMailboxes(null, aMsgHdr.author);
document.getElementById('allowRemoteContentForAuthorDesc').value =
gMessengerBundle.getFormattedString('alwaysLoadRemoteContentForSender', [emailAddress ? emailAddress : aMsgHdr.author]);
this.updateMsgNotificationBar(kMsgNotificationRemoteImages, true);
},
// aUrl is the nsIURI for the message currently loaded in the message pane
@ -2234,7 +2238,11 @@ var gMessageNotificationBar =
}
};
function LoadMsgWithRemoteContent()
/**
* loadMsgWithRemoteContent
* Reload the current message, allowing remote content
*/
function loadMsgWithRemoteContent()
{
// we want to get the msg hdr for the currently selected message
// change the "remoteContentBar" property on it
@ -2243,6 +2251,76 @@ function LoadMsgWithRemoteContent()
setMsgHdrPropertyAndReload("remoteContentPolicy", kAllowRemoteContent);
}
/**
* msgHdrForCurrentMessage
* Returns the msg hdr associated with the current loaded message.
*/
function msgHdrForCurrentMessage()
{
var msgURI = GetLoadedMessage();
return (msgURI && !(/type=application\/x-message-display/.test(msgURI))) ? messenger.msgHdrFromURI(msgURI) : null;
}
/**
* Reloads the message after adjusting the remote content policy for the sender.
* Iterate through the local address books looking for a card with the same e-mail address as the
* sender of the current loaded message. If we find a card, update the allow remote content field.
* If we can't find a card, prompt the user with a new AB card dialog, pre-selecting the remote content field.
*/
function allowRemoteContentForSender()
{
// get the sender of the msg hdr
var msgHdr = msgHdrForCurrentMessage();
if (!msgHdr)
return;
var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"]
.getService(Components.interfaces.nsIMsgHeaderParser);
var names = {};
var addresses = {};
var fullNames = {};
var numAddresses;
numAddresses = headerParser.parseHeadersWithArray(msgHdr.author, addresses, names, fullNames);
var authorEmailAddress = addresses.value[0];
if (!authorEmailAddress)
return;
// search through all of our local address books looking for a match.
var parentDir = RDF.GetResource("moz-abdirectory://").QueryInterface(Components.interfaces.nsIAbDirectory);
var enumerator = parentDir.childNodes;
var cardForEmailAddress;
var addrbook;
while (!cardForEmailAddress && enumerator.hasMoreElements())
{
addrbook = enumerator.getNext();
if (addrbook instanceof Components.interfaces.nsIAbMDBDirectory)
cardForEmailAddress = addrbook.cardForEmailAddress(authorEmailAddress);
}
var allowRemoteContent = false;
if (cardForEmailAddress)
{
// set the property for remote content
cardForEmailAddress.allowRemoteContent = true;
cardForEmailAddress.editCardToDatabase("");
allowRemoteContent = true;
}
else
{
var args = {primaryEmail:authorEmailAddress, displayName:names.value[0],
allowRemoteContent:true};
// create a new card and set the property
window.openDialog("chrome://messenger/content/addressbook/abNewCardDialog.xul",
"", "chrome,resizable=no,titlebar,modal,centerscreen", args);
allowRemoteContent = args.allowRemoteContent;
}
// reload the message if we've updated the remote content policy for the sender
if (allowRemoteContent)
MsgReload();
}
function MsgIsNotAScam()
{
// we want to get the msg hdr for the currently selected message
@ -2257,16 +2335,11 @@ function setMsgHdrPropertyAndReload(aProperty, aValue)
// we want to get the msg hdr for the currently selected message
// change the appropiate property on it then reload the message
var msgURI = GetLoadedMessage();
if (msgURI && !(/type=application\/x-message-display/.test(msgURI)))
var msgHdr = msgHdrForCurrentMessage();
if (msgHdr)
{
var msgHdr = messenger.msgHdrFromURI(msgURI);
if (msgHdr)
{
msgHdr.setUint32Property(aProperty, aValue);
MsgReload();
}
msgHdr.setUint32Property(aProperty, aValue);
MsgReload();
}
}
@ -2275,14 +2348,8 @@ function checkMsgHdrPropertyIsNot(aProperty, aValue)
// we want to get the msg hdr for the currently selected message,
// get the appropiate property on it and then test against value.
var msgURI = GetLoadedMessage();
if (msgURI && !(/type=application\/x-message-display/.test(msgURI)))
{
var msgHdr = messenger.msgHdrFromURI(msgURI);
return (msgHdr && msgHdr.getUint32Property(aProperty) != aValue);
}
return false;
var msgHdr = msgHdrForCurrentMessage();
return (msgHdr && msgHdr.getUint32Property(aProperty) != aValue);
}
function MarkCurrentMessageAsRead()
@ -2310,17 +2377,15 @@ function OnMsgLoaded(aUrl)
return;
// nsIMsgMailNewsUrl.folder throws an error when opening .eml files.
var folder;
try {
var folder = aUrl.folder;
} catch (ex) {
return;
}
folder = aUrl.folder;
} catch (ex) {}
var msgURI = GetLoadedMessage();
if (!msgURI)
return;
var msgHdr = null;
if (!folder || !msgURI)
return;
// If we are in the middle of a delete or move operation, make sure that
// if the user clicks on another message then that message stays selected
@ -2328,8 +2393,7 @@ function OnMsgLoaded(aUrl)
// SetNextMessageAfterDelete() when the operation completes (bug 243532).
gNextMessageViewIndexAfterDelete = -2;
if (!(/type=application\/x-message-display/.test(msgURI)))
msgHdr = messenger.msgHdrFromURI(msgURI);
var msgHdr = msgHdrForCurrentMessage();
gMessageNotificationBar.setJunkMsg(msgHdr);

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

@ -1942,9 +1942,13 @@
<hbox id="remoteContentBar" class="msgNotificationBar" align="center">
<image id="remoteContentImage"/>
<description flex="1" class="msgNotificationBarText">&remoteContentMessage.label;</description>
<vbox>
<description flex="1" class="msgNotificationBarText">&remoteContentMessage.label;</description>
<label id="allowRemoteContentForAuthorDesc" class="text-link" flex="1"
onclick="allowRemoteContentForSender();"/>
</vbox>
<spacer flex="1"/>
<button label="&loadRemoteContentButton.label;" oncommand="LoadMsgWithRemoteContent();"/>
<button label="&loadRemoteContentButton.label;" oncommand="loadMsgWithRemoteContent();"/>
</hbox>
</deck>

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

@ -379,5 +379,5 @@ confirmPhishingTitle=Email Scam Alert
confirmPhishingUrl1=%1$S thinks this site is suspicious! It may be trying to impersonate the web page you want to visit. Most legitimate sites use names instead of numbers. Are you sure you want to visit %2$S?
confirmPhishingUrl2=%1$S thinks this site is suspicious! It may be trying to impersonate the web page you want to visit. Are you sure you want to visit %2$S?
#LOCALIZATION NOTE %1$S is the e-mail address of the person we will allow remote images for
alwaysLoadRemoteContentForSender=Click here to always load remote images from %1$S
#LOCALIZATION NOTE %1$S is the e-mail address of the person we will allow remote content for
alwaysLoadRemoteContentForSender=Click here to always load remote content from %1$S.

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

@ -547,8 +547,8 @@
and Plug-ins</h2>
<p>By default, images and other content, that is hosted remotely, will not
display in messages you receive, except from senders in your Personal
Address Book. To change these settings:</p>
display in messages you receive, except from senders in your address books
whom you have allowed. To change these settings:</p>
<ol>
<li>Open the <span class="mac">&brandShortName;</span>
@ -556,20 +556,15 @@
<li>Under the Mail &amp; Newsgroups category, click Message Display. (If
no subcategories are visible, double-click Mail &amp; Newsgroups to
expand the list.)</li>
<li>In the General section, do one of the following:
<ul>
<li>To allow all remote content, uncheck <q>Block images and other
content from remote sources</q>.</li>
<li>To block all remote content, uncheck <q>but allow if the sender is in
this address book:</q>.</li>
<li>To change which address book you use for people who send messages
that are allowed to display remote content, select the correct address
book from the drop down.</li>
</ul>
</li>
<li>Uncheck <q>Block images and other content from remote sources</q>.</li>
<li>Click OK to have your change take affect.</li>
</ol>
<p><strong>Note</strong>: See <q>Allow remote images in HTML mail</q> in
<a href="#creating_a_new_address_book_card">Creating a New Address Book
Card</a> for details of how to change which senders can show remote
content.</p>
<p>By default, JavaScript and plug-ins are not enabled for mail messages you
receive. To change these settings:</p>
@ -1643,6 +1638,9 @@
Mail &amp; Newsgroups still can&apos;t determine the correct
format, Mail &amp; Newsgroups will prompt you to choose a sending
format when you send the message.</li>
<li>Allow remote images in HTML mail: If you want to allow this
sender to have remote content they send you displayed in your
message window.</li>
<li>Screen name (the AIM contact name).</li>
<li>Phones (enter phone numbers for this person)</li>
</ul>
@ -4458,10 +4456,8 @@ to filter unwanted mail, and how phishing detection works.</p>
want to open a new one for each.</li>
<li><strong>Block images and other content from remote sources</strong>:
Select this checkbox if you do not want to display remote images and other
content in received messages. (This checkbox is selected by default.)</li>
<li><strong>but allow if the sender is in this address book</strong>: Select
this checkbox if you want to allow remote content in messages from senders
in the chosen address book. (This checkbox is selected by default.)</li>
content in received messages, except from senders in your address books
whom you have allowed. (This checkbox is selected by default.)</li>
<li><strong>Wait [__] seconds before marking a message as read</strong>:
Choose this option if you do not want a message to be marked as read when
you are only taking a brief look at it. Enter the number of seconds you

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

@ -270,3 +270,7 @@
list-style-image: url("chrome://messenger/skin/icons/remote-blocked.png");
padding: 3px;
}
#allowRemoteContentForAuthorDesc {
padding-left: 10px;
}

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

@ -281,3 +281,7 @@
list-style-image: url("chrome://messenger/skin/icons/remote-blocked.png");
padding: 3px;
}
#allowRemoteContentForAuthorDesc {
padding-left: 10px;
}