mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-28 17:57:38 +00:00
Monotone-Parent: 14183e9d9367b240b6e0585031a87772c952285a
Monotone-Revision: 6550d093f75808cf03c8781a80f346a0cedf836a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-02-11T02:36:43 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -36,6 +36,7 @@ SchedulerUI_OBJC_FILES = \
|
||||
UIxAttendeesEditor.m \
|
||||
UIxComponentEditor.m \
|
||||
UIxCalendarSelector.m \
|
||||
UIxAppointmentActions.m \
|
||||
UIxAppointmentEditor.m \
|
||||
UIxTaskEditor.m \
|
||||
UIxDatePicker.m \
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
( { link = "#";
|
||||
isSafe = NO;
|
||||
label = "New Event";
|
||||
onclick = "return newEvent(this, 'event');";
|
||||
onclick = "return newEvent('event');";
|
||||
image = "new-event.png";
|
||||
tooltip = "Create a new event"; },
|
||||
{ link = "new_task";
|
||||
label="New Task";
|
||||
image = "new-task.png";
|
||||
onclick = "return newEvent(this, 'task');";
|
||||
onclick = "return newEvent('task');";
|
||||
image = "new-task.png";
|
||||
tooltip = "Create a new task"; } ),
|
||||
( { link = "today";
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/* UIxAppointmentActions.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef UIXAPPOINTMENTACTIONS_H
|
||||
#define UIXAPPOINTMENTACTIONS_H
|
||||
|
||||
#import <NGObjWeb/WODirectAction.h>
|
||||
|
||||
@interface UIxAppointmentActions : WODirectAction
|
||||
|
||||
@end
|
||||
|
||||
#endif /* UIXAPPOINTMENTACTIONS_H */
|
||||
@@ -0,0 +1,97 @@
|
||||
/* UIxAppointmentActions.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
|
||||
#import <NGCards/iCalEvent.h>
|
||||
|
||||
#import <SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
#import <Appointments/SOGoAppointmentObject.h>
|
||||
|
||||
#import <Common/WODirectAction+SOGo.h>
|
||||
|
||||
#import "UIxAppointmentActions.h"
|
||||
|
||||
@implementation UIxAppointmentActions
|
||||
|
||||
- (WOResponse *) adjustAction
|
||||
{
|
||||
WOResponse *response;
|
||||
WORequest *rq;
|
||||
SOGoAppointmentObject *co;
|
||||
iCalEvent *event;
|
||||
NSCalendarDate *start, *newStart, *end, *newEnd;
|
||||
NSTimeInterval newDuration;
|
||||
SOGoUserDefaults *ud;
|
||||
NSString *daysDelta, *startDelta, *durationDelta;
|
||||
NSTimeZone *tz;
|
||||
|
||||
rq = [context request];
|
||||
|
||||
daysDelta = [rq formValueForKey: @"days"];
|
||||
startDelta = [rq formValueForKey: @"start"];
|
||||
durationDelta = [rq formValueForKey: @"duration"];
|
||||
if ([daysDelta length] > 0
|
||||
|| [startDelta length] > 0 || [durationDelta length] > 0)
|
||||
{
|
||||
co = [self clientObject];
|
||||
event = (iCalEvent *) [[self clientObject] occurence];
|
||||
|
||||
ud = [[context activeUser] userDefaults];
|
||||
tz = [ud timeZone];
|
||||
start = [event startDate];
|
||||
[start setTimeZone: tz];
|
||||
|
||||
newStart = [start dateByAddingYears: 0 months: 0
|
||||
days: [daysDelta intValue]
|
||||
hours: 0 minutes: [startDelta intValue]
|
||||
seconds: 0];
|
||||
end = [event endDate];
|
||||
[end setTimeZone: tz];
|
||||
|
||||
newDuration = ([end timeIntervalSinceDate: start]
|
||||
+ [durationDelta intValue] * 60);
|
||||
newEnd = [newStart addTimeInterval: newDuration];
|
||||
|
||||
[event setStartDate: newStart];
|
||||
[event setEndDate: newEnd];
|
||||
[co saveComponent: event];
|
||||
|
||||
response = [self responseWith204];
|
||||
}
|
||||
else
|
||||
response
|
||||
= (WOResponse *) [NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"missing 'days', 'start' and/or 'duration' parameters"];
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -244,7 +244,7 @@
|
||||
NSCalendarDate *startDate, *endDate;
|
||||
NSString *duration;
|
||||
NSTimeZone *timeZone;
|
||||
unsigned int minutes;
|
||||
unsigned int total, hours, minutes;
|
||||
SOGoObject <SOGoComponentOccurence> *co;
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
@@ -258,14 +258,21 @@
|
||||
&& [co isKindOfClass: [SOGoCalendarComponent class]])
|
||||
{
|
||||
startDate = [self newStartDate];
|
||||
duration = [self queryParameterForKey:@"dur"];
|
||||
duration = [self queryParameterForKey:@"duration"];
|
||||
if ([duration length] > 0)
|
||||
minutes = [duration intValue];
|
||||
{
|
||||
total = [duration intValue];
|
||||
hours = total / 100;
|
||||
minutes = total % 100;
|
||||
}
|
||||
else
|
||||
minutes = 60;
|
||||
{
|
||||
hours = 1;
|
||||
minutes = 0;
|
||||
}
|
||||
endDate
|
||||
= [startDate dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: minutes seconds: 0];
|
||||
hours: hours minutes: minutes seconds: 0];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -143,9 +143,9 @@
|
||||
return hoursToDisplay;
|
||||
}
|
||||
|
||||
- (NSString *) currentHourLineClass
|
||||
- (NSString *) currentHourLineId
|
||||
{
|
||||
return [NSString stringWithFormat: @"hourLine hourLine%d", [currentTableHour intValue]];
|
||||
return [NSString stringWithFormat: @"hourLine%d", [currentTableHour intValue]];
|
||||
}
|
||||
|
||||
- (NSArray *) daysToDisplay
|
||||
|
||||
@@ -649,7 +649,7 @@ _userStateInEvent (NSArray *event)
|
||||
withNumber: (NSNumber *) number
|
||||
{
|
||||
int currentDayStart, startSecs, endsSecs, currentStart, eventStart,
|
||||
eventEnd, offset, recurrenceTime;
|
||||
eventEnd, offset, recurrenceTime, swap;
|
||||
NSMutableArray *currentDay;
|
||||
NSMutableDictionary *eventBlock;
|
||||
iCalPersonPartStat userState;
|
||||
@@ -667,8 +667,13 @@ _userStateInEvent (NSArray *event)
|
||||
else
|
||||
{
|
||||
if (eventEnd < eventStart)
|
||||
[self warnWithFormat: @"event '%@' has end < start: %d < %d",
|
||||
[event objectAtIndex: 0], eventEnd, eventStart];
|
||||
{
|
||||
swap = eventStart;
|
||||
eventStart = eventEnd;
|
||||
eventEnd = swap;
|
||||
[self warnWithFormat: @"event '%@' has end < start: %d < %d",
|
||||
[event objectAtIndex: 0], eventEnd, eventStart];
|
||||
}
|
||||
|
||||
startSecs = (unsigned int) [startDate timeIntervalSince1970];
|
||||
endsSecs = (unsigned int) [endDate timeIntervalSince1970];
|
||||
|
||||
@@ -87,6 +87,13 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) confirmAdjustmentAction
|
||||
{
|
||||
ASSIGN (action, @"adjust");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (WOResponse *) deleteAction
|
||||
{
|
||||
SOGoCalendarComponent *component;
|
||||
|
||||
@@ -232,9 +232,14 @@
|
||||
};
|
||||
delegate = {
|
||||
protectedBy = "RespondToComponent";
|
||||
actionClass = "UIxAppointmentEditor";
|
||||
pageName = "UIxAppointmentEditor";
|
||||
actionName = "delegate";
|
||||
};
|
||||
adjust = {
|
||||
protectedBy = "ModifyComponent";
|
||||
actionClass = "UIxAppointmentActions";
|
||||
actionName = "adjust";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -283,6 +288,11 @@
|
||||
protectedBy = "ViewAllComponent";
|
||||
pageName = "UIxOccurenceDialog";
|
||||
};
|
||||
confirmAdjustment = {
|
||||
protectedBy = "ViewAllComponent";
|
||||
pageName = "UIxOccurenceDialog";
|
||||
actionName = "confirmAdjustment";
|
||||
};
|
||||
confirmDeletion = {
|
||||
protectedBy = "Delete Object";
|
||||
pageName = "UIxOccurenceDialog";
|
||||
@@ -313,6 +323,11 @@
|
||||
pageName = "UIxOccurenceDialog";
|
||||
actionName = "delete";
|
||||
};
|
||||
adjust = {
|
||||
protectedBy = "ModifyComponent";
|
||||
actionClass = "UIxAppointmentActions";
|
||||
actionName = "adjust";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user