diff --git a/UI/Scheduler/UIxAppointmentActions.m b/UI/Scheduler/UIxAppointmentActions.m index db6d55c91..05399f76b 100644 --- a/UI/Scheduler/UIxAppointmentActions.m +++ b/UI/Scheduler/UIxAppointmentActions.m @@ -23,6 +23,7 @@ #import #import #import +#import #import #import @@ -52,19 +53,25 @@ WOResponse *response; WORequest *rq; SOGoAppointmentObject *co; + SoSecurityManager *sm; iCalEvent *event; NSCalendarDate *start, *newStart, *end, *newEnd; NSTimeInterval newDuration; SOGoUserDefaults *ud; - NSString *daysDelta, *startDelta, *durationDelta; + NSString *daysDelta, *startDelta, *durationDelta, *destionationCalendar; + NSArray *calendarsID; NSTimeZone *tz; NSException *ex; + SOGoAppointmentFolder *targetCalendar, *sourceCalendar; + SOGoAppointmentFolders *folders; rq = [context request]; daysDelta = [rq formValueForKey: @"days"]; startDelta = [rq formValueForKey: @"start"]; durationDelta = [rq formValueForKey: @"duration"]; + destionationCalendar = [rq formValueForKey: @"destination"]; + if ([daysDelta length] > 0 || [startDelta length] > 0 || [durationDelta length] > 0) { @@ -105,10 +112,30 @@ } if ([event hasRecurrenceRules]) - [event updateRecurrenceRulesUntilDate: end]; + [event updateRecurrenceRulesUntilDate: end]; [event setLastModified: [NSCalendarDate calendarDate]]; ex = [co saveComponent: event]; + // This condition will be executed only if the event is moved from a calendar to another. If destionationCalendar == 0; there is no calendar change + if (![destionationCalendar isEqualToString:@"0"]) + { + folders = [[self->context activeUser] calendarsFolderInContext: self->context]; + sourceCalendar = [co container]; + targetCalendar = [folders lookupName:[destionationCalendar stringValue] inContext: self->context acquire: 0]; + // The event was moved to a different calendar. + sm = [SoSecurityManager sharedSecurityManager]; + if (![sm validatePermission: SoPerm_DeleteObjects + onObject: sourceCalendar + inContext: context]) + { + if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles + onObject: targetCalendar + inContext: context]) + ex = [co moveToFolder: targetCalendar]; + } + + + } if (ex) { NSDictionary *jsonResponse; diff --git a/UI/Scheduler/UIxCalDayTable.m b/UI/Scheduler/UIxCalDayTable.m index 799d55f57..7cfde1b1f 100644 --- a/UI/Scheduler/UIxCalDayTable.m +++ b/UI/Scheduler/UIxCalDayTable.m @@ -191,7 +191,7 @@ NSMutableDictionary *calendar; unsigned int count, foldersCount; NSString *folderName, *fDisplayName; - NSNumber *isActive; + BOOL *isActive; co = [self clientObject]; folders = [co subFolders]; diff --git a/UI/Templates/SchedulerUI/UIxCalDayTable.wox b/UI/Templates/SchedulerUI/UIxCalDayTable.wox index 3f488286d..3c4a1c3e4 100644 --- a/UI/Templates/SchedulerUI/UIxCalDayTable.wox +++ b/UI/Templates/SchedulerUI/UIxCalDayTable.wox @@ -33,7 +33,7 @@
-
+
@@ -75,7 +75,7 @@ -
+
diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index 1d40f4fc3..b5e196ae1 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -9,7 +9,7 @@ className="UIxPageFrame" const:userDefaultsKeys="SOGoCalendarCategoriesColors,SOGoDefaultCalendar" const:userSettingsKeys="Calendar,ShowCompletedTasks" - const:jsFiles="SchedulerUIDnD.js" + const:jsFiles="SchedulerUIDnD.js,jquery-ui.js" title="title">