mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
landing compose attachment ui changes.
This commit is contained in:
parent
6a09fe909e
commit
6e69c915d9
@ -22,3 +22,5 @@ defaultTextBody.html
|
||||
messengercompose.xul
|
||||
composebe_en.properties
|
||||
addressAutoComplete.js
|
||||
MsgAttachPage.js
|
||||
MsgAttachPage.xul
|
||||
|
@ -35,6 +35,8 @@ EXPORT_RESOURCE_SAMPLES = \
|
||||
$(srcdir)/defaultHtmlBody.html \
|
||||
$(srcdir)/addressAutoComplete.js \
|
||||
$(srcdir)/composebe_en.properties \
|
||||
$(srcdir)/MsgAttachPage.xul \
|
||||
$(srcdir)/MsgAttachPage.js \
|
||||
$(NULL)
|
||||
|
||||
EXPORT_RESOURCE_SAMPLES_TO_REMOVE := $(addprefix $(SAMPLES_DIR)/, $(EXPORT_RESOURCE_SAMPLES))
|
||||
|
32
mailnews/compose/resources/content/MsgAttachPage.js
Normal file
32
mailnews/compose/resources/content/MsgAttachPage.js
Normal file
@ -0,0 +1,32 @@
|
||||
var addattachmentfunction = null;
|
||||
|
||||
function Startup()
|
||||
{
|
||||
/* dump("Startup()\n"); */
|
||||
|
||||
if (window.arguments && window.arguments[0] && window.arguments[0].addattachmentfunction)
|
||||
{
|
||||
addattachmentfunction = window.arguments[0].addattachmentfunction;
|
||||
doSetOKCancel(AttachPageOKCallback, AttachPageCancelCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
dump("error, no callback registered for OK\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function AttachPageOKCallback()
|
||||
{
|
||||
/* dump("attach this: " + document.getElementById('attachurl').value + "\n"); */
|
||||
|
||||
if (addattachmentfunction) {
|
||||
addattachmentfunction(document.getElementById('attachurl').value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function AttachPageCancelCallback()
|
||||
{
|
||||
return true;
|
||||
}
|
29
mailnews/compose/resources/content/MsgAttachPage.xul
Normal file
29
mailnews/compose/resources/content/MsgAttachPage.xul
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://editor/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://messengercompose/skin/" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window
|
||||
[
|
||||
|
||||
<!ENTITY windowTitle.label "Please Specify a Location to Attach">
|
||||
|
||||
]>
|
||||
|
||||
<window title="&windowTitle.label;"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup()"
|
||||
align="vertical">
|
||||
|
||||
<html:script language="JavaScript" src="chrome://messengercompose/content/MsgAttachPage.js"/>
|
||||
<box align="horizontal">
|
||||
<html:div>Web Page (URL):</html:div>
|
||||
<html:input type="text" id="attachurl" align="bottom" style="min-width:200px; padding-bottom:0px" />
|
||||
</box>
|
||||
|
||||
<box id="okCancelButtons"/>
|
||||
</window>
|
@ -22,6 +22,8 @@ var msgComposeService = Components.classes["component://netscape/messengercompos
|
||||
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
|
||||
var msgCompose = null;
|
||||
var MAX_RECIPIENTS = 0;
|
||||
var numAttachments = 0;
|
||||
var currentAttachment = null;
|
||||
|
||||
var other_header = "";
|
||||
var update_compose_title_as_you_type = true;
|
||||
@ -237,6 +239,8 @@ function GenericSendMessage( msgType )
|
||||
{
|
||||
Recipients2CompFields(msgCompFields);
|
||||
msgCompFields.SetSubject(document.getElementById("msgSubject").value);
|
||||
dump("attachments = " + GenerateAttachmentsString() + "\n");
|
||||
msgCompFields.SetAttachments(GenerateAttachmentsString());
|
||||
|
||||
msgCompose.SendMsg(msgType, getCurrentIdentity(), null);
|
||||
}
|
||||
@ -599,3 +603,79 @@ function CloseWindow()
|
||||
if (msgCompose)
|
||||
msgCompose.CloseWindow();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function AttachFile()
|
||||
{
|
||||
dump("AttachFile()\n");
|
||||
currentAttachment = "";
|
||||
|
||||
// Get a local file, converted into URL format
|
||||
try {
|
||||
var filePicker = Components.classes["component://netscape/filespecwithui"].createInstance();
|
||||
filePicker = filePicker.QueryInterface(Components.interfaces.nsIFileSpecWithUI);
|
||||
currentAttachment = filePicker.chooseFile("Enter file to attach");
|
||||
}
|
||||
catch (ex) {
|
||||
dump("failed to get the local file to attach\n");
|
||||
}
|
||||
|
||||
AddAttachment(currentAttachment);
|
||||
}
|
||||
|
||||
function AddAttachment(attachment)
|
||||
{
|
||||
if (attachment && (attachment != "")) {
|
||||
/* dump("attachment = " + attachment + "\n"); */
|
||||
selectNode = document.getElementById('attachments');
|
||||
numAttachments = numAttachments + 1;
|
||||
key = "attachment" + numAttachments;
|
||||
var opt = new Option(attachment, key);
|
||||
selectNode.add(opt, null);
|
||||
}
|
||||
}
|
||||
|
||||
function AttachPage()
|
||||
{
|
||||
window.openDialog("chrome://messengercompose/content/MsgAttachPage.xul", "attachPageDialog", "chrome", {addattachmentfunction:AddAttachment});
|
||||
}
|
||||
|
||||
function GenerateAttachmentsString()
|
||||
{
|
||||
dump("GenerateAttachmentsString()\n");
|
||||
attachments = "";
|
||||
|
||||
selectNode = document.getElementById('attachments');
|
||||
if (selectNode == null) return attachments;
|
||||
options = selectNode.options;
|
||||
if (options == null) return attachments;
|
||||
if (options.length == 0) return attachments;
|
||||
|
||||
attachments = options[0].text;
|
||||
|
||||
for (i=1;i<options.length;i++) {
|
||||
attachments = attachments + "," + options[i].text;
|
||||
}
|
||||
|
||||
return attachments;
|
||||
}
|
||||
|
||||
function RemoveLastAttachment()
|
||||
{
|
||||
dump("RemoveLastAttachment()\n");
|
||||
selectNode = document.getElementById('attachments');
|
||||
i = selectNode.options.length;
|
||||
if (i > 0) {
|
||||
selectNode.remove(i - 1);
|
||||
/* bug in the DOM? when I remove the last element, the text
|
||||
remains. so for now, when I remove the last element, I add
|
||||
back a blank element, then remove it, so that it looks
|
||||
correct. bug logged #11010 */
|
||||
if (i == 1) {
|
||||
var opt = new Option(" ", " ");
|
||||
selectNode.add(opt, null);
|
||||
selectNode.remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ install::
|
||||
$(MAKE_INSTALL) defaultHtmlBody.html $(DIST)\bin\chrome\messengercompose\content\default
|
||||
$(MAKE_INSTALL) composebe_en.properties $(DIST)\bin\chrome\messengercompose\content\default
|
||||
$(MAKE_INSTALL) addressAutoComplete.js $(DIST)\bin\chrome\messengercompose\content\default
|
||||
$(MAKE_INSTALL) MsgAttachPage.js $(DIST)\bin\chrome\messengercompose\content\default
|
||||
$(MAKE_INSTALL) MsgAttachPage.xul $(DIST)\bin\chrome\messengercompose\content\default
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\chrome\messengercompose\content\default\messengercompose.xul
|
||||
@ -34,3 +36,5 @@ clobber::
|
||||
rm -f $(DIST)\bin\chrome\messengercompose\content\default\defaultHtmlBody.html
|
||||
rm -f $(DIST)\bin\chrome\messengercompose\content\default\composebe_en.properties
|
||||
rm -f $(DIST)\bin\chrome\messengercompose\content\default\addressAutoComplete.js
|
||||
rm -f $(DIST)\bin\chrome\messengercompose\content\default\MsgAttachPage.js
|
||||
rm -f $(DIST)\bin\chrome\messengercompose\content\default\MsgAttachPage.xul
|
||||
|
@ -54,7 +54,6 @@ Rights Reserved.
|
||||
<broadcaster id="dialog.start" ready="false"/>
|
||||
<observes element="dialog.start" attribute="ready" onchange="ComposeStartup()"/>
|
||||
|
||||
|
||||
<!-- box id="toolbar" align="vertical" style="width:100%;height:100%" -->
|
||||
<toolbox>
|
||||
<menubar>
|
||||
@ -64,7 +63,13 @@ Rights Reserved.
|
||||
<menuitem value="&saveCmd.label;" cmd="nsCmd:ComposeSave"/>
|
||||
<menuitem value="&saveAsCmd.label;" onaction="SaveAsDraft()"/>
|
||||
<menuitem value="&saveAsTemplateCmd.label;" onaction="SaveAsTemplate()"/>
|
||||
<menuitem value="&attachCmd.label;" cmd="nsCmd:ComposeAttach"/>
|
||||
<menu id="attachMenu" name="&attachMenu.label;">
|
||||
<menuitem name="&attachFileCmd.label;" onclick="AttachFile()"/>
|
||||
<menuitem name="&attachPageCmd.label;" onclick="AttachPage()"/>
|
||||
<menuitem name="&removeLastAttachmentCmd.label;" onclick="RemoveLastAttachment()"/>
|
||||
<menuseparator/>
|
||||
<menuitem name="&attachVCardCmd.label;" onclick="AttachVCard()"/>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem value="&sendNowCmd.label;" onaction="SendMessage()"/>
|
||||
<menuitem value="&sendLaterCmd.label;" onaction="SendMessageLater()"/>
|
||||
@ -210,6 +215,12 @@ Rights Reserved.
|
||||
<html:select id="msgIdentity" flex="80%"/>
|
||||
</box>
|
||||
<spring style="height:0.5em"/>
|
||||
<box align="horizontal" flex="100%">
|
||||
<html:div flex="20%">&attachments.label;</html:div>
|
||||
<html:select id="attachments" flex="80%">
|
||||
</html:select>
|
||||
</box>
|
||||
<spring style="height:0.5em"/>
|
||||
<box align="horizontal" flex="100%">
|
||||
<box align="vertical" flex="20%">
|
||||
<box align="vertical" flex="100%">
|
||||
@ -273,27 +284,6 @@ Rights Reserved.
|
||||
<html:input id="msgSubject" type="text" flex="80%" onkeyup="SetComposeWindowTitle(event.which);"/>
|
||||
</box>
|
||||
</box>
|
||||
<box align="vertical" flex="40%">
|
||||
<box align="horizontal" flex="100%">
|
||||
<html:div flex="100%">[attachment box]</html:div>
|
||||
<!--
|
||||
<tree id="attachment" class="attachment" flex="100%">
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell>Attachment</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
<treechildren id="attachmentTree" open="true">
|
||||
<treeitem> <treerow> <treecell>aaaa</treecell> </treerow> </treeitem>
|
||||
<treeitem> <treerow> <treecell>bbb</treecell> </treerow> </treeitem>
|
||||
<treeitem> <treerow> <treecell>ccc</treecell> </treerow> </treeitem>
|
||||
<treeitem> <treerow> <treecell>dddd</treecell> </treerow> </treeitem>
|
||||
<treeitem> <treerow> <treecell>eeeee</treecell> </treerow> </treeitem>
|
||||
</treechildren>
|
||||
</tree>
|
||||
-->
|
||||
</box>
|
||||
</box>
|
||||
</box>
|
||||
</toolbar>
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
<!ENTITY followupAddr.label "Followup:">
|
||||
<!ENTITY subject.label "Subject:">
|
||||
|
||||
<!ENTITY attachments.label "Attachments:">
|
||||
|
||||
<!-- menu items: the . means that the menu item isn't implemented yet -->
|
||||
|
||||
@ -19,7 +20,11 @@
|
||||
<!ENTITY saveCmd.label ".Save">
|
||||
<!ENTITY saveAsCmd.label "Save As (Draft)">
|
||||
<!ENTITY saveAsTemplateCmd.label "Save As (Template)">
|
||||
<!ENTITY attachCmd.label ".Attach">
|
||||
<!ENTITY attachMenu.label "Attach...">
|
||||
<!ENTITY attachFileCmd.label "File...">
|
||||
<!ENTITY attachPageCmd.label "Web Page...">
|
||||
<!ENTITY removeLastAttachmentCmd.label "Remove Last Attachment">
|
||||
<!ENTITY attachVCardCmd.label ".Personal Card (vCard)">
|
||||
<!ENTITY sendNowCmd.label "Send Now">
|
||||
<!ENTITY sendLaterCmd.label "Send Later">
|
||||
<!ENTITY quoteOrigCmd.label ".Quote Original Message">
|
||||
|
@ -292,7 +292,7 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode,
|
||||
m_compFields->SetReplyTo(NS_CONST_CAST(char*, (const char *)replyTo));
|
||||
m_compFields->SetOrganization(NS_CONST_CAST(char*, (const char *)organization));
|
||||
|
||||
#ifdef DEBUG_ducarroz
|
||||
#if defined(DEBUG_ducarroz) || defined(DEBUG_seth_)
|
||||
printf("----------------------------\n");
|
||||
printf("-- Sending Mail Message --\n");
|
||||
printf("----------------------------\n");
|
||||
@ -300,6 +300,7 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode,
|
||||
printf("To: %s Cc: %s Bcc: %s\n", m_compFields->GetTo(), m_compFields->GetCc(), m_compFields->GetBcc());
|
||||
printf("Newsgroups: %s\n", m_compFields->GetNewsgroups());
|
||||
printf("Subject: %s \nMsg: %s\n", m_compFields->GetSubject(), m_compFields->GetBody());
|
||||
printf("Attachments: %s\n",m_compFields->GetAttachments());
|
||||
printf("----------------------------\n");
|
||||
#endif //DEBUG
|
||||
|
||||
@ -343,7 +344,13 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode,
|
||||
tEditor = m_editor;
|
||||
}
|
||||
else
|
||||
tEditor = nsnull;
|
||||
tEditor = nsnull;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("RHP: do your magic here.\n");
|
||||
printf("Attachments: %s\n",m_compFields->GetAttachments());
|
||||
#endif
|
||||
|
||||
rv = mMsgSend->CreateAndSendMessage(
|
||||
tEditor,
|
||||
identity,
|
||||
|
@ -186,8 +186,10 @@ public:
|
||||
nsIMsgSendListener **CreateListenerArray();
|
||||
|
||||
private:
|
||||
|
||||
nsMsgCompose *mComposeObj;
|
||||
MSG_DeliverMode mDeliverMode;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
<!ENTITY followupAddr.label "Followup:">
|
||||
<!ENTITY subject.label "Subject:">
|
||||
|
||||
<!ENTITY attachments.label "Attachments:">
|
||||
|
||||
<!-- menu items: the . means that the menu item isn't implemented yet -->
|
||||
|
||||
@ -19,7 +20,11 @@
|
||||
<!ENTITY saveCmd.label ".Save">
|
||||
<!ENTITY saveAsCmd.label "Save As (Draft)">
|
||||
<!ENTITY saveAsTemplateCmd.label "Save As (Template)">
|
||||
<!ENTITY attachCmd.label ".Attach">
|
||||
<!ENTITY attachMenu.label "Attach...">
|
||||
<!ENTITY attachFileCmd.label "File...">
|
||||
<!ENTITY attachPageCmd.label "Web Page...">
|
||||
<!ENTITY removeLastAttachmentCmd.label "Remove Last Attachment">
|
||||
<!ENTITY attachVCardCmd.label ".Personal Card (vCard)">
|
||||
<!ENTITY sendNowCmd.label "Send Now">
|
||||
<!ENTITY sendLaterCmd.label "Send Later">
|
||||
<!ENTITY quoteOrigCmd.label ".Quote Original Message">
|
||||
|
Loading…
Reference in New Issue
Block a user