applied comments and fix repeated events dragNdrop between calendars

This commit is contained in:
Alexandre Cloutier
2014-07-10 13:34:47 -04:00
parent e478b29c2e
commit ccf181bcf9
2 changed files with 20 additions and 21 deletions

View File

@@ -62,8 +62,8 @@
NSArray *calendarsID;
NSTimeZone *tz;
NSException *ex;
SOGoAppointmentFolder *componentCalendar, *previousCalendar;
SOGoAppointmentFolders *user;
SOGoAppointmentFolder *targetCalendar, *sourceCalendar;
SOGoAppointmentFolders *folders;
rq = [context request];
@@ -116,27 +116,26 @@
[event setLastModified: [NSCalendarDate calendarDate]];
ex = [co saveComponent: event];
/***************************** TODO ******************/
if (![calendarID isEqualToString:@"0"]) {
user = [[self->context activeUser] calendarsFolderInContext: self->context];
calendarsID = [calendarID componentsSeparatedByString:@","];
previousCalendar = [user lookupName:[[calendarsID objectAtIndex:0] stringValue] inContext: self->context acquire: 0];
componentCalendar = [user lookupName:[[calendarsID objectAtIndex:1] stringValue] inContext: self->context acquire: 0];
// The event was moved to a different calendar.
sm = [SoSecurityManager sharedSecurityManager];
if (![sm validatePermission: SoPerm_DeleteObjects
onObject: previousCalendar
inContext: context])
if (![calendarID isEqualToString:@"0"])
{
if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles
onObject: componentCalendar
folders = [[self->context activeUser] calendarsFolderInContext: self->context];
calendarsID = [calendarID componentsSeparatedByString:@","];
sourceCalendar = [folders lookupName:[[calendarsID objectAtIndex:0] stringValue] inContext: self->context acquire: 0];
targetCalendar = [folders lookupName:[[calendarsID objectAtIndex:1] 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])
ex = [co moveToFolder: componentCalendar];
}
{
if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles
onObject: targetCalendar
inContext: context])
ex = [co moveToFolder: targetCalendar];
}
}
/********************************************************/
}
if (ex)
{
NSDictionary *jsonResponse;

View File

@@ -144,7 +144,7 @@ function updateEventFromDragging(controller, eventCells, eventDelta, calendarID)
_editRecurrenceDialog(eventCell, "confirmAdjustment", params);
else {
var urlstr = (ApplicationBaseURL + "/" + eventCell.calendar + "/" + eventCell.cname);
if (eventCell.recurrenceTime)
if (eventCell.recurrenceTime && (calendarID[0] == calendarID[1]))
urlstr += "/occurence" + eventCell.recurrenceTime;
urlstr += ("/adjust?" + params);
// log(" urlstr: " + urlstr);
@@ -155,7 +155,7 @@ function updateEventFromDragging(controller, eventCells, eventDelta, calendarID)
function performEventAdjustment(folder, event, recurrence, params) {
var urlstr = ApplicationBaseURL + "/" + folder + "/" + event;
if (recurrence)
if (recurrence && (calendarID[0] == calendarID[1]))
urlstr += "/" + recurrence;
urlstr += "/adjust" + generateQueryString(params);
triggerAjaxRequest(urlstr, updateEventFromDraggingCallback);