Add attribute isReadOnly to event/task JSON view

This commit is contained in:
Francis Lachapelle 2015-04-24 14:25:04 -04:00
parent 5e3b3e6987
commit 550fc09ee4
4 changed files with 92 additions and 87 deletions

View file

@ -548,6 +548,7 @@
* @apiSuccess (Success 200) {String} endDate End date (ISO8601) * @apiSuccess (Success 200) {String} endDate End date (ISO8601)
* @apiSuccess (Success 200) {String} localizedEndDate Formatted end date * @apiSuccess (Success 200) {String} localizedEndDate Formatted end date
* @apiSuccess (Success 200) {String} [localizedEndTime] Formatted end time * @apiSuccess (Success 200) {String} [localizedEndTime] Formatted end time
* @apiSuccess (Success 200) {Number} isReadOnly 1 if event is read-only
* *
* From [iCalEvent+SOGo attributes] * From [iCalEvent+SOGo attributes]
* *
@ -669,6 +670,7 @@
[co nameInContainer], @"id", [co nameInContainer], @"id",
[componentCalendar nameInContainer], @"pid", [componentCalendar nameInContainer], @"pid",
[componentCalendar displayName], @"calendar", [componentCalendar displayName], @"calendar",
[NSNumber numberWithBool: [self isReadOnly]], @"isReadOnly",
[dateFormatter formattedDate: eventStartDate], @"localizedStartDate", [dateFormatter formattedDate: eventStartDate], @"localizedStartDate",
[dateFormatter formattedDate: eventEndDate], @"localizedEndDate", [dateFormatter formattedDate: eventEndDate], @"localizedEndDate",
nil]; nil];

View file

@ -29,10 +29,12 @@
@interface UIxComponentEditor : UIxComponent @interface UIxComponentEditor : UIxComponent
{ {
id item;
iCalRepeatableEntityObject *component; iCalRepeatableEntityObject *component;
SOGoAppointmentFolder *componentCalendar; SOGoAppointmentFolder *componentCalendar;
} }
- (BOOL) isReadOnly;
- (void) setAttributes: (NSDictionary *) attributes; - (void) setAttributes: (NSDictionary *) attributes;
+ (NSArray *) reminderValues; + (NSArray *) reminderValues;

View file

@ -714,93 +714,92 @@ static NSArray *reminderValues = nil;
// //
// return toolbarFilename; // return toolbarFilename;
//} //}
//
//
//- (int) ownerIsAttendee: (SOGoUser *) ownerUser - (int) ownerIsAttendee: (SOGoUser *) ownerUser
// andClientObject: (SOGoContentObject andClientObject: (SOGoContentObject
// <SOGoComponentOccurence> *) clientObject <SOGoComponentOccurence> *) clientObject
//{ {
// BOOL isOrganizer; BOOL isOrganizer;
// iCalPerson *ownerAttendee; iCalPerson *ownerAttendee;
// int rc; int rc;
//
// rc = 0; rc = 0;
//
// isOrganizer = [component userIsOrganizer: ownerUser]; isOrganizer = [component userIsOrganizer: ownerUser];
// if (isOrganizer) if (isOrganizer)
// isOrganizer = ![ownerUser hasEmail: [[component organizer] sentBy]]; isOrganizer = ![ownerUser hasEmail: [[component organizer] sentBy]];
//
// if (!isOrganizer && ![[component tag] isEqualToString: @"VTODO"]) if (!isOrganizer && ![[component tag] isEqualToString: @"VTODO"])
// { {
// ownerAttendee = [component userAsAttendee: ownerUser]; ownerAttendee = [component userAsAttendee: ownerUser];
// if (ownerAttendee) if (ownerAttendee)
// rc = 1; rc = 1;
// } }
//
// return rc; return rc;
//} }
//
//- (int) delegateIsAttendee: (SOGoUser *) ownerUser - (int) delegateIsAttendee: (SOGoUser *) ownerUser
// andClientObject: (SOGoContentObject andClientObject: (SOGoContentObject
// <SOGoComponentOccurence> *) clientObject <SOGoComponentOccurence> *) clientObject
//{ {
// SoSecurityManager *sm; SoSecurityManager *sm;
// iCalPerson *ownerAttendee; iCalPerson *ownerAttendee;
// int rc; int rc;
//
// rc = 0; rc = 0;
//
// sm = [SoSecurityManager sharedSecurityManager]; sm = [SoSecurityManager sharedSecurityManager];
// if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent
// onObject: clientObject onObject: clientObject
// inContext: context]) inContext: context])
// rc = [self ownerIsAttendee: ownerUser rc = [self ownerIsAttendee: ownerUser
// andClientObject: clientObject]; andClientObject: clientObject];
// else if (![sm validatePermission: SOGoCalendarPerm_RespondToComponent else if (![sm validatePermission: SOGoCalendarPerm_RespondToComponent
// onObject: clientObject onObject: clientObject
// inContext: context]) inContext: context])
// { {
// ownerAttendee = [component userAsAttendee: ownerUser]; ownerAttendee = [component userAsAttendee: ownerUser];
// if ([[ownerAttendee rsvp] isEqualToString: @"true"] if ([[ownerAttendee rsvp] isEqualToString: @"true"]
// && ![component userIsOrganizer: ownerUser]) && ![component userIsOrganizer: ownerUser])
// rc = 1; rc = 1;
// else else
// rc = 2; rc = 2;
// } }
// else else
// rc = 2; // not invited, just RO rc = 2; // not invited, just RO
//
// return rc; return rc;
//} }
//
//- (int) getEventRWType - (int) getEventRWType
//{ {
// SOGoContentObject <SOGoComponentOccurence> *clientObject; SOGoContentObject <SOGoComponentOccurence> *clientObject;
// SOGoUser *ownerUser; SOGoUser *ownerUser;
// int rc; int rc;
//
// clientObject = [self clientObject]; clientObject = [self clientObject];
// ownerUser ownerUser = [SOGoUser userWithLogin: [clientObject ownerInContext: context]];
// = [SOGoUser userWithLogin: [clientObject ownerInContext: context]]; if ([componentCalendar isKindOfClass: [SOGoWebAppointmentFolder class]])
// if ([componentCalendar isKindOfClass: [SOGoWebAppointmentFolder class]]) rc = 2;
// rc = 2; else
// else {
// { if ([ownerUser isEqual: [context activeUser]])
// if ([ownerUser isEqual: [context activeUser]]) rc = [self ownerIsAttendee: ownerUser
// rc = [self ownerIsAttendee: ownerUser andClientObject: clientObject];
// andClientObject: clientObject]; else
// else rc = [self delegateIsAttendee: ownerUser
// rc = [self delegateIsAttendee: ownerUser andClientObject: clientObject];
// andClientObject: clientObject]; }
// }
// return rc;
// return rc; }
//}
// - (BOOL) isReadOnly
//- (BOOL) eventIsReadOnly {
//{ return [self getEventRWType] != 0;
// return [self getEventRWType] != 0; }
//}
// //
//- (NSString *) emailAlarmsEnabled //- (NSString *) emailAlarmsEnabled
//{ //{

View file

@ -402,6 +402,7 @@
* @apiSuccess (Success 200) {String} completedTime Formatted completed time * @apiSuccess (Success 200) {String} completedTime Formatted completed time
* @apiSuccess (Success 200) {String} status Status (needs-action, in-process, completed, or cancelled) * @apiSuccess (Success 200) {String} status Status (needs-action, in-process, completed, or cancelled)
* @apiSuccess (Success 200) {Number} percentComplete Percent completion * @apiSuccess (Success 200) {Number} percentComplete Percent completion
* @apiSuccess (Success 200) {Number} isReadOnly 1 if task is read-only
* *
* From [iCalEntityObject+SOGo attributes] * From [iCalEntityObject+SOGo attributes]
* *
@ -519,6 +520,7 @@
[co nameInContainer], @"id", [co nameInContainer], @"id",
[thisFolder nameInContainer], @"pid", [thisFolder nameInContainer], @"pid",
[thisFolder displayName], @"calendar", [thisFolder displayName], @"calendar",
[NSNumber numberWithBool: [self isReadOnly]], @"isReadOnly",
nil]; nil];
if (startDate) if (startDate)