* Calendar/infolog events: Implement drag,drop and resize for integrated infolog events in all calendar views.

This commit is contained in:
Hadi Nategh 2014-08-21 14:28:02 +00:00
parent 258d3c8ee5
commit f381b9630a
2 changed files with 25 additions and 27 deletions

View File

@ -1868,10 +1868,8 @@ class calendar_uiviews extends calendar_ui
$z_index = is_null($z_index) ? 20 : (int)$z_index; $z_index = is_null($z_index) ? 20 : (int)$z_index;
// ATM we do not support whole day events or recurring events for dragdrop
$dd_emulation = "";
if ($this->use_time_grid && if ($this->use_time_grid &&
(int)$event['id'] && $this->bo->check_perms(EGW_ACL_EDIT,$event)) $event['id'] && $this->bo->check_perms(EGW_ACL_EDIT,$event))
{ {
if (!$event['whole_day_on_top'] && if (!$event['whole_day_on_top'] &&
!$event['whole_day'] && !$event['whole_day'] &&

View File

@ -155,7 +155,7 @@ app.classes.calendar = AppJS.extend(
if (match[1]== _id) do_refresh = true; if (match[1]== _id) do_refresh = true;
} }
}); });
if (jQuery('div [id^="infolog'+_id+'"]').length > 0) do_refresh = true; if (jQuery('div [id^="infolog'+_id+'"],div [id^="drag_infolog'+_id+'"]').length > 0) do_refresh = true;
switch (_type) switch (_type)
{ {
case 'add': case 'add':
@ -566,12 +566,19 @@ app.classes.calendar = AppJS.extend(
}, },
/** /**
* DropEvent * This function tries to recognise the type of dropped event, and sends relative request to server accordingly
* -ATM we have three different requests:
* -1. Event part of series
* -2. Single Event (Normall Cal Event)
* -3. Integrated Infolog Event
* *
* @param {string} _id dragged event id * @param {string} _id dragged event id
* @param {array} _date array of date,hour, and minute of dropped cell * @param {array} _date array of date,hour, and minute of dropped cell
* @param {string} _duration description * @param {string} _duration description
* @param {string} _eventFlag Flag to distinguesh wheter the event is Whole Day, Series, or Single * @param {string} _eventFlag Flag to distinguish whether the event is Whole Day, Series, or Single
* - S represents Series
* - WD represents Whole Day
* - '' represents Single
*/ */
dropEvent : function(_id, _date, _duration, _eventFlag) dropEvent : function(_id, _date, _duration, _eventFlag)
{ {
@ -579,7 +586,6 @@ app.classes.calendar = AppJS.extend(
var calOwner = _id.substring(_id.lastIndexOf("_O")+2,_id.lastIndexOf("_C")); var calOwner = _id.substring(_id.lastIndexOf("_O")+2,_id.lastIndexOf("_C"));
var eventOwner = _id.substring(_id.lastIndexOf("_C")+2,_id.lastIndexOf("")); var eventOwner = _id.substring(_id.lastIndexOf("_C")+2,_id.lastIndexOf(""));
var date = this.cal_dnd_tZone_converter(_date); var date = this.cal_dnd_tZone_converter(_date);
var moveOrder = false;
if (_eventFlag == 'S') if (_eventFlag == 'S')
{ {
@ -587,32 +593,26 @@ app.classes.calendar = AppJS.extend(
{ {
if (_button_id == et2_dialog.OK_BUTTON) if (_button_id == et2_dialog.OK_BUTTON)
{ {
egw().json( egw().json('calendar.calendar_uiforms.ajax_moveEvent', [eventId, calOwner, date, eventOwner, _duration]).sendRequest();
'calendar.calendar_uiforms.ajax_moveEvent',
[eventId,
calOwner,
date,
eventOwner,
_duration]
).sendRequest();
} }
},this.egw.lang("Do you really want to change the start of this series? If you do, the original series will be terminated as of today and a new series for the future reflecting your changes will be created."), },this.egw.lang("Do you really want to change the start of this series? If you do, the original series will be terminated as of today and a new series for the future reflecting your changes will be created."),
this.egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL , et2_dialog.WARNING_MESSAGE); this.egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL , et2_dialog.WARNING_MESSAGE);
} }
else else
{ {
moveOrder = true; //Get infologID if in case if it's an integrated infolog event
} var infolog_id = eventId.split('infolog')[1];
if (moveOrder)
{ if (infolog_id)
egw().json( {
'calendar.calendar_uiforms.ajax_moveEvent', // If it is an integrated infolog event we need to edit infolog entry
[eventId, egw().json('stylite_infolog_calendar_integration::ajax_moveInfologEvent', [infolog_id, date,_duration]).sendRequest();
calOwner, }
date, else
eventOwner, {
_duration] //Edit calendar event
).sendRequest(); egw().json('calendar.calendar_uiforms.ajax_moveEvent',[eventId, calOwner, date, eventOwner, _duration]).sendRequest();
}
} }
}, },