Changing email so that you can now email more than one event, bug 177344.

This commit is contained in:
mikep%oeone.com 2002-10-30 18:15:02 +00:00
Родитель ec0c0a5e41
Коммит 035ec44f05
1 изменённых файлов: 67 добавлений и 48 удалений

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

@ -170,7 +170,6 @@ function sendEvent()
var nsIMsgAttachmentComponent;
var nsIMsgAttachment;
Event = gCalendarWindow.EventSelection.selectedEvents[0].clone();
CalendarDataFilePath = getCalendarDataFilePath();
if (! CalendarDataFilePath)
{
@ -182,16 +181,37 @@ function sendEvent()
* Where: San Francisco
* see bug 59630
*/
var CalendarText = "";
var EmailBody = "";
var Seperator = "";
for( var i = 0; i < gCalendarWindow.EventSelection.selectedEvents.length; i++ )
{
Event = gCalendarWindow.EventSelection.selectedEvents[0].clone();
if( Event )
{
Event.alarm = false;
if( Event.method == 0 )
Event.method = Event.ICAL_METHOD_PUBLISH;
CalendarText += Event.getIcalString();
EmailBody += emailStringBundle.GetStringFromName( "When" )+" " + Event.start + "-" + Event.end + "\n"+emailStringBundle.GetStringFromName( "Where" )+" " + Event.location + "\n"+emailStringBundle.GetStringFromName( "Organizer" )+" " + gMailIdentity.fullName + " <" + gMailIdentity.email + ">" + "\n"+emailStringBundle.GetStringFromName( "Summary" )+":" + Event.description;
EmailBody += Seperator;
Seperator = "\n";
}
}
if( gCalendarWindow.EventSelection.selectedEvents.length == 1 )
var EmailSubject = Event.title;
else
var EmailSubject = emailStringBundle.GetStringFromName( "EmailSubject" );
saveCalendarObject(CalendarDataFilePath, CalendarText);
// lets open a composer with fields and body prefilled
try
{
Event.alarm = false;
if(Event.method == 0)
Event.method = Event.ICAL_METHOD_PUBLISH;
saveCalendarObject(CalendarDataFilePath, Event.getIcalString());
nsIMsgAttachmentComponent = Components.classes["@mozilla.org/messengercompose/attachment;1"];
nsIMsgAttachment = nsIMsgAttachmentComponent.createInstance(Components.interfaces.nsIMsgAttachment);
nsIMsgAttachment.name = emailStringBundle.GetStringFromName( "AttachmentName" );
@ -205,9 +225,9 @@ function sendEvent()
nsIMsgCompFields.attachVCard = true;
nsIMsgCompFields.from = gMailIdentity.email;
nsIMsgCompFields.replyTo = gMailIdentity.replyTo;
nsIMsgCompFields.subject = Event.title;
nsIMsgCompFields.subject = EmailSubject;
nsIMsgCompFields.organization = gMailIdentity.organization;
nsIMsgCompFields.body = emailStringBundle.GetStringFromName( "When" )+" " + Event.start + "-" + Event.end + "\n"+emailStringBundle.GetStringFromName( "Where" )+" " + Event.location + "\n"+emailStringBundle.GetStringFromName( "Organizer" )+" " + gMailIdentity.fullName + " <" + gMailIdentity.email + ">" + "\n"+emailStringBundle.GetStringFromName( "Summary" )+":" + Event.description;
nsIMsgCompFields.body = EmailBody;
nsIMsgCompFields.addAttachment(nsIMsgAttachment);
/* later on we may be able to add:
* returnReceipt, attachVCard
@ -230,7 +250,6 @@ function sendEvent()
mdebug("failed to get composer window\nex: " + ex);
}
}
}
/**** getCalendarDataFilePath
*