mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Drag and drop to another user's calendar
- Add exception prompt - Change to -> Move to
This commit is contained in:
parent
d90c6d6e2a
commit
6d10b8d231
@ -2910,6 +2910,47 @@ class calendar_uiforms extends calendar_ui
|
||||
list($eventId, $date) = explode(':', $_eventId,2);
|
||||
|
||||
$old_event=$event=$this->bo->read($eventId);
|
||||
$event = $this->bo->read($eventId);
|
||||
if($date)
|
||||
{
|
||||
$d = new Api\DateTime($date, Api\DateTime::$user_timezone);
|
||||
}
|
||||
|
||||
// If we have a recuring event for a particular day, make an exception
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE && $date)
|
||||
{
|
||||
if (!empty($event['whole_day']))
|
||||
{
|
||||
$d =& $this->bo->so->startOfDay($date);
|
||||
$d->setUser();
|
||||
}
|
||||
$event = $this->bo->read($eventId, $d, true);
|
||||
// For DnD, create an exception if they gave the date
|
||||
$preserv = null;
|
||||
$this->_create_exception($event,$preserv);
|
||||
unset($event['id']);
|
||||
|
||||
$messages = null;
|
||||
$conflicts = $this->bo->update($event,false,true,false,true,$messages);
|
||||
if (!is_array($conflicts) && $conflicts)
|
||||
{
|
||||
// now we need to add the original start as recur-execption to the series
|
||||
$recur_event = $this->bo->read($event['reference']);
|
||||
$recur_event['recur_exception'][] = $d->format('ts');
|
||||
// check if we need to move the alarms, because they are next on that exception
|
||||
$this->bo->check_move_alarms($recur_event, null, $d);
|
||||
unset($recur_event['start']); unset($recur_event['end']); // no update necessary
|
||||
unset($recur_event['alarm']); // unsetting alarms too, as they cant be updated without start!
|
||||
$this->bo->update($recur_event,true); // no conflict check here
|
||||
|
||||
// Sending null will trigger a removal of the original for that date
|
||||
Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$_eventId, 'data' => null));
|
||||
|
||||
unset($recur_event);
|
||||
unset($event['edit_single']); // if we further edit it, it's just a single event
|
||||
unset($preserv['edit_single']);
|
||||
}
|
||||
}
|
||||
foreach($remove as $participant)
|
||||
{
|
||||
unset($event['participants'][$participant]);
|
||||
|
@ -1067,8 +1067,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
||||
}
|
||||
}
|
||||
}
|
||||
return timegrid.options.owner.toString() !== event.options.value.owner.toString() &&
|
||||
!owner_match;
|
||||
return !owner_match;
|
||||
};
|
||||
|
||||
// This binds into the egw action system. Most user interactions (drag to move, resize)
|
||||
@ -1325,21 +1324,40 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
||||
|
||||
// Leave the helper there until the update is done
|
||||
var loading = action.ui.helper.clone(true).appendTo($j('body'));
|
||||
var cal_id = source[i].id.split('::');
|
||||
egw().json('calendar.calendar_uiforms.ajax_invite', [
|
||||
cal_id[1],
|
||||
timegrid.options.owner,
|
||||
action.id === 'change_participant' ? self.options.owner : []
|
||||
],
|
||||
function() { loading.remove();}
|
||||
).sendRequest(true);
|
||||
|
||||
// and add a loading icon so user knows something is happening
|
||||
if($j('.calendar_timeDemo',loading).length == 0)
|
||||
{
|
||||
$j('.calendar_calEventHeader',loading).addClass('loading');
|
||||
}
|
||||
else
|
||||
{
|
||||
$j('.calendar_timeDemo',loading).after('<div class="loading"></div>');
|
||||
}
|
||||
|
||||
var event_data = egw.dataGetUIDdata(source[i].id).data;
|
||||
et2_calendar_event.recur_prompt(event_data, function(button_id) {
|
||||
if(button_id === 'cancel' || !button_id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
egw().json('calendar.calendar_uiforms.ajax_invite', [
|
||||
button_id==='series' ? event_data.id : event_data.app_id,
|
||||
timegrid.options.owner,
|
||||
action.id === 'change_participant' ?
|
||||
jQuery.extend([],source[i].iface.getWidget().getParent().options.owner) :
|
||||
[]
|
||||
],
|
||||
function() { loading.remove();}
|
||||
).sendRequest(true);
|
||||
});
|
||||
// Ok, stop.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
drop_change_participant = mgr.addAction('drop', 'change_participant', egw.lang('Change to'), egw.image('participant'), invite_action,true);
|
||||
drop_change_participant = mgr.addAction('drop', 'change_participant', egw.lang('Move to'), egw.image('participant'), invite_action,true);
|
||||
drop_change_participant.acceptedTypes = ['calendar'];
|
||||
drop_change_participant.hideOnDisabled = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user