propagate from branch 'ca.inverse.sogo.1_3_16' (head d29498142c4a9f1d780373bd5f0d80b17f6e2c33)

to branch 'ca.inverse.sogo' (head 7ce650138898448e808ecf1785eedab0ad0d3e6d)

Monotone-Parent: 7ce650138898448e808ecf1785eedab0ad0d3e6d
Monotone-Parent: d29498142c4a9f1d780373bd5f0d80b17f6e2c33
Monotone-Revision: 41c57dcc45ba83665003200a0ea8b1cc14d09eec

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2012-05-30T12:46:26
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Ludovic Marcotte 2012-05-30 12:46:26 +00:00
commit f0d028a858
24 changed files with 195 additions and 136 deletions

View File

@ -1,3 +1,29 @@
2012-05-29 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/UIxMailEditor.js (validateEditorInput):
merged with onValidate.
(onValidate): don't force the subject to be defined, but alert
the user.
* UI/MailerUI/UIxMailView.m (-messageSubject): don't set the
subject to "Untitled" if it's not set.
* UI/MailPartViewers/UIxMailPartMessageViewer.m (-messageSubject): idem.
* UI/MailerUI/UIxMailEditor.m (-validateForSend): don't force the
subject to be defined.
* SoObjects/Mailer/SOGoMailObject+Draft.m (-subjectForReply): make
sure subject is a defined value to avoid "null" strings in the
reply message.
2012-05-28 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/SchedulerUI.js (validateUploadForm): hide
Cancel button when the form is valid and disable the Submit button.
* UI/WebServerResources/ContactsUI.js (validateUploadForm): idem.
2012-05-24 Jean Raby <jraby@inverse.ca>
* debian*/rules: Restart sogod after pkg upgrade (dh_installinit -R)
@ -35,7 +61,7 @@
to read its freebusy info.
Without this, sogo would always auto-accept invitations from 'unprivileged'
users, potentially bypassing the multiplebooking parameter.
2012-05-14 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/gen-property-selectors.py: "bannedProps" is now a
@ -105,7 +131,7 @@
* OpenChange/MAPIStoreSOGo.m: register and unregister current
thread before and after each backend operation, in order to avoid
issues in multithreaded environment.
issues in multithreaded environment.
2012-05-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>

View File

@ -354,7 +354,7 @@ static NGCardsSaxHandler *sax = nil;
- (void) setChildrenAsCopy: (NSMutableArray *) someChildren
{
unsigned int count, max;
NSUInteger count, max;
ASSIGN (children, someChildren);
@ -399,7 +399,7 @@ static NGCardsSaxHandler *sax = nil;
- (NSString *) description
{
NSMutableString *str;
unsigned int count, max;
NSUInteger count, max;
str = [NSMutableString stringWithCapacity:64];
[str appendFormat:@"<%p[%@]:%@",
@ -421,7 +421,7 @@ static NGCardsSaxHandler *sax = nil;
- (void) replaceThisElement: (CardElement *) oldElement
withThisOne: (CardElement *) newElement
{
unsigned int index;
NSUInteger index;
index = [children indexOfObject: oldElement];
if (index != NSNotFound)

View File

@ -1,3 +1,17 @@
2012-05-30 Francis Lachapelle <flachapelle@inverse.ca>
* iCalRepeatableEntityObject.m (-exceptionDatesWithTimeZone:)
(-rules:withTimeZone:): exception dates and exception rules must
also be adjusted for floating all-day repeating events.
2012-05-29 Francis Lachapelle <flachapelle@inverse.ca>
* iCalRecurrenceCalculator.m
(_removeExceptionDatesFromRanges:withDates:withinRange:startingWithDate:):
when removing exception dates, avoid removing dates matching the
end date of the occurrence. This fixes an issue with all-day
daily events.
2012-04-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalMonthlyRecurrenceCalculator.m (NGMonthDaySet_clear): make

View File

@ -189,6 +189,7 @@ static Class yearlyCalcClass = Nil;
NSCalendarDate *currentDate;
NGCalendarDateRange *currentRange;
unsigned int count, maxRanges;
NSComparisonResult compare;
dates = [[self _dates: exdates withinRange: limits] objectEnumerator];
while ((currentDate = [dates nextObject]))
@ -197,8 +198,12 @@ static Class yearlyCalcClass = Nil;
for (count = maxRanges; count > 0; count--)
{
currentRange = [ranges objectAtIndex: count - 1];
if ([currentRange containsDate: currentDate])
[ranges removeObjectAtIndex: count - 1];
compare = [[currentRange startDate] compare: currentDate];
if ((compare == NSOrderedAscending || compare == NSOrderedSame) &&
[[currentRange endDate] compare: currentDate] == NSOrderedDescending)
{
[ranges removeObjectAtIndex: count - 1];
}
}
}
}

View File

@ -42,21 +42,21 @@
- (void)setRecurrenceRules:(NSArray *)_rrule;
- (BOOL)hasRecurrenceRules;
- (NSArray *)recurrenceRules;
- (NSArray *)recurrenceRulesWithTimeZone: (iCalTimeZone *) timezone;
- (NSArray *)recurrenceRulesWithTimeZone: (id) timezone;
- (void)removeAllExceptionRules;
- (void)addToExceptionRules:(id)_rrule;
- (BOOL)hasExceptionRules;
- (NSArray *)exceptionRules;
- (NSArray *)exceptionRulesWithTimeZone: (iCalTimeZone *) timezone;
- (NSArray *)exceptionRulesWithTimeZone: (id) timezone;
- (void)removeAllExceptionDates;
- (void)addToExceptionDates:(NSCalendarDate *)_date;
- (BOOL)hasExceptionDates;
- (NSArray *)exceptionDates;
- (NSArray *)exceptionDatesWithTimeZone: (iCalTimeZone*) theTimeZone;
- (NSArray *)exceptionDatesWithTimeZone: (id) theTimeZone;
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (iCalTimeZone *) theTimeZone;
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (id) theTimeZone;
- (BOOL)isRecurrent;
- (BOOL)isWithinCalendarDateRange:(NGCalendarDateRange *)_range

View File

@ -1,6 +1,6 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2011 Inverse inc.
Copyright (C) 2012 Inverse inc.
This file is part of SOPE.
@ -24,10 +24,12 @@
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
#import <NGExtensions/NGCalendarDateRange.h>
#import "NSCalendarDate+NGCards.h"
#import "NSString+NGCards.h"
#import "iCalDateTime.h"
#import "iCalEvent.h"
#import "iCalTimeZone.h"
@ -79,7 +81,7 @@
return [self childrenWithTag: @"rrule"];
}
- (NSArray *) recurrenceRulesWithTimeZone: (iCalTimeZone *) timezone
- (NSArray *) recurrenceRulesWithTimeZone: (id) timezone
{
NSArray *rules;
@ -113,7 +115,7 @@
return [self childrenWithTag: @"exrule"];
}
- (NSArray *) exceptionRulesWithTimeZone: (iCalTimeZone *) timezone
- (NSArray *) exceptionRulesWithTimeZone: (id) timezone
{
NSArray *rules;
@ -131,12 +133,13 @@
* @see exceptionRulesWithTimeZone:
* @return a new array of iCalRecurrenceRule instances, adjusted for the timezone.
*/
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (iCalTimeZone *) theTimeZone
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (id) theTimeZone
{
NSArray *rules;
NSCalendarDate *untilDate;
NSMutableArray *fixedRules;
iCalRecurrenceRule *currentRule;
int offset;
unsigned int max, count;
rules = theRules;
@ -152,7 +155,14 @@
untilDate = [currentRule untilDate];
if (untilDate)
{
untilDate = [theTimeZone computedDateForDate: untilDate];
if ([theTimeZone isKindOfClass: [iCalTimeZone class]])
untilDate = [(iCalTimeZone *) theTimeZone computedDateForDate: untilDate];
else
{
offset = [(NSTimeZone *) theTimeZone secondsFromGMTForDate: untilDate];
untilDate = (NSCalendarDate *) [untilDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
seconds:-offset];
}
[currentRule setUntilDate: untilDate];
}
[fixedRules addObject: currentRule];
@ -232,12 +242,13 @@
* @see [iCalTimeZone computedDatesForStrings:]
* @return the exception dates, adjusted to the timezone.
*/
- (NSArray *) exceptionDatesWithTimeZone: (iCalTimeZone *) theTimeZone
- (NSArray *) exceptionDatesWithTimeZone: (id) theTimeZone
{
NSArray *dates, *exDates;
NSEnumerator *dateList;
NSCalendarDate *exDate;
NSString *dateString;
int offset;
unsigned i;
if (theTimeZone)
@ -251,9 +262,19 @@
for (i = 0; i < [exDates count]; i++)
{
dateString = [exDates objectAtIndex: i];
exDate = [theTimeZone computedDateForString: dateString];
if ([theTimeZone isKindOfClass: [iCalTimeZone class]])
{
exDate = [(iCalTimeZone *) theTimeZone computedDateForString: dateString];
}
else
{
exDate = [dateString asCalendarDate];
offset = [(NSTimeZone *) theTimeZone secondsFromGMTForDate: exDate];
exDate = (NSCalendarDate *) [exDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
seconds:-offset];
}
[(NSMutableArray *) dates addObject: exDate];
}
}
}
}
else

View File

@ -125,9 +125,7 @@
NSArray *ranges;
NGCalendarDateRange *checkRange, *firstRange;
NSCalendarDate *startDate, *endDate;
NSTimeZone *timeZone;
id firstStartDate, firstEndDate;
iCalTimeZone *eventTimeZone;
id firstStartDate, firstEndDate, timeZone;
BOOL doesOccur;
int offset;
@ -139,9 +137,11 @@
// Set the range to check with respect to the event timezone (extracted from the start date)
firstStartDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"];
eventTimeZone = [(iCalDateTime *)firstStartDate timeZone];
if (eventTimeZone)
startDate = [eventTimeZone computedDateForDate: theOccurenceDate];
timeZone = [(iCalDateTime *)firstStartDate timeZone];
if (timeZone)
{
startDate = [(iCalTimeZone *)timeZone computedDateForDate: theOccurenceDate];
}
else
{
startDate = theOccurenceDate;
@ -150,13 +150,14 @@
// The event lasts all-day and has no timezone (floating); we convert the range of the first event
// to the occurence's timezone.
timeZone = [theOccurenceDate timeZone];
offset = [timeZone secondsFromGMTForDate: [firstRange startDate]];
offset = [(NSTimeZone *)timeZone secondsFromGMTForDate: [firstRange startDate]];
firstStartDate = (NSCalendarDate *)[[firstRange startDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
seconds:-offset];
firstEndDate = (NSCalendarDate *)[[firstRange endDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
seconds:-offset];
[(NSCalendarDate *)firstStartDate setTimeZone: timeZone];
[(NSCalendarDate *)firstEndDate setTimeZone: timeZone];
firstRange = [NGCalendarDateRange calendarDateRangeWithStartDate: firstStartDate
endDate: firstEndDate];
}
@ -168,9 +169,9 @@
// Calculate the occurrences for the given date
ranges = [iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange: checkRange
firstInstanceCalendarDateRange: firstRange
recurrenceRules: [self recurrenceRulesWithTimeZone: eventTimeZone]
exceptionRules: [self exceptionRulesWithTimeZone: eventTimeZone]
exceptionDates: [self exceptionDatesWithTimeZone: eventTimeZone]];
recurrenceRules: [self recurrenceRulesWithTimeZone: timeZone]
exceptionRules: [self exceptionRulesWithTimeZone: timeZone]
exceptionDates: [self exceptionDatesWithTimeZone: timeZone]];
doesOccur = [ranges dateRangeArrayContainsDate: startDate];
}

View File

@ -53,12 +53,14 @@
nil
};
BOOL hasPrefix;
unsigned int i;
NSUInteger i;
NSString *subject, *newSubject;
hasPrefix = NO;
subject = [self decodedSubject];
if (![subject length]) subject = @"";
i = 0;
while (!hasPrefix && replyPrefixes[i])
if ([subject hasPrefix: replyPrefixes[i]])
@ -99,7 +101,7 @@
NSDictionary *parts;
NSString *rawPart, *content, *contentKey;
SOGoUserDefaults *ud;
int index;
NSUInteger index;
BOOL htmlComposition, htmlContent;
content = @"";
@ -189,7 +191,7 @@
static NSString *sescape[] = {
@"/", @"..", @"~", @"\"", @"'", @" ", @".", nil
};
unsigned int count, length;
NSUInteger count, length;
subject = [self decodedSubject];
length = [subject length];
@ -298,7 +300,7 @@
NSString *newPath;
NSArray *subparts;
NSString *type;
unsigned int i;
NSUInteger i;
type = [[part objectForKey: @"type"] lowercaseString];
if ([type isEqualToString: @"multipart"])

View File

@ -471,7 +471,8 @@ static int cssEscapingCount;
- (int) timeValue
{
int i, time;
int time;
NSInteger i;
if ([self length] > 0)
{

View File

@ -198,6 +198,7 @@
"Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload";
"Uploading" = "Uploading";
"Done" = "Done";
"An error occured while importing contacts." = "An error occured while importing contacts.";
"No card was imported." = "No card was imported.";

View File

@ -43,7 +43,7 @@
@interface UIxMailPartAlternativeViewer : UIxMailPartViewer
{
id childInfo;
unsigned int childIndex;
NSUInteger childIndex;
}
@end
@ -70,7 +70,7 @@
- (NSArray *) childPartTypes
{
NSMutableArray *types;
unsigned i, count;
NSUInteger i, count;
NSArray *childParts;
childParts = [[self bodyInfo] valueForKey:@"parts"];
@ -89,10 +89,10 @@
return types;
}
- (unsigned int) _preferredTypesPart: (NSArray *) types
- (NSUInteger) _preferredTypesPart: (NSArray *) types
{
unsigned int count, max;
unsigned int part;
NSUInteger count, max;
NSUInteger part;
const NSString *priorities[] = { @"multipart/related", @"multipart/mixed",
@"text/calendar", @"text/html",
@"text/plain" };
@ -113,7 +113,7 @@
- (int) _selectPartIndexFromTypes: (NSArray *) _types
{
/* returns the index of the selected part or NSNotFound */
unsigned count, max, part;
NSUInteger count, max, part;
part = [self _preferredTypesPart: _types];
if (part == NSNotFound)
@ -136,7 +136,7 @@
- (void) selectChildInfo
{
unsigned idx;
NSUInteger idx;
[childInfo release]; childInfo = nil;
childIndex = 0;
@ -164,7 +164,7 @@
return childInfo;
}
- (unsigned int) childIndex
- (NSUInteger) childIndex
{
if (!childIndex)
[self selectChildInfo];
@ -176,7 +176,7 @@
{
char buf[8];
sprintf (buf, "%d", [self childIndex] + 1);
sprintf (buf, "%"PRIuPTR"", [self childIndex] + 1);
return [NSString stringWithCString:buf];
}

View File

@ -165,7 +165,7 @@
subject = [baseSubject decodedHeader];
if (![subject length])
subject = [self labelForKey: @"Untitled"];
subject = @"";
return subject;
}

View File

@ -283,9 +283,9 @@
= "The messages could not be moved to the trash folder. Would you like to delete them immediately?";
/* Message editing */
"error_validationfailed" = "Validation failed";
"error_missingsubject" = "Subject is missing";
"error_missingrecipients" = "No recipients specified";
"error_missingsubject" = "The message has no subject. Are you sure you want to send it?";
"error_missingrecipients" = "Please specify at least one recipient.";
"Send Anyway" = "Send Anyway";
/* Message sending */
"cannot send message: (smtp) all recipients discarded" = "Cannot send message: all recipients are invalid.";

View File

@ -394,7 +394,7 @@ static NSArray *infoKeys = nil;
{
if (![_info isNotNull]) return;
[self debugWithFormat:@"loading info ..."];
[self takeValuesFromDictionary:_info];
[self setValuesForKeysWithDictionary:_info];
}
- (NSDictionary *) storeInfo
@ -653,10 +653,7 @@ static NSArray *infoKeys = nil;
if (![self hasOneOrMoreRecipients])
error = [NSException exceptionWithHTTPStatus: 400 /* Bad Request */
reason: @"Please select a recipient!"];
else if ([[self subject] length] == 0)
error = [NSException exceptionWithHTTPStatus: 400 /* Bad Request */
reason: @"Please set a subject!"];
reason: [self labelForKey: @"error_missingrecipients"]];
else
error = nil;

View File

@ -192,7 +192,7 @@
baseSubject = [[message valueForKey: @"envelope"] subject];
subject = [baseSubject decodedHeader];
if (![subject length])
subject = [self labelForKey: @"Untitled"];
subject = @"";
return [subject stringByEscapingHTMLString];
}

View File

@ -125,8 +125,8 @@
// TODO: this is ugly, create reusable link facility in SOPE
// TODO: remove 'search' and 'filterpopup', preserve sorting
NSMutableString *ms;
NSArray *qp;
unsigned i, count;
NSArray *qp;
NSUInteger i, count;
qp = [[u substringFromIndex:(r.location + r.length)]
componentsSeparatedByString:@"&"];
@ -193,8 +193,8 @@
SOGoMailAccounts *co;
SOGoContactFolders *folders;
SOGoParentFolder *folder;
WORequest *request;
int i, count;
WORequest *request;
NSUInteger i, count;
parameters = nil;
co = [self clientObject];
@ -549,7 +549,7 @@
NSArray *available;
NSDictionary *metaData;
SOGoUserDefaults *ud;
unsigned int i;
NSUInteger i;
if (!columnsOrder)
{
@ -636,8 +636,8 @@
NSMutableArray *folders;
NSMutableString *path;
SOGoUserDefaults *ud;
NSString *s;
int i, j, k;
NSString *s;
NSUInteger i, j, k;
ud = [[context activeUser] userDefaults];
folders = [NSMutableArray array];

View File

@ -96,8 +96,6 @@ static NSString *mailETag = nil;
NSString *subject;
subject = [[self clientObject] decodedSubject];
if (![subject length])
subject = [self labelForKey: @"Untitled"];
return subject;
}

View File

@ -110,6 +110,7 @@
"Import Events" = "Import Events";
"Select an iCalendar file (.ics)." = "Select an iCalendar file (.ics).";
"Upload" = "Upload";
"Uploading" = "Uploading";
"Publish Calendar..." = "Publish Calendar...";
"Reload Remote Calendars" = "Reload Remote Calendars";
"Properties" = "Properties";

View File

@ -118,7 +118,7 @@
- (NSArray *) filterAppointments:(NSArray *) _apts
{
NSMutableArray *filtered;
unsigned i, count, p, pCount;
NSUInteger i, count, p, pCount;
NSString *email, *partmailsString, *state, *pEmail;
NSDictionary *info, *primaryIdentity;
NSArray *partmails, *partstates;
@ -370,7 +370,7 @@
{
NSArray *apts;
NSMutableArray *filtered;
unsigned i, count;
NSUInteger i, count;
if (allDayApts)
return allDayApts;
@ -532,7 +532,8 @@
NSString *uidsString, *loc, *prevMethod, *userFolderID;
id <WOActionResults> r;
BOOL useGroups;
unsigned index;
NSUInteger index;
uidsString = [self queryParameterForKey: @"userUIDString"];
uidsString = [uidsString stringByTrimmingSpaces];

View File

@ -525,7 +525,7 @@ iRANGE(2);
iCalTrigger *aTrigger;
NSString *duration, *quantity;
unichar c;
unsigned int i;
NSUInteger i;
if ([component hasAlarms])
{
@ -1289,7 +1289,7 @@ iRANGE(2);
NSString *currentOwner;
SOGoAppointmentFolder *currentCalendar;
SOGoUser *currentUser;
unsigned i;
NSUInteger i;
calendars = [self calendarList];
owners = [NSMutableArray arrayWithCapacity: [calendars count]];
@ -1562,7 +1562,7 @@ RANGE(2);
{
NSString *cycleRep;
NSArray *cycles;
unsigned i, count;
NSUInteger i, count;
if (!_rrule)
return [[self cycles] objectAtIndex:0];
@ -1721,7 +1721,7 @@ RANGE(2);
// s = [self queryParameterForKey:_qp];
// if(s && [s length] > 0) {
// NSArray *es;
// unsigned i, count;
// NSUInteger i, count;
// es = [s componentsSeparatedByString: @","];
// count = [es count];
@ -1766,7 +1766,7 @@ RANGE(2);
- (void) _handleAttendeesEdition
{
NSMutableArray *newAttendees;
unsigned int count, max;
NSUInteger count, max;
NSString *currentEmail;
iCalPerson *currentAttendee;
NSString *json, *role, *partstat;
@ -2189,7 +2189,7 @@ RANGE(2);
iCalTrigger *aTrigger;
iCalAlarm *anAlarm;
NSString *aValue;
unsigned int index;
NSUInteger index;
anAlarm = [iCalAlarm new];

View File

@ -12,25 +12,6 @@ var Contact = {
deleteContactsRequestCount: null
};
function validateEditorInput(sender) {
var errortext = "";
var field;
field = document.pageform.subject;
if (field.value == "")
errortext = errortext + labels.error_missingsubject + "\n";
if (!hasRecipients())
errortext = errortext + labels.error_missingrecipients + "\n";
if (errortext.length > 0) {
alert(labels.error_validationfailed + ":\n"
+ errortext);
return false;
}
return true;
}
function openContactsFolder(contactsFolder, reload, idx) {
if ((contactsFolder && contactsFolder != Contact.currentAddressBook)
|| reload) {
@ -799,13 +780,21 @@ function hideImportResults () {
}
function validateUploadForm () {
rc = false;
if ($("contactsFile").value.length)
if ($("contactsFile").value.length) {
var btn = jQuery('#uploadSubmit');
jQuery('#uploadCancel').fadeOut('fast');
btn.addClass("disabled");
btn.children('span').text(_('Uploading'));
rc = true;
}
return rc;
}
function uploadCompleted(response) {
data = response.evalJSON(true);
jQuery('#uploadCancel').show();
var btn = jQuery('#uploadSubmit');
btn.removeClass("disabled");
btn.children('span').text(_('Upload'));
var div = $("uploadResults");
if (data.imported <= 0)
$("uploadResultsContent").update(_("An error occured while importing contacts."));

View File

@ -2849,13 +2849,21 @@ function hideImportResults(event) {
}
function validateUploadForm() {
rc = false;
if ($("calendarFile").value.length)
if ($("calendarFile").value.length) {
var btn = jQuery('#uploadSubmit');
jQuery('#uploadCancel').fadeOut('fast');
btn.addClass("disabled");
btn.children('span').text(_('Uploading'));
rc = true;
}
return rc;
}
function uploadCompleted(response) {
data = response.evalJSON(true);
jQuery('#uploadCancel').show();
var btn = jQuery('#uploadSubmit');
btn.removeClass("disabled");
btn.children('span').text(_('Upload'));
var div = $("uploadResults");
if (data.imported < 0)
$("uploadResultsContent").update(_("An error occurred while importing calendar."));

View File

@ -237,7 +237,7 @@ TABLE#contactsList TD#mailHeader
DIV.contactSelection
{
z-index: 10;
z-index: 1;
background: inherit;
position: absolute;
bottom: 0em;

View File

@ -107,51 +107,45 @@ function insertContact(inputNode, contactName, contactEmail) {
/* mail editor */
function validateEditorInput() {
var errortext = "";
var field;
field = document.pageform.subject;
if (field.value == "")
errortext = errortext + _("error_missingsubject") + "\n";
if (!hasRecipients())
errortext = errortext + _("error_missingrecipients") + "\n";
if (errortext.length > 0) {
alert(_("error_validationfailed") + ":\n" + errortext);
return false;
function onValidate(onSuccess) {
if (document.pageform.action != "send") {
if (!hasRecipients()) {
showAlertDialog(_("error_missingrecipients"));
}
else if (document.pageform.subject.value == "") {
showConfirmDialog(_("Warning"), _("error_missingsubject"), onValidateDone.bind(this, onSuccess), null, _("Send anyway"), _("Cancel"));
}
else {
onValidateDone(onSuccess);
}
}
return true;
}
function onValidate(event) {
var rc = false;
function onValidateDone(onSuccess) {
var input = currentAttachmentInput();
if (input)
input.parentNode.removeChild(input);
if (document.pageform.action != "send"
&& validateEditorInput()) {
var input = currentAttachmentInput();
if (input)
input.parentNode.removeChild(input);
var toolbar = document.getElementById("toolbar");
if (!document.busyAnim)
document.busyAnim = startAnimation(toolbar);
var lastRow = $("lastRow");
lastRow.down("select").name = "popup_last";
var toolbar = document.getElementById("toolbar");
if (!document.busyAnim)
document.busyAnim = startAnimation(toolbar);
window.shouldPreserve = true;
var lastRow = $("lastRow");
lastRow.down("select").name = "popup_last";
window.shouldPreserve = true;
document.pageform.action = "send";
AIM.submit($(document.pageform), {'onComplete' : onPostComplete});
if (typeof onSuccess == 'function')
onSuccess();
document.pageform.action = "send";
disposeDialog();
AIM.submit($(document.pageform), {'onComplete' : onPostComplete});
rc = true;
}
return rc;
return true;
}
function onPostComplete(response) {
@ -184,9 +178,9 @@ function onPostComplete(response) {
}
function clickedEditorSend() {
if (onValidate()) {
document.pageform.submit();
}
onValidate(function() {
document.pageform.submit();
});
return false;
}