merge of '3cd11326bdc49c91494e0a2e9cf1465efe47c52e'
and 'bb3c592590664390a1256fac17d92ed09a9484d3' Monotone-Parent: 3cd11326bdc49c91494e0a2e9cf1465efe47c52e Monotone-Parent: bb3c592590664390a1256fac17d92ed09a9484d3 Monotone-Revision: 5f3a2eb80d68bf394630219bbb989256d30629cc Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-08-18T20:19:22 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
56a2b07c03
|
@ -1,3 +1,11 @@
|
||||||
|
2010-08-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Appointments/iCalEvent+SOGo.m (-quickRecord): we now
|
||||||
|
make use of the new -[iCalAlarm nextAlarmDate] method.
|
||||||
|
|
||||||
|
* SoObjects/Appointments/iCalToDo+SOGo.m (-quickRecord): we now
|
||||||
|
make use of the new -[iCalAlarm nextAlarmDate] method.
|
||||||
|
|
||||||
2010-08-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2010-08-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* UI/WebServerResources/MailerUIdTree.js: (getMailboxNode): fixed
|
* UI/WebServerResources/MailerUIdTree.js: (getMailboxNode): fixed
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2010-08-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* iCalAlarm.m (-nextAlarmDate): new utility method split from the
|
||||||
|
SOGo quick table extractor for events.
|
||||||
|
|
||||||
2010-08-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2010-08-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* NGVCardPhoto.m (-type): returns @"JPEG" if the type is
|
* NGVCardPhoto.m (-type): returns @"JPEG" if the type is
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
- (void) setRecurrenceRule: (NSString *) _recurrenceRule;
|
- (void) setRecurrenceRule: (NSString *) _recurrenceRule;
|
||||||
- (NSString *) recurrenceRule;
|
- (NSString *) recurrenceRule;
|
||||||
|
|
||||||
|
- (NSCalendarDate *) nextAlarmDate;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* __NGCards_iCalAlarm_H__ */
|
#endif /* __NGCards_iCalAlarm_H__ */
|
||||||
|
|
|
@ -20,10 +20,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
#import <NGExtensions/NSNull+misc.h>
|
||||||
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
|
||||||
#import "iCalAttachment.h"
|
#import "iCalAttachment.h"
|
||||||
|
#import "iCalEvent.h"
|
||||||
#import "iCalRecurrenceRule.h"
|
#import "iCalRecurrenceRule.h"
|
||||||
#import "iCalTrigger.h"
|
#import "iCalTrigger.h"
|
||||||
|
#import "iCalToDo.h"
|
||||||
|
#import "NSString+NGCards.h"
|
||||||
|
|
||||||
#import "iCalAlarm.h"
|
#import "iCalAlarm.h"
|
||||||
|
|
||||||
|
@ -103,4 +108,49 @@
|
||||||
return [[self uniqueChildWithTag: @"rrule"] value: 0];
|
return [[self uniqueChildWithTag: @"rrule"] value: 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSCalendarDate *) nextAlarmDate
|
||||||
|
{
|
||||||
|
Class parentClass;
|
||||||
|
iCalTrigger *aTrigger;
|
||||||
|
NSCalendarDate *relationDate, *nextAlarmDate;
|
||||||
|
NSString *relation;
|
||||||
|
NSTimeInterval anInterval;
|
||||||
|
|
||||||
|
// We currently have the following limitations for alarms:
|
||||||
|
// - the alarm's trigger value type must be DURATION;
|
||||||
|
|
||||||
|
nextAlarmDate = nil;
|
||||||
|
|
||||||
|
parentClass = [parent class];
|
||||||
|
if ([parentClass isKindOfClass: [iCalEvent class]]
|
||||||
|
|| [parentClass isKindOfClass: [iCalToDo class]])
|
||||||
|
{
|
||||||
|
aTrigger = [self trigger];
|
||||||
|
|
||||||
|
if ([[aTrigger valueType] caseInsensitiveCompare: @"DURATION"])
|
||||||
|
{
|
||||||
|
relation = [aTrigger relationType];
|
||||||
|
anInterval = [[aTrigger value] durationAsTimeInterval];
|
||||||
|
if ([relation caseInsensitiveCompare: @"END"] == NSOrderedSame)
|
||||||
|
{
|
||||||
|
if ([parentClass isKindOfClass: [iCalEvent class]])
|
||||||
|
relationDate = [(iCalEvent *) parent endDate];
|
||||||
|
else
|
||||||
|
relationDate = [(iCalToDo *) parent due];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
relationDate = [(iCalEntityObject *) parent startDate];
|
||||||
|
|
||||||
|
// Compute the next alarm date with respect to the reference date
|
||||||
|
if ([relationDate isNotNull])
|
||||||
|
nextAlarmDate = [relationDate addTimeInterval: anInterval];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
[self warnWithFormat: @"alarms not handled for elements of class '%@'",
|
||||||
|
NSStringFromClass (parentClass)];
|
||||||
|
|
||||||
|
return nextAlarmDate;
|
||||||
|
}
|
||||||
|
|
||||||
@end /* iCalAlarm */
|
@end /* iCalAlarm */
|
||||||
|
|
|
@ -77,7 +77,6 @@
|
||||||
|
|
||||||
startDate = [self startDate];
|
startDate = [self startDate];
|
||||||
endDate = [self endDate];
|
endDate = [self endDate];
|
||||||
nextAlarmDate = nil;
|
|
||||||
uid = [self uid];
|
uid = [self uid];
|
||||||
title = [self summary];
|
title = [self summary];
|
||||||
if (![title isNotNull])
|
if (![title isNotNull])
|
||||||
|
@ -203,46 +202,30 @@
|
||||||
[row setObject:partstates forKey: @"c_partstates"];
|
[row setObject:partstates forKey: @"c_partstates"];
|
||||||
[partstates release];
|
[partstates release];
|
||||||
|
|
||||||
if ([self hasAlarms])
|
nextAlarmDate = nil;
|
||||||
|
if (![self isRecurrent] && [self hasAlarms])
|
||||||
{
|
{
|
||||||
// We currently have the following limitations for alarms:
|
// We currently have the following limitations for alarms:
|
||||||
// - the event must not be recurrent;
|
// - the component must not be recurrent;
|
||||||
// - only the first alarm is considered;
|
// - only the first alarm is considered;
|
||||||
// - the alarm's action must be of type DISPLAY;
|
// - the alarm's action must be of type DISPLAY;
|
||||||
// - the alarm's trigger value type must be DURATION;
|
// - the alarm's trigger value type must be DURATION;
|
||||||
//
|
//
|
||||||
// Morever, we don't update the quick table if the property X-WebStatus
|
// Morever, we don't update the quick table if the property X-WebStatus
|
||||||
// of the trigger is set to "triggered".
|
// of the trigger is set to "triggered".
|
||||||
|
|
||||||
iCalAlarm *anAlarm;
|
iCalAlarm *anAlarm;
|
||||||
iCalTrigger *aTrigger;
|
NSString *webstatus;
|
||||||
NSCalendarDate *relationDate;
|
|
||||||
NSString *relation, *webstatus;
|
|
||||||
NSTimeInterval anInterval;
|
|
||||||
|
|
||||||
anAlarm = [[self alarms] objectAtIndex: 0];
|
anAlarm = [[self alarms] objectAtIndex: 0];
|
||||||
aTrigger = [anAlarm trigger];
|
if ([[anAlarm action] caseInsensitiveCompare: @"DISPLAY"]
|
||||||
relation = [aTrigger relationType];
|
== NSOrderedSame)
|
||||||
anInterval = [[aTrigger value] durationAsTimeInterval];
|
{
|
||||||
|
webstatus = [[anAlarm trigger] value: 0 ofAttribute: @"x-webstatus"];
|
||||||
if ([[anAlarm action] caseInsensitiveCompare: @"DISPLAY"] == NSOrderedSame &&
|
if (!webstatus
|
||||||
[[aTrigger valueType] caseInsensitiveCompare: @"DURATION"] == NSOrderedSame &&
|
|| ([webstatus caseInsensitiveCompare: @"TRIGGERED"]
|
||||||
![self isRecurrent])
|
!= NSOrderedSame))
|
||||||
{
|
nextAlarmDate = [anAlarm nextAlarmDate];
|
||||||
webstatus = [aTrigger value: 0 ofAttribute: @"x-webstatus"];
|
}
|
||||||
if (!webstatus ||
|
|
||||||
[webstatus caseInsensitiveCompare: @"TRIGGERED"] != NSOrderedSame)
|
|
||||||
{
|
|
||||||
if ([relation caseInsensitiveCompare: @"END"] == NSOrderedSame)
|
|
||||||
relationDate = endDate;
|
|
||||||
else
|
|
||||||
relationDate = startDate;
|
|
||||||
|
|
||||||
// Compute the next alarm date with respect to the reference date
|
|
||||||
if ([relationDate isNotNull])
|
|
||||||
nextAlarmDate = [relationDate addTimeInterval: anInterval];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ([nextAlarmDate isNotNull])
|
if ([nextAlarmDate isNotNull])
|
||||||
[row setObject: [NSNumber numberWithInt: [nextAlarmDate timeIntervalSince1970]]
|
[row setObject: [NSNumber numberWithInt: [nextAlarmDate timeIntervalSince1970]]
|
||||||
|
|
|
@ -171,39 +171,29 @@
|
||||||
[row setObject:partstates forKey: @"c_partstates"];
|
[row setObject:partstates forKey: @"c_partstates"];
|
||||||
[partstates release];
|
[partstates release];
|
||||||
|
|
||||||
if ([self hasAlarms])
|
nextAlarmDate = nil;
|
||||||
|
if (![self isRecurrent] && [self hasAlarms])
|
||||||
{
|
{
|
||||||
// We currently have the following limitations for alarms:
|
// We currently have the following limitations for alarms:
|
||||||
// - the component must not be recurrent;
|
// - the component must not be recurrent;
|
||||||
// - only the first alarm is considered;
|
// - only the first alarm is considered;
|
||||||
// - the alarm's action must be of type DISPLAY;
|
// - the alarm's action must be of type DISPLAY;
|
||||||
// - the alarm's trigger value type must be DURATION;
|
|
||||||
//
|
//
|
||||||
// Morever, we don't update the quick table if the property X-WebStatus
|
// Morever, we don't update the quick table if the property X-WebStatus
|
||||||
// of the trigger is set to "triggered".
|
// of the trigger is set to "triggered".
|
||||||
|
|
||||||
iCalAlarm *anAlarm;
|
iCalAlarm *anAlarm;
|
||||||
iCalTrigger *aTrigger;
|
|
||||||
NSString *webstatus;
|
NSString *webstatus;
|
||||||
NSTimeInterval anInterval;
|
|
||||||
|
|
||||||
anAlarm = [[self alarms] objectAtIndex: 0];
|
anAlarm = [[self alarms] objectAtIndex: 0];
|
||||||
aTrigger = [anAlarm trigger];
|
if ([[anAlarm action] caseInsensitiveCompare: @"DISPLAY"]
|
||||||
anInterval = [[aTrigger value] durationAsTimeInterval];
|
== NSOrderedSame)
|
||||||
|
{
|
||||||
if ([[anAlarm action] caseInsensitiveCompare: @"DISPLAY"] == NSOrderedSame &&
|
webstatus = [[anAlarm trigger] value: 0 ofAttribute: @"x-webstatus"];
|
||||||
[[aTrigger valueType] caseInsensitiveCompare: @"DURATION"] == NSOrderedSame &&
|
if (!webstatus
|
||||||
![self isRecurrent])
|
|| ([webstatus caseInsensitiveCompare: @"TRIGGERED"]
|
||||||
{
|
!= NSOrderedSame))
|
||||||
webstatus = [aTrigger value: 0 ofAttribute: @"x-webstatus"];
|
nextAlarmDate = [anAlarm nextAlarmDate];
|
||||||
if (!webstatus ||
|
}
|
||||||
[webstatus caseInsensitiveCompare: @"TRIGGERED"] != NSOrderedSame)
|
|
||||||
{
|
|
||||||
// Compute the next alarm date with respect to the due date
|
|
||||||
if ([dueDate isNotNull])
|
|
||||||
nextAlarmDate = [dueDate addTimeInterval: anInterval];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ([nextAlarmDate isNotNull])
|
if ([nextAlarmDate isNotNull])
|
||||||
[row setObject: [NSNumber numberWithInt: [nextAlarmDate timeIntervalSince1970]]
|
[row setObject: [NSNumber numberWithInt: [nextAlarmDate timeIntervalSince1970]]
|
||||||
|
|
|
@ -1,45 +1,43 @@
|
||||||
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
|
|
||||||
function initializeWindowButtons() {
|
function initializeWindowButtons() {
|
||||||
var okButton = $("okButton");
|
var okButton = $("okButton");
|
||||||
var cancelButton = $("cancelButton");
|
var cancelButton = $("cancelButton");
|
||||||
|
|
||||||
okButton.observe("click", onEditorOkClick, false);
|
okButton.observe("click", onEditorOkClick, false);
|
||||||
cancelButton.observe("click", onEditorCancelClick, false);
|
cancelButton.observe("click", onEditorCancelClick, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function initializeFormValues() {
|
function initializeFormValues() {
|
||||||
if (parent$("reminderUnit").value.length > 0) {
|
if (parent$("reminderUnit").value.length > 0) {
|
||||||
$("quantityField").value = parent$("reminderQuantity").value;
|
$("quantityField").value = parent$("reminderQuantity").value;
|
||||||
$("unitsList").value = parent$("reminderUnit").value;
|
$("unitsList").value = parent$("reminderUnit").value;
|
||||||
$("relationsList").value = parent$("reminderRelation").value;
|
$("relationsList").value = parent$("reminderRelation").value;
|
||||||
$("referencesList").value = parent$("reminderReference").value;
|
$("referencesList").value = parent$("reminderReference").value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEditorOkClick(event) {
|
function onEditorOkClick(event) {
|
||||||
preventDefault(event);
|
preventDefault(event);
|
||||||
if (parseInt($("quantityField").value) > 0) {
|
if (parseInt($("quantityField").value) > 0) {
|
||||||
parent$("reminderQuantity").value = parseInt($("quantityField").value);
|
parent$("reminderQuantity").value = parseInt($("quantityField").value);
|
||||||
parent$("reminderUnit").value = $("unitsList").value;
|
parent$("reminderUnit").value = $("unitsList").value;
|
||||||
parent$("reminderRelation").value = $("relationsList").value;
|
parent$("reminderRelation").value = $("relationsList").value;
|
||||||
parent$("reminderReference").value = $("referencesList").value;
|
parent$("reminderReference").value = $("referencesList").value;
|
||||||
|
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
alert("heu");
|
alert("heu");
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEditorCancelClick(event) {
|
function onEditorCancelClick(event) {
|
||||||
preventDefault(event);
|
preventDefault(event);
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRecurrenceLoadHandler() {
|
function onRecurrenceLoadHandler() {
|
||||||
initializeFormValues();
|
initializeFormValues();
|
||||||
initializeWindowButtons();
|
initializeWindowButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.observe("dom:loaded", onRecurrenceLoadHandler);
|
document.observe("dom:loaded", onRecurrenceLoadHandler);
|
||||||
|
|
Loading…
Reference in a new issue