2000-01-03 23:06:39 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code, released
|
|
|
|
* March 31, 1998.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This is where functions related to displaying the headers for a selected message in the
|
|
|
|
message pane live. */
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Warning: if you go to modify any of these JS routines please get a code review from either
|
|
|
|
// hangas@netscape.com or mscott@netscape.com. It's critical that the code in here for displaying
|
|
|
|
// the message headers for a selected message remain as fast as possible. In particular,
|
|
|
|
// right now, we only introduce one reflow per message. i.e. if you click on a message in the thread
|
|
|
|
// pane, we batch up all the changes for displaying the header pane (to, cc, attachements button, etc.)
|
|
|
|
// and we make a single pass to display them. It's critical that we maintain this one reflow per message
|
|
|
|
// view in the message header pane.
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
var msgHeaderParserProgID = "component://netscape/messenger/headerparser";
|
2000-02-15 06:50:53 +00:00
|
|
|
var abAddressCollectorProgID = "component://netscape/addressbook/services/addressCollecter";
|
2000-01-06 00:36:35 +00:00
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
var msgPaneData;
|
2000-04-14 02:54:09 +00:00
|
|
|
var currentHeaderData = {};
|
2000-05-17 04:21:40 +00:00
|
|
|
// gGeneratedViewAllHeaderInfo --> we clear this every time we start to display a new message.
|
|
|
|
// the view all header popup will set it when we first generate a view of all the headers. this is
|
|
|
|
// just so it won't try to regenerate all the information every time the user clicks on the popup.
|
|
|
|
var gGeneratedViewAllHeaderInfo = false;
|
2000-05-17 06:30:20 +00:00
|
|
|
var gViewAllHeaders = false;
|
2000-01-06 00:36:35 +00:00
|
|
|
var gNumAddressesToShow = 3;
|
2000-04-01 00:40:53 +00:00
|
|
|
var gShowUserAgent = false;
|
2000-01-06 00:36:35 +00:00
|
|
|
|
2000-04-13 22:19:48 +00:00
|
|
|
// attachments array
|
|
|
|
var attachmentUrlArray = new Array();
|
|
|
|
var attachmentDisplayNameArray = new Array();
|
|
|
|
var attachmentMessageUriArray = new Array();
|
|
|
|
|
2000-02-10 04:22:46 +00:00
|
|
|
var msgHeaderParser = Components.classes[msgHeaderParserProgID].getService(Components.interfaces.nsIMsgHeaderParser);
|
2000-02-15 06:50:53 +00:00
|
|
|
var abAddressCollector = Components.classes[abAddressCollectorProgID].getService(Components.interfaces.nsIAbAddressCollecter);
|
2000-01-03 23:06:39 +00:00
|
|
|
|
|
|
|
function OnLoadMsgHeaderPane()
|
|
|
|
{
|
|
|
|
// build a document object for the header pane so we can cache fetches for elements
|
|
|
|
// in a local variable
|
|
|
|
// if you add more document elements with ids to msgHeaderPane.xul, you should add
|
|
|
|
// to this object...
|
|
|
|
msgPaneData = new Object;
|
2000-08-24 00:18:15 +00:00
|
|
|
|
|
|
|
// HACK...force our XBL bindings file to be load before we try to create our first xbl widget....
|
|
|
|
// otherwise we have problems.
|
|
|
|
|
|
|
|
document.loadBindingDocument('chrome://messenger/content/mailWidgets.xml');
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
if (msgPaneData)
|
|
|
|
{
|
|
|
|
// First group of headers
|
|
|
|
msgPaneData.SubjectBox = document.getElementById("SubjectBox");
|
|
|
|
msgPaneData.SubjectValue = document.getElementById("SubjectValue");
|
|
|
|
msgPaneData.FromBox = document.getElementById("FromBox");
|
|
|
|
msgPaneData.FromValue = document.getElementById("FromValue");
|
2000-08-24 00:18:15 +00:00
|
|
|
msgPaneData.ReplyToBox = document.getElementById("ReplyToBox");
|
|
|
|
msgPaneData.ReplyToValue = document.getElementById("ReplyToValue");
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
msgPaneData.DateBox = document.getElementById("DateBox");
|
|
|
|
msgPaneData.DateValue = document.getElementById("DateValue");
|
|
|
|
|
|
|
|
// Attachment related elements
|
|
|
|
msgPaneData.AttachmentPopup = document.getElementById("attachmentPopup");
|
|
|
|
msgPaneData.AttachmentButton = document.getElementById("attachmentButton");
|
|
|
|
|
|
|
|
// Second toolbar
|
|
|
|
msgPaneData.ToBox = document.getElementById("ToBox");
|
2000-01-06 00:36:35 +00:00
|
|
|
|
|
|
|
// ToValueShort is the div which shows a shortened number of addresses
|
|
|
|
// on the to line...ToValueLong is a div which shows all of the
|
|
|
|
// addresses on the to line. The same rule applies for ccValueShort/Long
|
|
|
|
msgPaneData.ToValueShort = document.getElementById("ToValueShort");
|
|
|
|
msgPaneData.ToValueLong = document.getElementById("ToValueLong");
|
|
|
|
msgPaneData.ToValueToggleIcon = document.getElementById("ToValueToggleIcon");
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
msgPaneData.CcBox = document.getElementById("CcBox");
|
2000-01-06 00:36:35 +00:00
|
|
|
msgPaneData.CcValueShort = document.getElementById("CcValueShort");
|
|
|
|
msgPaneData.CcValueLong = document.getElementById("CcValueLong");
|
|
|
|
msgPaneData.CcValueToggleIcon = document.getElementById("CcValueToggleIcon");
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
msgPaneData.NewsgroupBox = document.getElementById("NewsgroupBox");
|
|
|
|
msgPaneData.NewsgroupValue = document.getElementById("NewsgroupValue");
|
2000-08-24 00:18:15 +00:00
|
|
|
msgPaneData.FollowupToBox = document.getElementById("FollowupToBox");
|
|
|
|
msgPaneData.FollowupToValue = document.getElementById("FollowupToValue");
|
2000-04-01 00:40:53 +00:00
|
|
|
|
2000-05-12 06:36:36 +00:00
|
|
|
msgPaneData.UserAgentBox = document.getElementById("UserAgentBox");
|
2000-08-14 21:29:41 +00:00
|
|
|
msgPaneData.UserAgentToolbar = document.getElementById("headerPart3");
|
2000-04-01 00:40:53 +00:00
|
|
|
msgPaneData.UserAgentValue = document.getElementById("UserAgentValue");
|
|
|
|
|
2000-05-17 06:30:20 +00:00
|
|
|
msgPaneData.ViewAllHeadersToolbar = document.getElementById("viewAllHeadersToolbar");
|
|
|
|
msgPaneData.ViewAllHeadersBox = document.getElementById("viewAllHeadersBox");
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
2000-01-06 00:36:35 +00:00
|
|
|
|
|
|
|
// load any preferences that at are global with regards to
|
|
|
|
// displaying a message...
|
|
|
|
gNumAddressesToShow = pref.GetIntPref("mailnews.max_header_display_length");
|
2000-04-01 00:40:53 +00:00
|
|
|
gShowUserAgent = pref.GetBoolPref("mailnews.headers.showUserAgent");
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The messageHeaderSink is the class that gets notified of a message's headers as we display the message
|
|
|
|
// through our mime converter.
|
|
|
|
|
|
|
|
var messageHeaderSink = {
|
|
|
|
onStartHeaders: function()
|
|
|
|
{
|
2000-05-17 06:30:20 +00:00
|
|
|
// every time we start to redisplay a message, check the view all headers pref....
|
|
|
|
var showAllHeadersPref = pref.GetIntPref("mail.show_headers");
|
|
|
|
if (showAllHeadersPref == 2)
|
|
|
|
gViewAllHeaders = true;
|
|
|
|
else
|
|
|
|
gViewAllHeaders = false;
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
ClearCurrentHeaders();
|
2000-05-17 04:21:40 +00:00
|
|
|
gGeneratedViewAllHeaderInfo = false;
|
2000-01-03 23:06:39 +00:00
|
|
|
ClearAttachmentMenu();
|
|
|
|
},
|
|
|
|
|
|
|
|
onEndHeaders: function()
|
|
|
|
{
|
|
|
|
// WARNING: This is the ONLY routine inside of the message Header Sink that should
|
|
|
|
// trigger a reflow!
|
2000-01-24 02:00:14 +00:00
|
|
|
|
2000-05-26 01:09:12 +00:00
|
|
|
if (this.NotifyClearAddresses != undefined)
|
|
|
|
NotifyClearAddresses();
|
2000-01-06 00:36:35 +00:00
|
|
|
|
|
|
|
// (1) clear out the email fields for to, from, cc....
|
|
|
|
ClearEmailField(msgPaneData.FromValue);
|
2000-08-24 00:18:15 +00:00
|
|
|
ClearEmailField(msgPaneData.ReplyToValue);
|
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
ClearEmailFieldWithButton(msgPaneData.ToValueShort);
|
|
|
|
ClearEmailFieldWithButton(msgPaneData.CcValueShort);
|
|
|
|
ClearEmailFieldWithButton(msgPaneData.ToValueLong);
|
|
|
|
ClearEmailFieldWithButton(msgPaneData.CcValueLong);
|
|
|
|
|
|
|
|
// be sure to re-hide the toggle button, we'll re-enable it later if we need it...
|
2000-05-12 06:11:35 +00:00
|
|
|
msgPaneData.ToValueToggleIcon.setAttribute('collapsed', 'true');
|
|
|
|
msgPaneData.CcValueToggleIcon.setAttribute('collapsed', 'true');
|
2000-01-06 00:36:35 +00:00
|
|
|
//hdrViewSetVisible(msgPaneData.ToValueToggleIcon, false);
|
|
|
|
//hdrViewSetVisible(msgPaneData.CcValueToggleIcon, false);
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
ShowMessageHeaderPane();
|
|
|
|
UpdateMessageHeaders();
|
|
|
|
},
|
|
|
|
|
|
|
|
handleHeader: function(headerName, headerValue)
|
|
|
|
{
|
|
|
|
// WARNING: if you are modifying this function, make sure you do not do *ANY*
|
|
|
|
// dom manipulations which would trigger a reflow. This method gets called
|
|
|
|
// for every rfc822 header in the message being displayed. If you introduce a reflow
|
|
|
|
// you'll be introducing a reflow for every time we are told about a header. And msgs have
|
|
|
|
// a lot of headers. Don't do it =)....Move your code into OnEndHeaders which is only called
|
|
|
|
// once per message view.
|
|
|
|
|
|
|
|
// for consistancy sake, let's force all header names to be lower case so
|
|
|
|
// we don't have to worry about looking for: Cc and CC, etc.
|
2000-05-17 04:21:40 +00:00
|
|
|
lowerCaseHeaderName = headerName.toLowerCase();
|
|
|
|
var foo = new Object;
|
|
|
|
foo.headerValue = headerValue;
|
|
|
|
foo.headerName = headerName;
|
|
|
|
currentHeaderData[lowerCaseHeaderName] = foo;
|
|
|
|
if (lowerCaseHeaderName == "from")
|
2000-01-03 23:06:39 +00:00
|
|
|
{
|
2000-08-14 21:29:41 +00:00
|
|
|
var collectIncoming = pref.GetBoolPref("mail.collect_email_address_incoming");
|
|
|
|
if (collectIncoming && headerValue && abAddressCollector)
|
2000-02-15 06:50:53 +00:00
|
|
|
abAddressCollector.collectUnicodeAddress(headerValue);
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
2000-04-14 02:54:09 +00:00
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
},
|
|
|
|
|
2000-05-02 22:45:44 +00:00
|
|
|
handleAttachment: function(contentType, url, displayName, uri, notDownloaded)
|
2000-01-03 23:06:39 +00:00
|
|
|
{
|
2000-01-15 01:45:12 +00:00
|
|
|
// be sure to escape the display name before we insert it into the
|
|
|
|
// method
|
2000-05-02 22:45:44 +00:00
|
|
|
var commandString = "OpenAttachURL('" + contentType + "', '" + url + "', '" + escape(displayName) + "', '" + uri + "')";
|
2000-03-24 21:22:53 +00:00
|
|
|
if (notDownloaded)
|
|
|
|
{
|
|
|
|
displayName += " " + Bundle.GetStringFromName("notDownloaded");
|
|
|
|
}
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
AddAttachmentToMenu(displayName, commandString);
|
2000-04-13 22:19:48 +00:00
|
|
|
|
|
|
|
var count = attachmentUrlArray.length;
|
|
|
|
// dump ("** attachment count**" + count + "\n");
|
|
|
|
if (count < 0) count = 0;
|
|
|
|
attachmentUrlArray[count] = url;
|
|
|
|
attachmentDisplayNameArray[count] = escape(displayName);
|
|
|
|
attachmentMessageUriArray[count] = uri;
|
|
|
|
},
|
|
|
|
|
|
|
|
onEndAllAttachments: function()
|
|
|
|
{
|
|
|
|
AddSaveAllAttachmentsMenu();
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2000-01-24 02:00:14 +00:00
|
|
|
function AddNodeToAddressBook (emailAddressNode)
|
|
|
|
{
|
2000-05-16 05:21:38 +00:00
|
|
|
if (emailAddressNode)
|
|
|
|
{
|
|
|
|
var primaryEmail = emailAddressNode.getAttribute("emailAddress");
|
|
|
|
var displayName = emailAddressNode.getAttribute("displayName");
|
|
|
|
window.openDialog("chrome://messenger/content/addressbook/abNewCardDialog.xul",
|
|
|
|
"",
|
2000-09-01 00:48:04 +00:00
|
|
|
"chrome,titlebar,resizeable=no",
|
2000-05-16 05:21:38 +00:00
|
|
|
{primaryEmail:primaryEmail, displayName:displayName });
|
|
|
|
}
|
2000-01-24 02:00:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SendMailToNode takes the email address title button, extracts
|
|
|
|
// the email address we stored in there and opens a compose window
|
|
|
|
// with that address
|
|
|
|
function SendMailToNode(emailAddressNode)
|
|
|
|
{
|
|
|
|
if (emailAddressNode)
|
|
|
|
{
|
2000-02-10 04:22:46 +00:00
|
|
|
var emailAddress = emailAddressNode.getAttribute("emailAddress");
|
|
|
|
if (emailAddress)
|
|
|
|
messenger.OpenURL("mailto:" + emailAddress );
|
2000-01-24 02:00:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-02 22:45:44 +00:00
|
|
|
function OpenAttachURL(contentType, url, displayName, messageUri)
|
2000-01-03 23:06:39 +00:00
|
|
|
{
|
2000-04-29 00:26:07 +00:00
|
|
|
var args = {dspname: displayName, opval: 0};
|
|
|
|
|
|
|
|
window.openDialog("chrome://messenger/content/openSaveAttachment.xul",
|
|
|
|
"openSaveAttachment", "chrome,modal", args);
|
|
|
|
if (args.opval == 1)
|
2000-05-02 22:45:44 +00:00
|
|
|
messenger.openAttachment(contentType, url, displayName, messageUri);
|
2000-04-29 00:26:07 +00:00
|
|
|
else if (args.opval == 2)
|
|
|
|
messenger.saveAttachment(url, displayName, messageUri);
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function AddAttachmentToMenu(name, oncommand)
|
|
|
|
{
|
|
|
|
var popup = document.getElementById("attachmentPopup");
|
2000-04-13 22:19:48 +00:00
|
|
|
if (popup)
|
2000-01-03 23:06:39 +00:00
|
|
|
{
|
|
|
|
var item = document.createElement('menuitem');
|
|
|
|
if ( item )
|
|
|
|
{
|
2000-04-13 22:19:48 +00:00
|
|
|
popup.appendChild(item);
|
2000-02-09 03:07:59 +00:00
|
|
|
item.setAttribute('value', name);
|
|
|
|
item.setAttribute('oncommand', oncommand);
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var button = document.getElementById("attachmentButton");
|
|
|
|
if (button)
|
2000-04-13 22:19:48 +00:00
|
|
|
button.setAttribute("value", popup.childNodes.length);
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var attachBox = document.getElementById("attachmentBox");
|
|
|
|
if (attachBox)
|
2000-05-12 06:11:35 +00:00
|
|
|
attachBox.removeAttribute("collapsed");
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
2000-04-13 22:19:48 +00:00
|
|
|
function SaveAllAttachments()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
messenger.saveAllAttachments(attachmentUrlArray.length,
|
|
|
|
attachmentUrlArray,
|
|
|
|
attachmentDisplayNameArray,
|
|
|
|
attachmentMessageUriArray);
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
|
|
|
dump ("** failed to save all attachments ** \n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function AddSaveAllAttachmentsMenu()
|
|
|
|
{
|
|
|
|
var popup = document.getElementById("attachmentPopup");
|
|
|
|
if (popup && popup.childNodes.length > 1)
|
|
|
|
{
|
|
|
|
var separator = document.createElement('menuseparator');
|
|
|
|
var item = document.createElement('menuitem');
|
|
|
|
if (separator && item)
|
|
|
|
{
|
|
|
|
popup.appendChild(separator);
|
|
|
|
popup.appendChild(item);
|
|
|
|
item.setAttribute('value', "Save All...");
|
|
|
|
item.setAttribute('oncommand', "SaveAllAttachments()");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
function ClearAttachmentMenu()
|
|
|
|
{
|
|
|
|
var popup = document.getElementById("attachmentPopup");
|
|
|
|
if ( popup )
|
|
|
|
{
|
2000-04-13 22:19:48 +00:00
|
|
|
while ( popup.childNodes.length )
|
2000-01-03 23:06:39 +00:00
|
|
|
popup.removeChild(popup.childNodes[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
var attachBox = document.getElementById("attachmentBox");
|
|
|
|
if (attachBox)
|
2000-05-12 06:11:35 +00:00
|
|
|
attachBox.setAttribute("collapsed", "true");
|
2000-04-13 22:19:48 +00:00
|
|
|
|
|
|
|
// reset attachments name array
|
|
|
|
attachmentUrlArray.length = 0;
|
|
|
|
attachmentDisplayNameArray.length = 0;
|
|
|
|
attachmentMessageUriArray.length = 0;
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
// Assumes that all the child nodes of the parent div need removed..leaving
|
|
|
|
// an empty parent div...This is used to clear the To/From/cc lines where
|
|
|
|
// we had to insert email addresses one at a time into their parent divs...
|
|
|
|
function ClearEmailFieldWithButton(parentDiv)
|
|
|
|
{
|
|
|
|
if (parentDiv)
|
|
|
|
{
|
|
|
|
// the toggle button is the last child in the child nodes..
|
|
|
|
// we should never remove it...
|
|
|
|
while (parentDiv.childNodes.length > 1)
|
|
|
|
parentDiv.removeChild(parentDiv.childNodes[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clear Email Field takes the passed in div and removes all the child nodes!
|
|
|
|
// if your div has a button in it (like To/cc use ClearEmailfieldWithButton
|
|
|
|
function ClearEmailField(parentDiv)
|
|
|
|
{
|
|
|
|
if (parentDiv)
|
|
|
|
{
|
|
|
|
while (parentDiv.childNodes.length > 0)
|
|
|
|
parentDiv.removeChild(parentDiv.childNodes[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-24 00:18:15 +00:00
|
|
|
function OutputNewsgroups(boxNode, textNode, currentHeaderData, headerName)
|
|
|
|
{
|
|
|
|
if (currentHeaderData[headerName])
|
|
|
|
{
|
|
|
|
var headerValue = currentHeaderData[headerName].headerValue;
|
|
|
|
headerValue = headerValue.replace(/,/g,", ");
|
|
|
|
|
|
|
|
hdrViewSetNodeWithBox(boxNode, textNode, headerValue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hdrViewSetNodeWithBox(boxNode, textNode, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
// OutputEmailAddresses --> knows how to take a comma separated list of email addresses,
|
|
|
|
// extracts them one by one, linkifying each email address into a mailto url.
|
|
|
|
// Then we add the link'ified email address to the parentDiv passed in.
|
|
|
|
//
|
|
|
|
// defaultParentDiv --> the div to add the link-ified email addresses into.
|
|
|
|
// emailAddresses --> comma separated list of the addresses for this header field
|
|
|
|
// includeShortLongToggle --> true if you want to include the ability to toggle between short/long
|
|
|
|
// address views for this header field. If true, then pass in a another div which is the div the long
|
|
|
|
// view will be added too...
|
|
|
|
|
|
|
|
function OutputEmailAddresses(parentBox, defaultParentDiv, emailAddresses, includeShortLongToggle, optionalLongDiv, optionalToggleButton)
|
|
|
|
{
|
|
|
|
// if we don't have any addresses for this field, hide the parent box!
|
|
|
|
if ( !emailAddresses )
|
|
|
|
{
|
|
|
|
hdrViewSetVisible(parentBox, false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (msgHeaderParser)
|
|
|
|
{
|
2000-01-24 02:00:14 +00:00
|
|
|
var enumerator = msgHeaderParser.ParseHeadersWithEnumerator(emailAddresses);
|
2000-01-06 00:36:35 +00:00
|
|
|
enumerator = enumerator.QueryInterface(Components.interfaces.nsISimpleEnumerator);
|
|
|
|
var numAddressesParsed = 0;
|
|
|
|
if (enumerator)
|
|
|
|
{
|
|
|
|
var emailAddress = {};
|
|
|
|
var name = {};
|
|
|
|
|
2000-05-15 07:03:46 +00:00
|
|
|
while (enumerator.hasMoreElements())
|
2000-01-06 00:36:35 +00:00
|
|
|
{
|
2000-05-15 07:03:46 +00:00
|
|
|
var headerResult = enumerator.getNext();
|
2000-01-06 00:36:35 +00:00
|
|
|
headerResult = enumerator.QueryInterface(Components.interfaces.nsIMsgHeaderParserResult);
|
|
|
|
|
|
|
|
// get the email and name fields
|
2000-01-24 02:00:14 +00:00
|
|
|
var addrValue = {};
|
|
|
|
var nameValue = {};
|
|
|
|
fullAddress = headerResult.getAddressAndName(addrValue, nameValue);
|
|
|
|
emailAddress = addrValue.value;
|
|
|
|
name = nameValue.value;
|
2000-01-06 00:36:35 +00:00
|
|
|
|
|
|
|
// if we want to include short/long toggle views and we have a long view, always add it.
|
|
|
|
// if we aren't including a short/long view OR if we are and we haven't parsed enough
|
|
|
|
// addresses to reach the cutoff valve yet then add it to the default (short) div.
|
|
|
|
if (includeShortLongToggle && optionalLongDiv)
|
|
|
|
{
|
2000-08-26 02:50:40 +00:00
|
|
|
InsertEmailAddressUnderEnclosingBox(parentBox, optionalLongDiv, true, emailAddress, fullAddress, name);
|
2000-01-06 00:36:35 +00:00
|
|
|
}
|
|
|
|
if (!includeShortLongToggle || (numAddressesParsed < gNumAddressesToShow))
|
|
|
|
{
|
2000-08-26 02:50:40 +00:00
|
|
|
InsertEmailAddressUnderEnclosingBox(parentBox, defaultParentDiv, includeShortLongToggle, emailAddress, fullAddress, name);
|
2000-01-06 00:36:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
numAddressesParsed++;
|
|
|
|
}
|
|
|
|
} // if enumerator
|
|
|
|
|
|
|
|
if (includeShortLongToggle && (numAddressesParsed > gNumAddressesToShow) && optionalToggleButton)
|
|
|
|
{
|
2000-05-12 06:11:35 +00:00
|
|
|
optionalToggleButton.removeAttribute('collapsed');
|
2000-01-06 00:36:35 +00:00
|
|
|
}
|
|
|
|
} // if msgheader parser
|
|
|
|
}
|
|
|
|
|
2000-01-24 02:00:14 +00:00
|
|
|
/* InsertEmailAddressUnderEnclosingBox --> right now all email addresses are borderless titled buttons
|
|
|
|
with formatting to make them look like html anchors. When you click on the button,
|
|
|
|
you are prompted with a popup asking you what you want to do with the email address
|
|
|
|
|
|
|
|
parentBox --> the enclosing box for all the email addresses for this header. This is needed
|
|
|
|
to control visibility of the header.
|
|
|
|
parentDiv --> the DIV the email addresses need to be inserted into.
|
2000-08-26 02:50:40 +00:00
|
|
|
includesToggleButton --> true if the parentDiv includes a toggle button we want contnet inserted BEFORE
|
|
|
|
false if the parentDiv does not contain a toggle button. This is required in order
|
|
|
|
to properly detect if we should be inserting addresses before this node....
|
2000-01-24 02:00:14 +00:00
|
|
|
*/
|
|
|
|
|
2000-08-26 02:50:40 +00:00
|
|
|
function InsertEmailAddressUnderEnclosingBox(parentBox, parentDiv, includesToggleButton, emailAddress, fullAddress, displayName)
|
2000-01-06 00:36:35 +00:00
|
|
|
{
|
|
|
|
if ( parentBox )
|
|
|
|
{
|
2000-05-12 06:11:35 +00:00
|
|
|
var item = document.createElement("mail-emailaddress");
|
|
|
|
var itemInDocument;
|
2000-01-06 00:36:35 +00:00
|
|
|
if ( item && parentDiv)
|
|
|
|
{
|
|
|
|
if (parentDiv.childNodes.length)
|
|
|
|
{
|
|
|
|
var child = parentDiv.childNodes[parentDiv.childNodes.length - 1];
|
2000-08-26 02:50:40 +00:00
|
|
|
if (parentDiv.childNodes.length > 1 || (!includesToggleButton && parentDiv.childNodes.length >= 1) )
|
2000-04-10 00:32:25 +00:00
|
|
|
{
|
|
|
|
var textNode = document.createElement("text");
|
|
|
|
textNode.setAttribute("value", ", ");
|
2000-05-12 06:34:48 +00:00
|
|
|
textNode.setAttribute("class", "emailSeparator");
|
2000-08-26 02:50:40 +00:00
|
|
|
if (includesToggleButton)
|
|
|
|
parentDiv.insertBefore(textNode, child);
|
|
|
|
else
|
|
|
|
parentDiv.appendChild(textNode);
|
2000-04-10 00:32:25 +00:00
|
|
|
}
|
2000-08-26 02:50:40 +00:00
|
|
|
if (includesToggleButton)
|
|
|
|
itemInDocument = parentDiv.insertBefore(item, child);
|
|
|
|
else
|
|
|
|
itemInDocument = parentDiv.appendChild(item);
|
2000-01-06 00:36:35 +00:00
|
|
|
}
|
|
|
|
else
|
2000-05-12 06:11:35 +00:00
|
|
|
{
|
2000-05-17 06:30:20 +00:00
|
|
|
itemInDocument = parentDiv.appendChild(item);
|
2000-05-12 06:11:35 +00:00
|
|
|
}
|
2000-08-14 21:29:41 +00:00
|
|
|
|
2000-05-17 06:30:20 +00:00
|
|
|
itemInDocument.setAttribute("value", fullAddress);
|
2000-05-12 06:11:35 +00:00
|
|
|
itemInDocument.setTextAttribute("emailAddress", emailAddress);
|
|
|
|
itemInDocument.setTextAttribute("fullAddress", fullAddress);
|
2000-05-16 05:21:38 +00:00
|
|
|
itemInDocument.setTextAttribute("displayName", displayName);
|
2000-05-26 01:09:12 +00:00
|
|
|
|
|
|
|
if (this.AddExtraAddressProcessing != undefined)
|
|
|
|
AddExtraAddressProcessing(emailAddress, itemInDocument);
|
2000-02-02 03:14:29 +00:00
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
hdrViewSetVisible(parentBox, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
function UpdateMessageHeaders()
|
|
|
|
{
|
2000-05-17 06:30:20 +00:00
|
|
|
if (gViewAllHeaders)
|
|
|
|
{
|
|
|
|
fillBoxWithAllHeaders(msgPaneData.ViewAllHeadersBox, false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-05-17 04:21:40 +00:00
|
|
|
if (currentHeaderData["subject"])
|
|
|
|
hdrViewSetNodeWithBox(msgPaneData.SubjectBox, msgPaneData.SubjectValue, currentHeaderData["subject"].headerValue);
|
|
|
|
else
|
|
|
|
hdrViewSetNodeWithBox(msgPaneData.SubjectBox, msgPaneData.SubjectValue, "");
|
|
|
|
|
|
|
|
if (currentHeaderData["from"])
|
|
|
|
OutputEmailAddresses(msgPaneData.FromBox, msgPaneData.FromValue, currentHeaderData["from"].headerValue, false, "", "");
|
|
|
|
else
|
|
|
|
OutputEmailAddresses(msgPaneData.FromBox, msgPaneData.FromValue, "", false, "", "");
|
|
|
|
|
|
|
|
if (currentHeaderData["date"])
|
|
|
|
hdrViewSetNodeWithBox(msgPaneData.DateBox, msgPaneData.DateValue, currentHeaderData["date"].headerValue);
|
|
|
|
else
|
|
|
|
hdrViewSetNodeWithBox(msgPaneData.DateBox, msgPaneData.DateValue, "");
|
|
|
|
|
|
|
|
if (currentHeaderData["to"])
|
|
|
|
OutputEmailAddresses(msgPaneData.ToBox, msgPaneData.ToValueShort, currentHeaderData["to"].headerValue, true, msgPaneData.ToValueLong, msgPaneData.ToValueToggleIcon );
|
|
|
|
else
|
|
|
|
OutputEmailAddresses(msgPaneData.ToBox, msgPaneData.ToValueShort, "", true, msgPaneData.ToValueLong, msgPaneData.ToValueToggleIcon );
|
|
|
|
|
|
|
|
if (currentHeaderData["cc"])
|
|
|
|
OutputEmailAddresses(msgPaneData.CcBox, msgPaneData.CcValueShort, currentHeaderData["cc"].headerValue, true, msgPaneData.CcValueLong, msgPaneData.CcValueToggleIcon );
|
|
|
|
else
|
|
|
|
OutputEmailAddresses(msgPaneData.CcBox, msgPaneData.CcValueShort, "", true, msgPaneData.CcValueLong, msgPaneData.CcValueToggleIcon );
|
|
|
|
|
|
|
|
if (currentHeaderData["newsgroups"])
|
2000-08-24 00:18:15 +00:00
|
|
|
OutputNewsgroups(msgPaneData.NewsgroupBox, msgPaneData.NewsgroupValue, currentHeaderData, "newsgroups");
|
2000-05-17 04:21:40 +00:00
|
|
|
else
|
|
|
|
hdrViewSetNodeWithBox(msgPaneData.NewsgroupBox, msgPaneData.NewsgroupValue, "");
|
|
|
|
|
2000-08-24 00:18:15 +00:00
|
|
|
if (currentHeaderData["followup-to"])
|
|
|
|
OutputNewsgroups(msgPaneData.FollowupToBox, msgPaneData.FollowupToValue, currentHeaderData, "followup-to");
|
|
|
|
else
|
|
|
|
hdrViewSetNodeWithBox(msgPaneData.FollowupToBox, msgPaneData.NewsgroupValue, "");
|
|
|
|
|
2000-04-01 00:40:53 +00:00
|
|
|
if (gShowUserAgent)
|
2000-05-17 04:21:40 +00:00
|
|
|
{
|
|
|
|
if (currentHeaderData["user-agent"])
|
2000-08-14 21:29:41 +00:00
|
|
|
{
|
2000-05-17 04:21:40 +00:00
|
|
|
hdrViewSetNodeWithBox(msgPaneData.UserAgentBox, msgPaneData.UserAgentValue, currentHeaderData["user-agent"].headerValue);
|
2000-08-14 21:29:41 +00:00
|
|
|
if (msgPaneData.UserAgentToolbar)
|
|
|
|
msgPaneData.UserAgentToolbar.removeAttribute("hidden");
|
|
|
|
}
|
2000-05-17 04:21:40 +00:00
|
|
|
else
|
2000-08-14 21:29:41 +00:00
|
|
|
{
|
2000-05-17 04:21:40 +00:00
|
|
|
hdrViewSetNodeWithBox(msgPaneData.UserAgentBox, msgPaneData.UserAgentValue, "");
|
2000-08-14 21:29:41 +00:00
|
|
|
if (msgPaneData.UserAgentToolbar)
|
|
|
|
msgPaneData.UserAgentToolbar.setAttribute("hidden", "true");
|
|
|
|
}
|
2000-05-17 04:21:40 +00:00
|
|
|
|
|
|
|
}
|
2000-08-14 21:29:41 +00:00
|
|
|
|
2000-05-26 01:09:12 +00:00
|
|
|
if (this.FinishEmailProcessing != undefined)
|
|
|
|
FinishEmailProcessing();
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function ClearCurrentHeaders()
|
|
|
|
{
|
2000-04-14 02:54:09 +00:00
|
|
|
currentHeaderData = {};
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function ShowMessageHeaderPane()
|
|
|
|
{
|
2000-05-17 06:30:20 +00:00
|
|
|
if (gViewAllHeaders)
|
|
|
|
{
|
|
|
|
HideMessageHeaderPane();
|
2000-07-27 07:11:14 +00:00
|
|
|
msgPaneData.ViewAllHeadersToolbar.removeAttribute("hidden");
|
2000-05-17 06:30:20 +00:00
|
|
|
msgPaneData.ViewAllHeadersBox.removeAttribute("collapsed");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-27 07:11:14 +00:00
|
|
|
msgPaneData.ViewAllHeadersToolbar.setAttribute("hidden", "true");
|
2000-05-17 06:30:20 +00:00
|
|
|
msgPaneData.ViewAllHeadersBox.setAttribute("collapsed", "true");
|
|
|
|
|
|
|
|
var node = document.getElementById("headerPart1");
|
|
|
|
if (node)
|
2000-07-27 07:11:14 +00:00
|
|
|
node.removeAttribute("hidden");
|
2000-05-17 06:30:20 +00:00
|
|
|
node = document.getElementById("headerPart2");
|
|
|
|
if (node)
|
2000-07-27 07:11:14 +00:00
|
|
|
node.removeAttribute("hidden");
|
|
|
|
|
|
|
|
/*
|
2000-05-17 06:30:20 +00:00
|
|
|
node = document.getElementById("headerPart3");
|
|
|
|
if (node)
|
2000-07-27 07:11:14 +00:00
|
|
|
node.removeAttribute("hidden");
|
|
|
|
*/
|
2000-05-17 06:30:20 +00:00
|
|
|
}
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function HideMessageHeaderPane()
|
|
|
|
{
|
2000-07-27 07:11:14 +00:00
|
|
|
msgPaneData.ViewAllHeadersToolbar.setAttribute("hidden", "true");
|
2000-05-17 06:30:20 +00:00
|
|
|
msgPaneData.ViewAllHeadersBox.setAttribute("collapsed", "true");
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
var node = document.getElementById("headerPart1");
|
|
|
|
if (node)
|
2000-07-27 07:11:14 +00:00
|
|
|
node.setAttribute("hidden", "true");
|
2000-01-03 23:06:39 +00:00
|
|
|
node = document.getElementById("headerPart2");
|
|
|
|
if (node)
|
2000-07-27 07:11:14 +00:00
|
|
|
node.setAttribute("hidden", "true");
|
2000-04-01 00:40:53 +00:00
|
|
|
node = document.getElementById("headerPart3");
|
2000-08-14 21:29:41 +00:00
|
|
|
if (msgPaneData.UserAgentToolbar)
|
|
|
|
msgPaneData.UserAgentToolbar.setAttribute("hidden", "true");
|
2000-05-17 06:30:20 +00:00
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
// ToggleLongShortAddresses is used to toggle between showing
|
|
|
|
// all of the addresses on a given header line vs. only the first 'n'
|
|
|
|
// where 'n' is a user controlled preference. By toggling on the more/less
|
|
|
|
// images in the header window, we'll hide / show the appropriate div for that header.
|
|
|
|
|
|
|
|
function ToggleLongShortAddresses(shortDivID, longDivID)
|
|
|
|
{
|
|
|
|
var shortNode = document.getElementById(shortDivID);
|
|
|
|
var longNode = document.getElementById(longDivID);
|
2000-05-12 06:11:35 +00:00
|
|
|
var nodeToReset;
|
2000-01-06 00:36:35 +00:00
|
|
|
|
|
|
|
// test to see which if short is already hidden...
|
2000-05-12 06:11:35 +00:00
|
|
|
if (shortNode.getAttribute("collapsed") == "true")
|
2000-01-06 00:36:35 +00:00
|
|
|
{
|
2000-05-12 06:11:35 +00:00
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
hdrViewSetVisible(longNode, false);
|
|
|
|
hdrViewSetVisible(shortNode, true);
|
2000-05-12 06:11:35 +00:00
|
|
|
nodeToReset = shortNode;
|
2000-01-06 00:36:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hdrViewSetVisible(shortNode, false);
|
|
|
|
hdrViewSetVisible(longNode, true);
|
2000-05-12 06:11:35 +00:00
|
|
|
nodeToReset = longNode;
|
2000-01-06 00:36:35 +00:00
|
|
|
}
|
2000-05-12 06:11:35 +00:00
|
|
|
|
|
|
|
// HACK ALERT: this is required because of a bug in boxes when you add content
|
|
|
|
// to a box which is collapsed, when you then uncollapse that box, the content isn't
|
|
|
|
// displayed. So I'm forcing us to reset the value for each node...
|
|
|
|
var endPos = nodeToReset.childNodes.length;
|
|
|
|
var index = 0;
|
|
|
|
var tempValue;
|
|
|
|
while (index < endPos - 1)
|
|
|
|
{
|
|
|
|
tempValue = nodeToReset.childNodes[index].getAttribute("value");
|
|
|
|
nodeToReset.childNodes[index].setAttribute("value", "");
|
|
|
|
nodeToReset.childNodes[index].setAttribute("value", tempValue);
|
|
|
|
index++;
|
|
|
|
}
|
2000-01-06 00:36:35 +00:00
|
|
|
}
|
|
|
|
|
2000-05-17 06:30:20 +00:00
|
|
|
// given a box, iterate through all of the headers and add them to
|
|
|
|
// the enclosing box.
|
|
|
|
function fillBoxWithAllHeaders(containerBox, boxPartOfPopup)
|
2000-05-17 04:21:40 +00:00
|
|
|
{
|
|
|
|
// clear out the old popup date if there is any...
|
2000-05-17 06:30:20 +00:00
|
|
|
while ( containerBox.childNodes.length )
|
|
|
|
containerBox.removeChild(containerBox.childNodes[0]);
|
2000-05-17 04:21:40 +00:00
|
|
|
|
|
|
|
for (header in currentHeaderData)
|
|
|
|
{
|
|
|
|
var innerBox = document.createElement('box');
|
|
|
|
innerBox.setAttribute("class", "headerBox");
|
2000-08-26 02:50:40 +00:00
|
|
|
innerBox.setAttribute("orient", "horizontal");
|
2000-05-17 06:30:20 +00:00
|
|
|
if (boxPartOfPopup)
|
|
|
|
innerBox.setAttribute("autostretch", "never");
|
2000-05-17 04:21:40 +00:00
|
|
|
|
|
|
|
// for each header, create a header value and header name then assign those values...
|
2000-08-26 02:50:40 +00:00
|
|
|
var headerValueBox = document.createElement('hbox');
|
|
|
|
headerValueBox.setAttribute("class", "headerValueBox");
|
|
|
|
|
2000-08-24 00:18:15 +00:00
|
|
|
var newHeaderTitle = document.createElement('text');
|
2000-05-17 04:21:40 +00:00
|
|
|
newHeaderTitle.setAttribute("class", "headerdisplayname");
|
2000-08-24 00:18:15 +00:00
|
|
|
newHeaderTitle.setAttribute("value", currentHeaderData[header].headerName + ':');
|
2000-08-26 02:50:40 +00:00
|
|
|
headerValueBox.appendChild(newHeaderTitle);
|
|
|
|
|
|
|
|
innerBox.appendChild(headerValueBox);
|
2000-05-17 04:21:40 +00:00
|
|
|
|
|
|
|
var newHeaderValue = document.createElement('html');
|
|
|
|
// make sure we are properly resized...
|
2000-08-24 00:18:15 +00:00
|
|
|
// if (boxPartOfPopup)
|
|
|
|
// newHeaderValue.setAttribute("width", window.innerWidth*.65);
|
2000-05-17 04:21:40 +00:00
|
|
|
newHeaderValue.setAttribute("class", "headerValue");
|
2000-08-26 02:50:40 +00:00
|
|
|
if (!boxPartOfPopup)
|
|
|
|
newHeaderValue.setAttribute("flex", "1");
|
2000-05-17 04:21:40 +00:00
|
|
|
innerBox.appendChild(newHeaderValue);
|
|
|
|
containerBox.appendChild(innerBox);
|
2000-05-17 06:30:20 +00:00
|
|
|
ProcessHeaderValue(innerBox, newHeaderValue, currentHeaderData[header], boxPartOfPopup);
|
2000-05-17 04:21:40 +00:00
|
|
|
}
|
2000-05-17 06:30:20 +00:00
|
|
|
}
|
2000-05-17 04:21:40 +00:00
|
|
|
|
2000-05-17 06:30:20 +00:00
|
|
|
// the on create handler for the view all headers popup...
|
|
|
|
function fillAllHeadersPopup(node)
|
|
|
|
{
|
|
|
|
// don't bother re-filling the popup if we've already done it for the
|
|
|
|
// currently displayed message....
|
|
|
|
if (gGeneratedViewAllHeaderInfo == true)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
var containerBox = document.getElementById('allHeadersPopupContainer');
|
|
|
|
|
|
|
|
containerBox.setAttribute("class", "header-part1");
|
|
|
|
containerBox.setAttribute("align", "vertical");
|
|
|
|
containerBox.setAttribute("flex", "1");
|
2000-05-17 04:21:40 +00:00
|
|
|
|
2000-05-17 06:30:20 +00:00
|
|
|
fillBoxWithAllHeaders(containerBox, true);
|
|
|
|
gGeneratedViewAllHeaderInfo = true; // don't try to regenerate this information for the currently displayed message
|
2000-05-17 04:21:40 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-05-17 06:30:20 +00:00
|
|
|
// containingBox --> the box containing the header
|
|
|
|
// containerNode --> the div or box that we want to insert this specific header into
|
|
|
|
// header --> an entry from currentHeaderData contains .headerName and .headerValue
|
|
|
|
// boxPartOfPopup --> true if the box is part of a popup (certain functions are disabled in this scenario)
|
|
|
|
function ProcessHeaderValue(containingBox, containerNode, header, boxPartOfPopup)
|
2000-05-17 04:21:40 +00:00
|
|
|
{
|
|
|
|
// in the simplest case, we'll just create a text node for the header
|
|
|
|
// and append it to the container Node. for certain headers, we might want to do
|
|
|
|
// extra processing....
|
|
|
|
|
|
|
|
var headerName = header.headerName;
|
|
|
|
headerName = headerName.toLowerCase();
|
2000-05-17 06:30:20 +00:00
|
|
|
if (!boxPartOfPopup && (headerName == "cc" || headerName == "from" || headerName == "to"))
|
|
|
|
{
|
2000-08-26 02:50:40 +00:00
|
|
|
OutputEmailAddresses(containingBox, containerNode, header.headerValue, false, "", "")
|
2000-05-17 06:30:20 +00:00
|
|
|
return;
|
|
|
|
}
|
2000-05-17 04:21:40 +00:00
|
|
|
|
2000-08-26 02:50:40 +00:00
|
|
|
var headerValue = header.headerValue;
|
|
|
|
headerValue = headerValue.replace(/\n|\r/g,"");
|
|
|
|
var textNode = document.createTextNode(headerValue);
|
2000-05-17 04:21:40 +00:00
|
|
|
if (headerName == "subject")
|
2000-05-17 06:30:20 +00:00
|
|
|
{
|
2000-05-17 04:21:40 +00:00
|
|
|
containerNode.setAttribute("class", "subjectvalue headerValue");
|
2000-05-17 06:30:20 +00:00
|
|
|
}
|
|
|
|
|
2000-05-17 04:21:40 +00:00
|
|
|
containerNode.appendChild(textNode);
|
|
|
|
}
|
|
|
|
|
2000-01-06 00:36:35 +00:00
|
|
|
///////////////////////////////////////////////////////////////
|
2000-01-03 23:06:39 +00:00
|
|
|
// The following are just small helper functions..
|
2000-01-06 00:36:35 +00:00
|
|
|
///////////////////////////////////////////////////////////////
|
2000-01-24 02:00:14 +00:00
|
|
|
|
|
|
|
function hdrViewSetNodeWithButton(boxNode, buttonNode, text)
|
|
|
|
{
|
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
buttonNode.setAttribute("value", text);
|
|
|
|
hdrViewSetVisible(boxNode, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hdrViewSetVisible(boxNode, false);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-03 23:06:39 +00:00
|
|
|
function hdrViewSetNodeWithBox(boxNode, textNode, text)
|
|
|
|
{
|
|
|
|
if ( text )
|
|
|
|
return hdrViewSetNode(boxNode, textNode, text );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hdrViewSetVisible(boxNode, false);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function hdrViewSetNode(boxNode, textNode, text)
|
|
|
|
{
|
|
|
|
textNode.childNodes[0].nodeValue = text;
|
|
|
|
var visible;
|
|
|
|
|
|
|
|
if ( text )
|
|
|
|
visible = true;
|
|
|
|
else
|
|
|
|
visible = false;
|
|
|
|
|
|
|
|
hdrViewSetVisible(boxNode, visible);
|
|
|
|
return visible;
|
|
|
|
}
|
|
|
|
|
|
|
|
function hdrViewSetVisible(boxNode, visible)
|
|
|
|
{
|
|
|
|
if ( visible )
|
2000-05-12 06:11:35 +00:00
|
|
|
boxNode.removeAttribute("collapsed");
|
2000-01-03 23:06:39 +00:00
|
|
|
else
|
2000-05-12 06:11:35 +00:00
|
|
|
boxNode.setAttribute("collapsed", "true");
|
2000-01-03 23:06:39 +00:00
|
|
|
}
|
2000-01-24 02:00:14 +00:00
|
|
|
|