diff --git a/UI/Scheduler/UIxAppointmentActions.m b/UI/Scheduler/UIxAppointmentActions.m index 2d7eb90a2..05399f76b 100644 --- a/UI/Scheduler/UIxAppointmentActions.m +++ b/UI/Scheduler/UIxAppointmentActions.m @@ -58,7 +58,7 @@ NSCalendarDate *start, *newStart, *end, *newEnd; NSTimeInterval newDuration; SOGoUserDefaults *ud; - NSString *daysDelta, *startDelta, *durationDelta, *calendarID; + NSString *daysDelta, *startDelta, *durationDelta, *destionationCalendar; NSArray *calendarsID; NSTimeZone *tz; NSException *ex; @@ -70,7 +70,7 @@ daysDelta = [rq formValueForKey: @"days"]; startDelta = [rq formValueForKey: @"start"]; durationDelta = [rq formValueForKey: @"duration"]; - calendarID = [rq formValueForKey: @"calendarID"]; + destionationCalendar = [rq formValueForKey: @"destination"]; if ([daysDelta length] > 0 || [startDelta length] > 0 || [durationDelta length] > 0) @@ -116,12 +116,12 @@ [event setLastModified: [NSCalendarDate calendarDate]]; ex = [co saveComponent: event]; - if (![calendarID isEqualToString:@"0"]) + // 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]; - 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]; + 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 diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 7783d5594..4b2f46041 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -27,6 +27,7 @@ var preventAutoScroll = false; var userStates = [ "needs-action", "accepted", "declined", "tentative", "delegated" ]; var calendarHeaderAdjusted = false; +var recurrenceBool = false; var categoriesStyles = new Hash(); var categoriesStyleSheet = null; @@ -57,9 +58,6 @@ function printView() { function newEvent(type, day, hour, duration) { var folder = null; - /* if (currentView == "multicolumndayview") { - Need to find where the click register is saved - }*/ if (UserDefaults['SOGoDefaultCalendar'] == 'personal') folder = $("calendarList").down("li"); else if (UserDefaults['SOGoDefaultCalendar'] == 'first') { @@ -124,14 +122,14 @@ function newEventFromDragging(controller, day, coordinates) { } function updateEventFromDragging(controller, eventCells, eventDelta, calendarID) { - if (eventDelta.dayNumber || eventDelta.start || eventDelta.duration) { + if (eventDelta.dayNumber || eventDelta.start || eventDelta.duration || calendarID != 0) { if (calendarID != 0) - var params = ("calendarID=" + calendarID + var params = ("destination=" + calendarID[1] + "&days=" + 0 + "&start=" + eventDelta.start * 15 + "&duration=" + eventDelta.duration * 15); else - var params = ("calendarID=" + calendarID + var params = ("destination=" + 0 + "&days=" + eventDelta.dayNumber + "&start=" + eventDelta.start * 15 + "&duration=" + eventDelta.duration * 15); @@ -139,12 +137,15 @@ function updateEventFromDragging(controller, eventCells, eventDelta, calendarID) var eventCell = eventCells[0]; // log(" time: " + eventCell.recurrenceTime); // log(" exception: " + eventCell.isException); - + recurrenceBool = false; + if (calendarID == 0) { + recurrenceBool = true; + } if (eventCell.recurrenceTime && !eventCell.isException) _editRecurrenceDialog(eventCell, "confirmAdjustment", params); else { var urlstr = (ApplicationBaseURL + "/" + eventCell.calendar + "/" + eventCell.cname); - if (eventCell.recurrenceTime && (calendarID[0] == calendarID[1])) + if (eventCell.recurrenceTime && recurrenceBool) urlstr += "/occurence" + eventCell.recurrenceTime; urlstr += ("/adjust?" + params); // log(" urlstr: " + urlstr); @@ -155,7 +156,7 @@ function updateEventFromDragging(controller, eventCells, eventDelta, calendarID) function performEventAdjustment(folder, event, recurrence, params) { var urlstr = ApplicationBaseURL + "/" + folder + "/" + event; - if (recurrence && (calendarID[0] == calendarID[1])) + if (recurrence && recurrenceBool) urlstr += "/" + recurrence; urlstr += "/adjust" + generateQueryString(params); triggerAjaxRequest(urlstr, updateEventFromDraggingCallback); @@ -3135,9 +3136,8 @@ function configureDraggables() { } function configureDroppables() { - jQuery("#calendarList li").droppable({ - hoverClass: 'genericHoverClass', - drop: dropAction }); + jQuery("#calendarList li").droppable({ hoverClass: 'genericHoverClass', + drop: dropAction }); } function startDragging(event, ui) { @@ -3167,6 +3167,7 @@ function stopDragging(event, ui) { } function dropAction(event, ui) { + var action = "adjust"; refreshEventsAndDisplay(); dropSelectedEvents(action, this.id.substr(1)); @@ -3192,9 +3193,8 @@ function dropSelectedEvents(action, toId) { fromId = eventIds[i].substr(0, x); eventICS = eventIds[i].slice(x + 1); } - - var calendarID = "calendarID=" + fromId + "," + toId; - var params = calendarID + "&days=0&start=0&duration=0"; + var destinationCalendar = "destination=" + toId; + var params = destinationCalendar + "&days=0&start=0&duration=0"; var urlstr = ApplicationBaseURL + "/" + fromId + "/" + eventICS + "/adjust?" + params; triggerAjaxRequest(urlstr, updateEventFromDraggingCallback); diff --git a/UI/WebServerResources/SchedulerUIDnD.js b/UI/WebServerResources/SchedulerUIDnD.js index cbac2f1e3..2e1ded05e 100644 --- a/UI/WebServerResources/SchedulerUIDnD.js +++ b/UI/WebServerResources/SchedulerUIDnD.js @@ -1001,6 +1001,7 @@ SOGoEventDragController.prototype = { draggingModeAreas: null, ghostController: null, + leftPanelController: null, hasSelected: false, dragHasStarted: false, @@ -1385,9 +1386,14 @@ SOGoEventDragController.prototype = { var dropCalendar = $(event).findElement('#calendarList li'); if (dropCalendar != null) { + $$('#calendarList li').each(function(e) { + e.removeClassName('genericHoverClass'); + }); calendarID[0] = this.folderClass.substr(14); calendarID[1] = dropCalendar.getAttribute("id").substr(1); - this.updateDropCallback(this, this.eventCells, delta, calendarID); + delta.start = 0; + if (calendarID[0] != calendarID[1]) + this.updateDropCallback(this, this.eventCells, delta, calendarID); } else if (currentView == "multicolumndayview" && delta.dayNumber != 0) { var position = activeCalendars.indexOf(calendarID[0]); @@ -1431,7 +1437,7 @@ SOGoEventDragController.prototype = { if (this.dragHasStarted) { var newCoordinates = this.ghostController.pointerHandler.getEventViewCoordinates(); - if (newCoordinates == null) { + if (newCoordinates == null && this.leftPanelController != null) { if (this.ghostController.ghosts) this.ghostController.hideGhosts(); this.leftPanelController.updateFromPointerHandler();