toggle to send or not notifications

pull/12/head
Ludovic Marcotte 2013-06-18 14:14:42 -04:00
parent f25344182d
commit 47a3f1a19d
6 changed files with 44 additions and 8 deletions

1
NEWS
View File

@ -9,6 +9,7 @@ Enhancements
- new message submissions rate-limiting options. See the new - new message submissions rate-limiting options. See the new
SOGoMaximumMessageSubmissionCount, SOGoMaximumRecipientCount, SOGoMaximumMessageSubmissionCount, SOGoMaximumRecipientCount,
SOGoMaximumSubmissionInterval and SOGoMessageSubmissionBlockInterval defaults SOGoMaximumSubmissionInterval and SOGoMessageSubmissionBlockInterval defaults
- now possible to send or not event notifications on a per-event basis
Bug fixes Bug fixes
- Fixed decoding of the charset parameter when using single quotes (#2306) - Fixed decoding of the charset parameter when using single quotes (#2306)

View File

@ -760,6 +760,10 @@
SOGoUser *ownerUser; SOGoUser *ownerUser;
SOGoDomainDefaults *dd; SOGoDomainDefaults *dd;
// If defined, we return immediately. When not defined, we send the notifications correctly
if ([object firstChildWithTag: @"X-SOGo-Send-Appointment-Notifications"])
return;
ownerUser = [SOGoUser userWithLogin: owner]; ownerUser = [SOGoUser userWithLogin: owner];
dd = [ownerUser domainDefaults]; dd = [ownerUser domainDefaults];
if ([dd appointmentSendEMailNotifications] && [object isStillRelevant]) if ([dd appointmentSendEMailNotifications] && [object isStillRelevant])

View File

@ -373,6 +373,9 @@
"Show Time as Free" = "Show Time as Free"; "Show Time as Free" = "Show Time as Free";
/* email notifications */
"Send Appointment Notifications" = "Send Appointment Notifications";
/* validation errors */ /* validation errors */
validate_notitle = "No title is set, continue?"; validate_notitle = "No title is set, continue?";

View File

@ -1,8 +1,6 @@
/* UIxAppointmentEditor.h - this file is part of SOGo /* UIxAppointmentEditor.h - this file is part of SOGo
* *
* Copyright (C) 2007-2012 Inverse inc. * Copyright (C) 2007-2013 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,7 +29,7 @@
@interface UIxAppointmentEditor : UIxComponent @interface UIxAppointmentEditor : UIxComponent
{ {
iCalEvent *event; iCalEvent *event;
BOOL isAllDay, isTransparent; BOOL isAllDay, isTransparent, sendAppointmentNotifications;
NSCalendarDate *aptStartDate; NSCalendarDate *aptStartDate;
NSCalendarDate *aptEndDate; NSCalendarDate *aptEndDate;
NSString *item; NSString *item;
@ -50,6 +48,9 @@
- (void) setIsTransparent: (BOOL) newIsOpaque; - (void) setIsTransparent: (BOOL) newIsOpaque;
- (BOOL) isTransparent; - (BOOL) isTransparent;
- (void) setSendAppointmentNotifications: (BOOL) theBOOL;
- (BOOL) sendAppointmentNotifications;
- (void) setAptStartDate: (NSCalendarDate *) newAptStartDate; - (void) setAptStartDate: (NSCalendarDate *) newAptStartDate;
- (NSCalendarDate *) aptStartDate; - (NSCalendarDate *) aptStartDate;

View File

@ -2,9 +2,6 @@
* *
* Copyright (C) 2007-2013 Inverse inc. * Copyright (C) 2007-2013 Inverse inc.
* *
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Francis Lachapelle <flachapelle@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option) * the Free Software Foundation; either version 2, or (at your option)
@ -75,6 +72,7 @@
event = nil; event = nil;
isAllDay = NO; isAllDay = NO;
isTransparent = NO; isTransparent = NO;
sendAppointmentNotifications = YES;
componentCalendar = nil; componentCalendar = nil;
user = [[self context] activeUser]; user = [[self context] activeUser];
@ -139,6 +137,17 @@
isTransparent = newIsTransparent; isTransparent = newIsTransparent;
} }
- (void) setSendAppointmentNotifications: (BOOL) theBOOL
{
sendAppointmentNotifications = theBOOL;
}
- (BOOL) sendAppointmentNotifications
{
return sendAppointmentNotifications;
}
- (void) setAptStartDate: (NSCalendarDate *) newAptStartDate - (void) setAptStartDate: (NSCalendarDate *) newAptStartDate
{ {
ASSIGN (aptStartDate, newAptStartDate); ASSIGN (aptStartDate, newAptStartDate);
@ -279,6 +288,7 @@
endDate endDate
= [startDate dateByAddingYears: 0 months: 0 days: 0 = [startDate dateByAddingYears: 0 months: 0 days: 0
hours: hours minutes: minutes seconds: 0]; hours: hours minutes: minutes seconds: 0];
sendAppointmentNotifications = YES;
} }
else else
{ {
@ -296,7 +306,8 @@
endDate = [endDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 endDate = [endDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
seconds:-offset]; seconds:-offset];
} }
isTransparent = ![event isOpaque]; isTransparent = ![event isOpaque];
sendAppointmentNotifications = ([event firstChildWithTag: @"X-SOGo-Send-Appointment-Notifications"] ? NO : YES);
} }
[startDate setTimeZone: timeZone]; [startDate setTimeZone: timeZone];
@ -541,6 +552,7 @@
NSTimeZone *timeZone; NSTimeZone *timeZone;
SOGoUserDefaults *ud; SOGoUserDefaults *ud;
signed int offset; signed int offset;
id o;
[self event]; [self event];
[super takeValuesFromRequest: _rq inContext: _ctx]; [super takeValuesFromRequest: _rq inContext: _ctx];
@ -594,6 +606,14 @@
} }
[event setTransparency: (isTransparent? @"TRANSPARENT" : @"OPAQUE")]; [event setTransparency: (isTransparent? @"TRANSPARENT" : @"OPAQUE")];
o = [event firstChildWithTag: @"X-SOGo-Send-Appointment-Notifications"];
if (!sendAppointmentNotifications && !o)
[event addChild: [CardElement simpleElementWithTag: @"X-SOGo-Send-Appointment-Notifications" value: @"NO"]];
else if (sendAppointmentNotifications && o)
[event removeChild: o];
} }
- (id) _statusChangeAction: (NSString *) newStatus - (id) _statusChangeAction: (NSString *) newStatus

View File

@ -53,6 +53,13 @@
var:checked="isTransparent" var:checked="isTransparent"
/> <var:string label:value="Show Time as Free" /> <var:string label:value="Show Time as Free"
/></span></span></label> /></span></span></label>
<label><span class="content">
<span id="sendAppointmentNotifications"><input class="checkBox"
type="checkbox" name="sendAppointmentNotifications" var:selection="sendAppointmentNotifications"
var:checked="sendAppointmentNotifications"
/> <var:string label:value="Send Appointment Notifications"
/></span></span></label>
</var:if> </var:if>
<var:if condition="eventIsReadOnly"> <var:if condition="eventIsReadOnly">
<var:if condition="isAllDay"> <var:if condition="isAllDay">