2006-10-18 16:42:44 +02:00
|
|
|
/* UIxComponentEditor.m - this file is part of SOGo
|
|
|
|
*
|
2015-01-22 22:25:16 +01:00
|
|
|
* Copyright (C) 2006-2015 Inverse inc.
|
2006-10-18 16:42:44 +02:00
|
|
|
*
|
|
|
|
* 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/NSArray.h>
|
|
|
|
#import <Foundation/NSBundle.h>
|
2008-07-04 18:06:09 +02:00
|
|
|
#import <Foundation/NSEnumerator.h>
|
2006-10-18 16:42:44 +02:00
|
|
|
#import <Foundation/NSException.h>
|
|
|
|
#import <Foundation/NSCalendarDate.h>
|
2007-04-11 21:38:06 +02:00
|
|
|
#import <Foundation/NSKeyValueCoding.h>
|
2006-10-18 16:42:44 +02:00
|
|
|
#import <Foundation/NSString.h>
|
2009-07-27 14:48:27 +02:00
|
|
|
#import <Foundation/NSValue.h>
|
2006-10-23 23:34:56 +02:00
|
|
|
#import <Foundation/NSURL.h>
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2009-04-21 16:34:22 +02:00
|
|
|
#import <NGCards/iCalAlarm.h>
|
2010-04-19 23:05:35 +02:00
|
|
|
#import <NGCards/iCalByDayMask.h>
|
2014-09-12 14:34:15 +02:00
|
|
|
#import <NGCards/iCalDateTime.h>
|
|
|
|
#import <NGCards/iCalEvent.h>
|
2006-10-18 16:42:44 +02:00
|
|
|
#import <NGCards/iCalPerson.h>
|
|
|
|
#import <NGCards/iCalRepeatableEntityObject.h>
|
|
|
|
#import <NGCards/iCalRecurrenceRule.h>
|
2014-09-12 14:34:15 +02:00
|
|
|
#import <NGCards/iCalToDo.h>
|
2009-04-21 16:34:22 +02:00
|
|
|
#import <NGCards/iCalTrigger.h>
|
2014-09-12 14:34:15 +02:00
|
|
|
|
2006-10-18 16:42:44 +02:00
|
|
|
#import <NGCards/NSString+NGCards.h>
|
|
|
|
#import <NGCards/NSCalendarDate+NGCards.h>
|
2007-06-01 23:01:44 +02:00
|
|
|
#import <NGObjWeb/SoSecurityManager.h>
|
|
|
|
#import <NGObjWeb/NSException+HTTP.h>
|
2009-01-07 19:32:24 +01:00
|
|
|
#import <NGObjWeb/WOApplication.h>
|
2007-06-01 23:01:44 +02:00
|
|
|
#import <NGObjWeb/WORequest.h>
|
2012-10-22 16:09:13 +02:00
|
|
|
#import <NGObjWeb/WOResponse.h>
|
2006-10-18 16:42:44 +02:00
|
|
|
#import <NGExtensions/NSCalendarDate+misc.h>
|
|
|
|
#import <NGExtensions/NSObject+Logs.h>
|
2014-09-12 14:34:15 +02:00
|
|
|
#import <NGExtensions/NSNull+misc.h>
|
2006-10-18 16:42:44 +02:00
|
|
|
#import <NGExtensions/NSString+misc.h>
|
|
|
|
|
2014-12-16 15:20:27 +01:00
|
|
|
#import <Appointments/iCalAlarm+SOGo.h>
|
2009-11-19 17:49:45 +01:00
|
|
|
#import <Appointments/iCalEntityObject+SOGo.h>
|
|
|
|
#import <Appointments/iCalPerson+SOGo.h>
|
|
|
|
#import <Appointments/SOGoAppointmentFolder.h>
|
|
|
|
#import <Appointments/SOGoWebAppointmentFolder.h>
|
|
|
|
#import <Appointments/SOGoAppointmentFolders.h>
|
|
|
|
#import <Appointments/SOGoAppointmentObject.h>
|
|
|
|
#import <Appointments/SOGoAppointmentOccurence.h>
|
|
|
|
#import <Appointments/SOGoTaskObject.h>
|
|
|
|
#import <SOGo/NSArray+Utilities.h>
|
|
|
|
#import <SOGo/NSDictionary+Utilities.h>
|
|
|
|
#import <SOGo/NSString+Utilities.h>
|
|
|
|
#import <SOGo/SOGoUser.h>
|
2009-11-29 05:19:32 +01:00
|
|
|
#import <SOGo/SOGoUserDefaults.h>
|
2015-02-12 21:01:26 +01:00
|
|
|
#import <SOGo/SOGoUserManager.h>
|
|
|
|
#import <SOGo/SOGoSource.h>
|
|
|
|
#import <SOGo/SOGoPermissions.h>
|
|
|
|
#import <SOGo/SOGoSystemDefaults.h>
|
|
|
|
#import <SOGo/WOResourceManager+SOGo.h>
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
#import "../../Main/SOGo.h"
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
#import "UIxComponentEditor.h"
|
|
|
|
#import "UIxDatePicker.h"
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-08-05 22:44:25 +02:00
|
|
|
#define componentReadableWritable 0
|
|
|
|
#define componentOwnerIsInvited 1
|
|
|
|
#define componentReadableOnly 2
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
static NSArray *reminderItems = nil;
|
|
|
|
static NSArray *reminderValues = nil;
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
@implementation UIxComponentEditor
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
+ (void) initialize
|
2006-10-18 16:42:44 +02:00
|
|
|
{
|
2015-02-12 21:01:26 +01:00
|
|
|
if (!reminderItems && !reminderValues)
|
|
|
|
{
|
|
|
|
reminderItems = [NSArray arrayWithObjects:
|
|
|
|
@"5_MINUTES_BEFORE",
|
|
|
|
@"10_MINUTES_BEFORE",
|
|
|
|
@"15_MINUTES_BEFORE",
|
|
|
|
@"30_MINUTES_BEFORE",
|
|
|
|
@"45_MINUTES_BEFORE",
|
|
|
|
@"-",
|
|
|
|
@"1_HOUR_BEFORE",
|
|
|
|
@"2_HOURS_BEFORE",
|
|
|
|
@"5_HOURS_BEFORE",
|
|
|
|
@"15_HOURS_BEFORE",
|
|
|
|
@"-",
|
|
|
|
@"1_DAY_BEFORE",
|
|
|
|
@"2_DAYS_BEFORE",
|
|
|
|
@"1_WEEK_BEFORE",
|
|
|
|
@"-",
|
|
|
|
@"CUSTOM",
|
|
|
|
nil];
|
|
|
|
reminderValues = [NSArray arrayWithObjects:
|
|
|
|
@"-PT5M",
|
|
|
|
@"-PT10M",
|
|
|
|
@"-PT15M",
|
|
|
|
@"-PT30M",
|
|
|
|
@"-PT45M",
|
|
|
|
@"",
|
|
|
|
@"-PT1H",
|
|
|
|
@"-PT2H",
|
|
|
|
@"-PT5H",
|
|
|
|
@"-PT15H",
|
|
|
|
@"",
|
|
|
|
@"-P1D",
|
|
|
|
@"-P2D",
|
|
|
|
@"-P1W",
|
|
|
|
@"",
|
|
|
|
@"",
|
|
|
|
nil];
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
[reminderItems retain];
|
|
|
|
[reminderValues retain];
|
|
|
|
}
|
2006-10-18 16:42:44 +02:00
|
|
|
}
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
- (id) init
|
2006-10-18 16:42:44 +02:00
|
|
|
{
|
2015-02-12 21:01:26 +01:00
|
|
|
if ((self = [super init]))
|
|
|
|
{
|
|
|
|
component = nil;
|
|
|
|
componentCalendar = nil;
|
|
|
|
}
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
return self;
|
2006-10-18 16:42:44 +02:00
|
|
|
}
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
- (void) dealloc
|
2006-10-18 16:42:44 +02:00
|
|
|
{
|
2015-02-12 21:01:26 +01:00
|
|
|
[component release];
|
|
|
|
[componentCalendar release];
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
[super dealloc];
|
2006-10-18 16:42:44 +02:00
|
|
|
}
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
- (void) setClientObject: (id)_client
|
2006-10-18 16:42:44 +02:00
|
|
|
{
|
2015-02-12 21:01:26 +01:00
|
|
|
[super setClientObject: _client]; // WOComponent+SoObjects
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
component = [[self clientObject] occurence];
|
|
|
|
[[component parent] retain];
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
componentCalendar = [[self clientObject] container];
|
|
|
|
if ([componentCalendar isKindOfClass: [SOGoCalendarComponent class]])
|
|
|
|
componentCalendar = [componentCalendar container];
|
|
|
|
[componentCalendar retain];
|
2006-10-18 16:42:44 +02:00
|
|
|
}
|
|
|
|
|
2015-07-27 22:02:05 +02:00
|
|
|
- (BOOL) isChildOccurrence
|
|
|
|
{
|
|
|
|
return [[self clientObject] isKindOfClass: [SOGoComponentOccurence class]];
|
|
|
|
}
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
//- (NSString *) title
|
|
|
|
//{
|
|
|
|
// SOGoCalendarComponent *co;
|
|
|
|
// NSString *tag;
|
|
|
|
//
|
|
|
|
// co = [self clientObject];
|
|
|
|
// if ([co isNew] && [co isKindOfClass: [SOGoCalendarComponent class]])
|
|
|
|
// {
|
|
|
|
// tag = [co componentTag];
|
|
|
|
// if ([tag isEqualToString: @"vevent"])
|
|
|
|
// [self setTitle: [self labelForKey: @"New Event"]];
|
|
|
|
// else if ([tag isEqualToString: @"vtodo"])
|
|
|
|
// [self setTitle: [self labelForKey: @"New Task"]];
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return title;
|
|
|
|
//}
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
// - (BOOL) canBeOrganizer
|
|
|
|
// {
|
|
|
|
// NSString *owner;
|
|
|
|
// SOGoObject <SOGoComponentOccurence> *co;
|
|
|
|
// SOGoUser *currentUser;
|
|
|
|
// BOOL hasOrganizer;
|
|
|
|
// SoSecurityManager *sm;
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
// co = [self clientObject];
|
|
|
|
// owner = [co ownerInContext: context];
|
|
|
|
// currentUser = [context activeUser];
|
2008-01-14 14:57:28 +01:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
// hasOrganizer = ([[organizer value: 0] length] > 0);
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
// sm = [SoSecurityManager sharedSecurityManager];
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
// return ([co isNew]
|
|
|
|
// || (([owner isEqualToString: [currentUser login]]
|
|
|
|
// || ![sm validatePermission: SOGoCalendarPerm_ModifyComponent
|
|
|
|
// onObject: co
|
|
|
|
// inContext: context])
|
|
|
|
// && (!hasOrganizer || [component userIsOrganizer: currentUser])));
|
|
|
|
// }
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
//- (void) setOrganizerIdentity: (NSDictionary *) newOrganizerIdentity
|
|
|
|
//{
|
|
|
|
// ASSIGN (organizerIdentity, newOrganizerIdentity);
|
|
|
|
//}
|
|
|
|
|
|
|
|
// - (NSDictionary *) organizerIdentity
|
|
|
|
// {
|
|
|
|
// NSArray *allIdentities;
|
|
|
|
// NSEnumerator *identities;
|
|
|
|
// NSDictionary *currentIdentity;
|
|
|
|
// NSString *orgEmail;
|
|
|
|
|
|
|
|
// orgEmail = [organizer rfc822Email];
|
|
|
|
// if (!organizerIdentity)
|
|
|
|
// {
|
|
|
|
// if ([orgEmail length])
|
|
|
|
// {
|
|
|
|
// allIdentities = [[context activeUser] allIdentities];
|
|
|
|
// identities = [allIdentities objectEnumerator];
|
|
|
|
// while (!organizerIdentity
|
|
|
|
// && ((currentIdentity = [identities nextObject])))
|
|
|
|
// if ([[currentIdentity objectForKey: @"email"]
|
|
|
|
// caseInsensitiveCompare: orgEmail]
|
|
|
|
// == NSOrderedSame)
|
|
|
|
// ASSIGN (organizerIdentity, currentIdentity);
|
|
|
|
// }
|
|
|
|
// }
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
// return organizerIdentity;
|
|
|
|
// }
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
//- (void) setComment: (NSString *) _value
|
|
|
|
//{
|
|
|
|
//#warning should we do the same for "location" and "summary"? What about ContactsUI?
|
|
|
|
// ASSIGN (comment, [_value stringByReplacingString: @"\r\n" withString: @"\n"]);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//- (NSString *) comment
|
|
|
|
//{
|
|
|
|
// return [comment stringByReplacingString: @"\n" withString: @"\r\n"];
|
|
|
|
//}
|
|
|
|
|
|
|
|
//- (NSString *) reminder
|
|
|
|
//{
|
|
|
|
// if ([[self clientObject] isNew])
|
|
|
|
// {
|
|
|
|
// NSString *value;
|
|
|
|
// NSUInteger index;
|
|
|
|
//
|
|
|
|
// value = [userDefaults calendarDefaultReminder];
|
|
|
|
// index = [reminderValues indexOfObject: value];
|
|
|
|
//
|
|
|
|
// if (index != NSNotFound)
|
|
|
|
// return [reminderItems objectAtIndex: index];
|
|
|
|
//
|
|
|
|
// return @"NONE";
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return reminder;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//- (NSString *) itemReminderText
|
|
|
|
//{
|
|
|
|
// NSString *text;
|
|
|
|
//
|
|
|
|
// if ([item isEqualToString: @"-"])
|
|
|
|
// text = item;
|
|
|
|
// else
|
|
|
|
// text = [self labelForKey: [NSString stringWithFormat: @"reminder_%@", item]];
|
|
|
|
//
|
|
|
|
// return text;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//- (NSString *) itemReplyText
|
|
|
|
//{
|
|
|
|
// NSString *word;
|
|
|
|
//
|
|
|
|
// switch ([item intValue])
|
|
|
|
// {
|
|
|
|
// case iCalPersonPartStatAccepted:
|
|
|
|
// word = @"ACCEPTED";
|
|
|
|
// break;
|
|
|
|
// case iCalPersonPartStatDeclined:
|
|
|
|
// word = @"DECLINED";
|
|
|
|
// break;
|
|
|
|
// case iCalPersonPartStatNeedsAction:
|
|
|
|
// word = @"NEEDS-ACTION";
|
|
|
|
// break;
|
|
|
|
// case iCalPersonPartStatTentative:
|
|
|
|
// word = @"TENTATIVE";
|
|
|
|
// break;
|
|
|
|
// case iCalPersonPartStatDelegated:
|
|
|
|
// word = @"DELEGATED";
|
|
|
|
// break;
|
|
|
|
// default:
|
|
|
|
// word = @"UNKNOWN";
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return [self labelForKey: [NSString stringWithFormat: @"partStat_%@", word]];
|
|
|
|
//}
|
|
|
|
|
|
|
|
//- (NSArray *) replyList
|
|
|
|
//{
|
|
|
|
// return [NSArray arrayWithObjects:
|
|
|
|
// [NSNumber numberWithInt: iCalPersonPartStatAccepted],
|
|
|
|
// [NSNumber numberWithInt: iCalPersonPartStatDeclined],
|
|
|
|
// [NSNumber numberWithInt: iCalPersonPartStatNeedsAction],
|
|
|
|
// [NSNumber numberWithInt: iCalPersonPartStatTentative],
|
|
|
|
// [NSNumber numberWithInt: iCalPersonPartStatDelegated],
|
|
|
|
// nil];
|
|
|
|
//}
|
|
|
|
//
|
2015-08-05 22:44:25 +02:00
|
|
|
- (NSNumber *) reply
|
|
|
|
{
|
|
|
|
NSString *owner, *ownerEmail;
|
|
|
|
SOGoUserManager *um;
|
|
|
|
iCalPerson *ownerAsAttendee;
|
|
|
|
iCalPersonPartStat participationStatus;
|
|
|
|
|
|
|
|
um = [SOGoUserManager sharedUserManager];
|
|
|
|
owner = [componentCalendar ownerInContext: context];
|
|
|
|
ownerEmail = [um getEmailForUID: owner];
|
|
|
|
ownerAsAttendee = [component findAttendeeWithEmail: (id)ownerEmail];
|
|
|
|
participationStatus = [ownerAsAttendee participationStatus];
|
|
|
|
|
|
|
|
return [NSNumber numberWithInt: participationStatus];
|
|
|
|
}
|
2015-02-12 21:01:26 +01:00
|
|
|
|
|
|
|
///* priorities */
|
|
|
|
//
|
|
|
|
//- (NSArray *) priorities
|
|
|
|
//{
|
|
|
|
// /* 0 == undefined
|
|
|
|
// 9 == low
|
|
|
|
// 5 == medium
|
|
|
|
// 1 == high
|
|
|
|
// */
|
|
|
|
// static NSArray *priorities = nil;
|
|
|
|
//
|
|
|
|
// if (!priorities)
|
|
|
|
// {
|
|
|
|
// priorities = [NSArray arrayWithObjects: @"9", @"5", @"1", nil];
|
|
|
|
// [priorities retain];
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return priorities;
|
|
|
|
//}
|
|
|
|
|
|
|
|
/* helpers */
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
//- (BOOL) isWriteableClientObject
|
|
|
|
//{
|
|
|
|
// return [[self clientObject]
|
|
|
|
// respondsToSelector: @selector(saveCompontent:)];
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
///* access */
|
|
|
|
//
|
|
|
|
//- (BOOL) canEditComponent
|
|
|
|
//{
|
|
|
|
// return ([[context activeUser] hasEmail: [organizer rfc822Email]]);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
///* response generation */
|
|
|
|
//
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2007-04-17 15:49:23 +02:00
|
|
|
// - (NSString *) iCalParticipantsAndResourcesStringFromQueryParameters
|
|
|
|
// {
|
|
|
|
// NSString *s;
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2007-04-17 15:49:23 +02:00
|
|
|
// s = [self iCalParticipantsStringFromQueryParameters];
|
|
|
|
// return [s stringByAppendingString:
|
|
|
|
// [self iCalResourcesStringFromQueryParameters]];
|
|
|
|
// }
|
|
|
|
|
|
|
|
// - (NSString *) iCalParticipantsStringFromQueryParameters
|
|
|
|
// {
|
|
|
|
// static NSString *iCalParticipantString = @"ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=\"%@\":MAILTO:%@\r\n";
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2007-04-17 15:49:23 +02:00
|
|
|
// return [self iCalStringFromQueryParameter: @"ps"
|
|
|
|
// format: iCalParticipantString];
|
|
|
|
// }
|
|
|
|
|
|
|
|
// - (NSString *) iCalResourcesStringFromQueryParameters
|
|
|
|
// {
|
|
|
|
// static NSString *iCalResourceString = @"ATTENDEE;ROLE=NON-PARTICIPANT;CN=\"%@\":MAILTO:%@\r\n";
|
|
|
|
|
|
|
|
// return [self iCalStringFromQueryParameter: @"rs"
|
|
|
|
// format: iCalResourceString];
|
|
|
|
// }
|
|
|
|
|
|
|
|
// - (NSString *) iCalStringFromQueryParameter: (NSString *) _qp
|
|
|
|
// format: (NSString *) _format
|
|
|
|
// {
|
2008-07-25 19:52:49 +02:00
|
|
|
// LDAPUserManager *um;
|
2007-04-17 15:49:23 +02:00
|
|
|
// NSMutableString *iCalRep;
|
|
|
|
// NSString *s;
|
|
|
|
|
2008-07-25 19:52:49 +02:00
|
|
|
// um = [LDAPUserManager sharedUserManager];
|
2007-04-17 15:49:23 +02:00
|
|
|
// iCalRep = (NSMutableString *)[NSMutableString string];
|
|
|
|
// s = [self queryParameterForKey:_qp];
|
|
|
|
// if(s && [s length] > 0) {
|
|
|
|
// NSArray *es;
|
2012-05-29 20:56:15 +02:00
|
|
|
// NSUInteger i, count;
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2007-04-17 15:49:23 +02:00
|
|
|
// es = [s componentsSeparatedByString: @","];
|
|
|
|
// count = [es count];
|
|
|
|
// for(i = 0; i < count; i++) {
|
|
|
|
// NSString *email, *cn;
|
2006-10-18 16:42:44 +02:00
|
|
|
|
2007-04-17 15:49:23 +02:00
|
|
|
// email = [es objectAtIndex:i];
|
|
|
|
// cn = [um getCNForUID:[um getUIDForEmail:email]];
|
|
|
|
// [iCalRep appendFormat:_format, cn, email];
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return iCalRep;
|
|
|
|
// }
|
2006-10-18 16:42:44 +02:00
|
|
|
|
|
|
|
/* contact editor compatibility */
|
|
|
|
|
2009-07-07 23:17:43 +02:00
|
|
|
/*- (NSString *) urlButtonClasses
|
2006-10-23 23:34:56 +02:00
|
|
|
{
|
|
|
|
NSString *classes;
|
|
|
|
|
|
|
|
if ([url length])
|
|
|
|
classes = @"button";
|
|
|
|
else
|
|
|
|
classes = @"button _disabled";
|
|
|
|
|
|
|
|
return classes;
|
2015-02-12 21:01:26 +01:00
|
|
|
}*/
|
2006-10-23 23:34:56 +02:00
|
|
|
|
2007-03-18 16:20:38 +01:00
|
|
|
- (void) _handleAttendeesEdition
|
2006-11-07 19:15:29 +01:00
|
|
|
{
|
2007-03-18 16:20:38 +01:00
|
|
|
NSMutableArray *newAttendees;
|
2012-05-29 20:56:15 +02:00
|
|
|
NSUInteger count, max;
|
2007-03-18 16:20:38 +01:00
|
|
|
NSString *currentEmail;
|
|
|
|
iCalPerson *currentAttendee;
|
2010-05-05 16:40:53 +02:00
|
|
|
NSString *json, *role, *partstat;
|
2009-09-10 20:31:20 +02:00
|
|
|
NSDictionary *attendeesData;
|
|
|
|
NSArray *attendees;
|
|
|
|
NSDictionary *currentData;
|
|
|
|
WORequest *request;
|
|
|
|
|
|
|
|
request = [context request];
|
|
|
|
json = [request formValueForKey: @"attendees"];
|
2009-11-10 17:18:57 +01:00
|
|
|
if ([json length])
|
2006-11-07 19:15:29 +01:00
|
|
|
{
|
2009-11-10 17:18:57 +01:00
|
|
|
attendees = [NSArray array];
|
2010-10-26 20:20:46 +02:00
|
|
|
attendeesData = [json objectFromJSONString];
|
|
|
|
if (attendeesData && [attendeesData isKindOfClass: [NSDictionary class]])
|
2007-03-19 15:33:33 +01:00
|
|
|
{
|
2009-11-16 16:01:54 +01:00
|
|
|
newAttendees = [NSMutableArray array];
|
2009-11-10 17:18:57 +01:00
|
|
|
attendees = [attendeesData allValues];
|
|
|
|
max = [attendees count];
|
|
|
|
for (count = 0; count < max; count++)
|
2007-03-19 15:33:33 +01:00
|
|
|
{
|
2009-11-10 17:18:57 +01:00
|
|
|
currentData = [attendees objectAtIndex: count];
|
|
|
|
currentEmail = [currentData objectForKey: @"email"];
|
2012-10-18 17:51:23 +02:00
|
|
|
if ([currentEmail length] > 0)
|
2010-05-05 16:40:53 +02:00
|
|
|
{
|
2012-10-18 17:51:23 +02:00
|
|
|
role = [[currentData objectForKey: @"role"] uppercaseString];
|
|
|
|
if (!role)
|
|
|
|
role = @"REQ-PARTICIPANT";
|
|
|
|
if ([role isEqualToString: @"NON-PARTICIPANT"])
|
|
|
|
partstat = @"";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
partstat = [[currentData objectForKey: @"partstat"]
|
|
|
|
uppercaseString];
|
|
|
|
if (!partstat)
|
|
|
|
partstat = @"NEEDS-ACTION";
|
|
|
|
}
|
|
|
|
currentAttendee = [component findAttendeeWithEmail: currentEmail];
|
|
|
|
if (!currentAttendee)
|
|
|
|
{
|
|
|
|
currentAttendee = [iCalPerson elementWithTag: @"attendee"];
|
|
|
|
[currentAttendee setCn: [currentData objectForKey: @"name"]];
|
|
|
|
[currentAttendee setEmail: currentEmail];
|
|
|
|
// [currentAttendee
|
|
|
|
// setParticipationStatus: iCalPersonPartStatNeedsAction];
|
|
|
|
}
|
|
|
|
[currentAttendee
|
2010-05-05 16:40:53 +02:00
|
|
|
setRsvp: ([role isEqualToString: @"NON-PARTICIPANT"]
|
|
|
|
? @"FALSE"
|
|
|
|
: @"TRUE")];
|
2012-10-18 17:51:23 +02:00
|
|
|
[currentAttendee setRole: role];
|
|
|
|
[currentAttendee setPartStat: partstat];
|
|
|
|
[newAttendees addObject: currentAttendee];
|
|
|
|
}
|
2007-03-19 15:33:33 +01:00
|
|
|
}
|
2009-11-10 17:18:57 +01:00
|
|
|
[component setAttendees: newAttendees];
|
2007-03-19 15:33:33 +01:00
|
|
|
}
|
2009-11-10 17:18:57 +01:00
|
|
|
else
|
2015-01-22 22:25:16 +01:00
|
|
|
{
|
|
|
|
//NSLog(@"Error scanning following JSON:\n%@", json);
|
|
|
|
}
|
2006-11-07 20:24:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-19 15:33:33 +01:00
|
|
|
- (void) _handleOrganizer
|
|
|
|
{
|
2013-06-19 16:23:47 +02:00
|
|
|
NSString *owner, *login, *currentEmail;
|
2015-02-12 21:01:26 +01:00
|
|
|
iCalPerson *organizer;
|
|
|
|
BOOL isOwner;
|
2007-03-19 15:33:33 +01:00
|
|
|
|
2008-11-05 22:04:16 +01:00
|
|
|
//owner = [[self clientObject] ownerInContext: context];
|
|
|
|
owner = [componentCalendar ownerInContext: context];
|
2007-12-07 23:40:21 +01:00
|
|
|
login = [[context activeUser] login];
|
|
|
|
isOwner = [owner isEqualToString: login];
|
2013-06-19 16:23:47 +02:00
|
|
|
currentEmail = [[[context activeUser] allEmails] objectAtIndex: 0];
|
2007-12-07 23:40:21 +01:00
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
if ([[component attendees] count] > 0)
|
2008-11-05 22:04:16 +01:00
|
|
|
{
|
|
|
|
SOGoUser *user;
|
|
|
|
id identity;
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
organizer = [iCalPerson elementWithTag: @"organizer"];
|
2009-08-11 04:06:27 +02:00
|
|
|
[component setOrganizer: organizer];
|
|
|
|
|
2008-11-05 22:04:16 +01:00
|
|
|
user = [SOGoUser userWithLogin: owner roles: nil];
|
|
|
|
identity = [user defaultIdentity];
|
|
|
|
[organizer setCn: [identity objectForKey: @"fullName"]];
|
|
|
|
[organizer setEmail: [identity objectForKey: @"email"]];
|
|
|
|
|
|
|
|
if (!isOwner)
|
2015-02-12 21:01:26 +01:00
|
|
|
{
|
|
|
|
NSString *quotedEmail;
|
2008-11-05 22:04:16 +01:00
|
|
|
|
2009-08-11 18:52:10 +02:00
|
|
|
quotedEmail = [NSString stringWithFormat: @"\"MAILTO:%@\"",
|
|
|
|
currentEmail];
|
|
|
|
[organizer setValue: 0 ofAttribute: @"SENT-BY"
|
|
|
|
to: quotedEmail];
|
2015-02-12 21:01:26 +01:00
|
|
|
}
|
2008-11-05 22:04:16 +01:00
|
|
|
}
|
2009-08-11 04:06:27 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
organizer = nil;
|
|
|
|
}
|
|
|
|
[component setOrganizer: organizer];
|
2013-06-19 16:23:47 +02:00
|
|
|
|
|
|
|
// In case of a new component, if the current user isn't the owner of the calendar, we
|
|
|
|
// add the "X-SOGo-Component-Created-By: <email address>" attribute
|
|
|
|
if ([[self clientObject] isNew] &&
|
|
|
|
!isOwner &&
|
|
|
|
[currentEmail length])
|
2007-03-19 15:33:33 +01:00
|
|
|
{
|
2013-06-19 16:23:47 +02:00
|
|
|
[component addChild: [CardElement simpleElementWithTag: @"X-SOGo-Component-Created-By"
|
2015-02-12 21:01:26 +01:00
|
|
|
value: currentEmail]];
|
2008-01-14 14:57:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-01 20:34:35 +02:00
|
|
|
- (NSDictionary *) alarm
|
2015-06-22 15:20:35 +02:00
|
|
|
{
|
|
|
|
NSArray *attendees;
|
|
|
|
NSMutableDictionary *alarmData;
|
|
|
|
NSString *ownerId, *email;
|
|
|
|
iCalAlarm *anAlarm;
|
|
|
|
iCalPerson *aAttendee;
|
|
|
|
iCalTrigger *trigger;
|
|
|
|
SOGoUser *owner;
|
|
|
|
BOOL emailOrganizer, emailAttendees;
|
|
|
|
int count, max;
|
|
|
|
|
|
|
|
alarmData = nil;
|
|
|
|
if ([component hasAlarms])
|
|
|
|
{
|
|
|
|
anAlarm = [component firstSupportedAlarm];
|
|
|
|
trigger = [anAlarm trigger];
|
|
|
|
if (![[trigger valueType] length] || [[trigger valueType] caseInsensitiveCompare: @"DURATION"] == NSOrderedSame)
|
|
|
|
{
|
|
|
|
alarmData = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
|
|
|
[[anAlarm action] lowercaseString], @"action",
|
|
|
|
nil];
|
|
|
|
[alarmData addEntriesFromDictionary: [trigger asDictionary]];
|
|
|
|
|
|
|
|
emailOrganizer = NO;
|
|
|
|
emailAttendees = NO;
|
|
|
|
attendees = [anAlarm attendees];
|
|
|
|
ownerId = [[self clientObject] ownerInContext: nil];
|
|
|
|
owner = [SOGoUser userWithLogin: ownerId];
|
|
|
|
email = [[owner defaultIdentity] objectForKey: @"email"];
|
|
|
|
max = [attendees count];
|
|
|
|
for (count = 0;
|
|
|
|
!(emailOrganizer && emailAttendees)
|
|
|
|
&& count < max;
|
|
|
|
count++)
|
|
|
|
{
|
|
|
|
aAttendee = [attendees objectAtIndex: count];
|
|
|
|
if ([[aAttendee rfc822Email] isEqualToString: email])
|
|
|
|
emailOrganizer = YES;
|
|
|
|
else
|
|
|
|
emailAttendees = YES;
|
|
|
|
}
|
|
|
|
[alarmData setObject: [NSNumber numberWithBool: emailOrganizer] forKey: @"organizer"];
|
|
|
|
[alarmData setObject: [NSNumber numberWithBool: emailAttendees] forKey: @"attendees"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return alarmData;
|
|
|
|
}
|
|
|
|
|
2015-07-01 20:34:35 +02:00
|
|
|
- (NSArray *) attachUrls
|
|
|
|
{
|
|
|
|
NSMutableArray *attachUrls;
|
|
|
|
NSArray *values;
|
|
|
|
NSString *attachUrl;
|
|
|
|
NSUInteger count, max;
|
|
|
|
|
|
|
|
values = [component attach];
|
|
|
|
max = [values count];
|
|
|
|
if (max > 0)
|
|
|
|
{
|
|
|
|
attachUrls = [NSMutableArray arrayWithCapacity: max];
|
|
|
|
for (count = 0; count < max; count++)
|
|
|
|
{
|
|
|
|
attachUrl = [values objectAtIndex: count];
|
|
|
|
if ([attachUrl length] > 0)
|
|
|
|
[attachUrls addObject: [NSDictionary dictionaryWithObject: attachUrl forKey: @"value"]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
attachUrls = nil;
|
|
|
|
|
|
|
|
return attachUrls;
|
|
|
|
}
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
- (void) setAttributes: (NSDictionary *) data
|
2006-11-07 20:24:36 +01:00
|
|
|
{
|
2015-07-01 20:34:35 +02:00
|
|
|
NSArray *values;
|
2008-01-14 14:57:28 +01:00
|
|
|
NSCalendarDate *now;
|
2015-07-01 20:34:35 +02:00
|
|
|
NSMutableArray *attachUrls;
|
2015-02-12 21:01:26 +01:00
|
|
|
NSMutableDictionary *dataWithOwner;
|
|
|
|
NSString *owner;
|
2015-07-01 20:34:35 +02:00
|
|
|
NSUInteger i;
|
2015-05-14 17:36:21 +02:00
|
|
|
SOGoAppointmentFolders *folders;
|
2015-07-01 20:34:35 +02:00
|
|
|
id destinationCalendar, o;
|
2006-11-07 20:24:36 +01:00
|
|
|
|
2007-03-18 16:20:38 +01:00
|
|
|
now = [NSCalendarDate calendarDate];
|
2015-02-12 21:01:26 +01:00
|
|
|
owner = [componentCalendar ownerInContext: context];
|
|
|
|
|
|
|
|
// Append the calendar's owner to the data as it's required when setting alarms
|
|
|
|
dataWithOwner = [NSMutableDictionary dictionaryWithDictionary: data];
|
|
|
|
[dataWithOwner setObject: owner forKey: @"owner"];
|
|
|
|
[component setAttributes: dataWithOwner inContext: context];
|
|
|
|
|
2015-05-14 17:36:21 +02:00
|
|
|
destinationCalendar = [data objectForKey: @"destinationCalendar"];
|
|
|
|
if ([destinationCalendar isKindOfClass: [NSString class]])
|
|
|
|
{
|
|
|
|
folders = [[context activeUser] calendarsFolderInContext: context];
|
|
|
|
componentCalendar = [folders lookupName: [destinationCalendar stringValue]
|
|
|
|
inContext: context
|
|
|
|
acquire: 0];
|
|
|
|
[componentCalendar retain];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-03-19 15:33:33 +01:00
|
|
|
[self _handleOrganizer];
|
2015-02-12 21:01:26 +01:00
|
|
|
|
2015-07-01 20:34:35 +02:00
|
|
|
if ([[data objectForKey: @"attachUrls"] isKindOfClass: [NSArray class]])
|
|
|
|
{
|
|
|
|
values = [component childrenWithTag: @"attach"];
|
|
|
|
[component removeChildren: values];
|
|
|
|
values = [data objectForKey: @"attachUrls"];
|
|
|
|
attachUrls = [NSMutableArray arrayWithCapacity: [values count]];
|
|
|
|
for (i = 0; i < [values count]; i++)
|
|
|
|
{
|
|
|
|
o = [values objectAtIndex: i];
|
|
|
|
if ([o isKindOfClass: [NSDictionary class]])
|
|
|
|
{
|
|
|
|
[attachUrls addObject: [o objectForKey: @"value"]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
attachUrls = nil;
|
|
|
|
}
|
|
|
|
[component setAttach: attachUrls];
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
if ([[self clientObject] isNew])
|
2006-11-07 20:24:36 +01:00
|
|
|
{
|
2007-03-18 16:20:38 +01:00
|
|
|
[component setCreated: now];
|
|
|
|
[component setTimeStampAsDate: now];
|
2006-11-07 19:15:29 +01:00
|
|
|
}
|
2007-03-18 16:20:38 +01:00
|
|
|
[component setLastModified: now];
|
2009-07-23 22:11:06 +02:00
|
|
|
}
|
|
|
|
|
2015-02-12 21:01:26 +01:00
|
|
|
//#warning the following methods probably share some code...
|
|
|
|
//- (NSString *) _toolbarForOwner: (SOGoUser *) ownerUser
|
|
|
|
// andClientObject: (SOGoContentObject
|
|
|
|
// <SOGoComponentOccurence> *) clientObject
|
|
|
|
//{
|
|
|
|
// NSString *toolbarFilename;
|
|
|
|
// BOOL isOrganizer;
|
|
|
|
//
|
|
|
|
// // We determine if we're the organizer of the component beeing modified.
|
|
|
|
// // If we created an event on behalf of someone else -userIsOrganizer will
|
|
|
|
// // return us YES. This is OK because we're in the SENT-BY. But, Alice
|
|
|
|
// // should be able to accept/decline an invitation if she created the event
|
|
|
|
// // in Bob's calendar and added herself in the attendee list.
|
|
|
|
// isOrganizer = [component userIsOrganizer: ownerUser];
|
|
|
|
//
|
|
|
|
// if (isOrganizer)
|
|
|
|
// isOrganizer = ![ownerUser hasEmail: [[component organizer] sentBy]];
|
|
|
|
//
|
|
|
|
// if ([componentCalendar isKindOfClass: [SOGoWebAppointmentFolder class]]
|
|
|
|
// || ([component userIsAttendee: ownerUser]
|
|
|
|
// && !isOrganizer
|
|
|
|
// // Lightning does not manage participation status within tasks,
|
|
|
|
// // so we also ignore the participation status of tasks in the
|
|
|
|
// // web interface.
|
|
|
|
// && ![[component tag] isEqualToString: @"VTODO"]))
|
|
|
|
// toolbarFilename = @"SOGoEmpty.toolbar";
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// if ([clientObject isKindOfClass: [SOGoAppointmentObject class]]
|
|
|
|
// || [clientObject isKindOfClass: [SOGoAppointmentOccurence class]])
|
|
|
|
// toolbarFilename = @"SOGoAppointmentObject.toolbar";
|
|
|
|
// else
|
|
|
|
// toolbarFilename = @"SOGoTaskObject.toolbar";
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return toolbarFilename;
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//- (NSString *) _toolbarForDelegate: (SOGoUser *) ownerUser
|
|
|
|
// andClientObject: (SOGoContentObject
|
|
|
|
// <SOGoComponentOccurence> *) clientObject
|
|
|
|
//{
|
|
|
|
// SoSecurityManager *sm;
|
|
|
|
// NSString *toolbarFilename;
|
|
|
|
//
|
|
|
|
// sm = [SoSecurityManager sharedSecurityManager];
|
|
|
|
//
|
|
|
|
// if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent
|
|
|
|
// onObject: clientObject
|
|
|
|
// inContext: context])
|
|
|
|
// toolbarFilename = [self _toolbarForOwner: ownerUser
|
|
|
|
// andClientObject: clientObject];
|
|
|
|
// else
|
|
|
|
// toolbarFilename = @"SOGoEmpty.toolbar";
|
|
|
|
//
|
|
|
|
// return toolbarFilename;
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//- (NSString *) toolbar
|
|
|
|
//{
|
|
|
|
// SOGoContentObject <SOGoComponentOccurence> *clientObject;
|
|
|
|
// NSString *toolbarFilename;
|
|
|
|
// SOGoUser *ownerUser;
|
|
|
|
//
|
|
|
|
// clientObject = [self clientObject];
|
|
|
|
// ownerUser = [SOGoUser userWithLogin: [clientObject ownerInContext: context]
|
|
|
|
// roles: nil];
|
|
|
|
//
|
|
|
|
// if ([ownerUser isEqual: [context activeUser]])
|
|
|
|
// toolbarFilename = [self _toolbarForOwner: ownerUser
|
|
|
|
// andClientObject: clientObject];
|
|
|
|
// else
|
|
|
|
// toolbarFilename = [self _toolbarForDelegate: ownerUser
|
|
|
|
// andClientObject: clientObject];
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// return toolbarFilename;
|
|
|
|
//}
|
2015-04-24 20:25:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
- (int) ownerIsAttendee: (SOGoUser *) ownerUser
|
|
|
|
andClientObject: (SOGoContentObject
|
|
|
|
<SOGoComponentOccurence> *) clientObject
|
|
|
|
{
|
|
|
|
BOOL isOrganizer;
|
|
|
|
iCalPerson *ownerAttendee;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = 0;
|
|
|
|
|
|
|
|
isOrganizer = [component userIsOrganizer: ownerUser];
|
|
|
|
if (isOrganizer)
|
|
|
|
isOrganizer = ![ownerUser hasEmail: [[component organizer] sentBy]];
|
|
|
|
|
|
|
|
if (!isOrganizer && ![[component tag] isEqualToString: @"VTODO"])
|
|
|
|
{
|
|
|
|
ownerAttendee = [component userAsAttendee: ownerUser];
|
|
|
|
if (ownerAttendee)
|
|
|
|
rc = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) delegateIsAttendee: (SOGoUser *) ownerUser
|
|
|
|
andClientObject: (SOGoContentObject
|
|
|
|
<SOGoComponentOccurence> *) clientObject
|
|
|
|
{
|
|
|
|
SoSecurityManager *sm;
|
|
|
|
iCalPerson *ownerAttendee;
|
|
|
|
int rc;
|
|
|
|
|
2015-08-05 22:44:25 +02:00
|
|
|
rc = componentReadableWritable;
|
2015-04-24 20:25:04 +02:00
|
|
|
|
|
|
|
sm = [SoSecurityManager sharedSecurityManager];
|
|
|
|
if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent
|
|
|
|
onObject: clientObject
|
|
|
|
inContext: context])
|
|
|
|
rc = [self ownerIsAttendee: ownerUser
|
|
|
|
andClientObject: clientObject];
|
|
|
|
else if (![sm validatePermission: SOGoCalendarPerm_RespondToComponent
|
|
|
|
onObject: clientObject
|
|
|
|
inContext: context])
|
|
|
|
{
|
|
|
|
ownerAttendee = [component userAsAttendee: ownerUser];
|
|
|
|
if ([[ownerAttendee rsvp] isEqualToString: @"true"]
|
|
|
|
&& ![component userIsOrganizer: ownerUser])
|
2015-08-05 22:44:25 +02:00
|
|
|
rc = componentOwnerIsInvited;
|
2015-04-24 20:25:04 +02:00
|
|
|
else
|
2015-08-05 22:44:25 +02:00
|
|
|
rc = componentReadableOnly;
|
2015-04-24 20:25:04 +02:00
|
|
|
}
|
|
|
|
else
|
2015-08-05 22:44:25 +02:00
|
|
|
rc = componentReadableOnly;
|
2015-04-24 20:25:04 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) getEventRWType
|
|
|
|
{
|
2015-08-05 22:44:25 +02:00
|
|
|
SOGoContentObject <SOGoComponentOccurence> *clientObject;
|
|
|
|
SOGoUser *ownerUser;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
clientObject = [self clientObject];
|
|
|
|
ownerUser = [SOGoUser userWithLogin: [clientObject ownerInContext: context]];
|
2015-08-18 15:27:33 +02:00
|
|
|
if ([[clientObject container] isKindOfClass: [SOGoWebAppointmentFolder class]])
|
2015-08-05 22:44:25 +02:00
|
|
|
rc = componentReadableOnly;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ([ownerUser isEqual: [context activeUser]])
|
|
|
|
rc = [self ownerIsAttendee: ownerUser
|
|
|
|
andClientObject: clientObject];
|
|
|
|
else
|
|
|
|
rc = [self delegateIsAttendee: ownerUser
|
|
|
|
andClientObject: clientObject];
|
|
|
|
}
|
2015-04-24 20:25:04 +02:00
|
|
|
|
2015-08-05 22:44:25 +02:00
|
|
|
return rc;
|
2015-04-24 20:25:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) isReadOnly
|
|
|
|
{
|
2015-08-05 22:44:25 +02:00
|
|
|
return [self getEventRWType] != componentReadableWritable;
|
2015-04-24 20:25:04 +02:00
|
|
|
}
|
2015-02-12 21:01:26 +01:00
|
|
|
//
|
|
|
|
//- (NSString *) emailAlarmsEnabled
|
|
|
|
//{
|
|
|
|
// SOGoSystemDefaults *sd;
|
|
|
|
//
|
|
|
|
// sd = [SOGoSystemDefaults sharedSystemDefaults];
|
|
|
|
//
|
|
|
|
// return ([sd enableEMailAlarms]
|
|
|
|
// ? @"true"
|
|
|
|
// : @"false");
|
|
|
|
//}
|
2015-06-22 15:20:35 +02:00
|
|
|
|
2015-08-05 22:44:25 +02:00
|
|
|
- (BOOL) userHasRSVP
|
|
|
|
{
|
|
|
|
return ([self getEventRWType] == componentOwnerIsInvited);
|
|
|
|
}
|
2015-02-12 21:01:26 +01:00
|
|
|
|
|
|
|
//- (unsigned int) firstDayOfWeek
|
|
|
|
//{
|
|
|
|
// SOGoUserDefaults *ud;
|
|
|
|
//
|
|
|
|
// ud = [[context activeUser] userDefaults];
|
|
|
|
//
|
|
|
|
// return [ud firstDayOfWeek];
|
|
|
|
//}
|
2013-01-21 18:12:50 +01:00
|
|
|
|
2012-07-09 16:17:07 +02:00
|
|
|
// returns the raw content of the object
|
|
|
|
- (WOResponse *) rawAction
|
|
|
|
{
|
|
|
|
NSMutableString *content;
|
|
|
|
WOResponse *response;
|
|
|
|
|
|
|
|
content = [NSMutableString string];
|
|
|
|
response = [context response];
|
|
|
|
|
2015-10-31 07:10:03 +01:00
|
|
|
[content appendFormat: @"%@", [[self clientObject] contentAsString]];
|
2012-07-09 16:17:07 +02:00
|
|
|
[response setHeader: @"text/plain; charset=utf-8"
|
|
|
|
forKey: @"content-type"];
|
|
|
|
[response appendContentString: content];
|
|
|
|
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
2014-12-16 15:20:27 +01:00
|
|
|
+ (NSArray *) reminderValues
|
|
|
|
{
|
|
|
|
return reminderValues;
|
|
|
|
}
|
|
|
|
|
2006-10-18 16:42:44 +02:00
|
|
|
@end
|