mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Drag and drop move or invite in day view
This commit is contained in:
parent
e1afa27a7c
commit
660888c716
@ -2931,7 +2931,7 @@ class calendar_uiforms extends calendar_ui
|
|||||||
unset($event['id']);
|
unset($event['id']);
|
||||||
|
|
||||||
$messages = null;
|
$messages = null;
|
||||||
$conflicts = $this->bo->update($event,false,true,false,true,$messages);
|
$conflicts = $this->bo->update($event,true,true,false,true,$messages);
|
||||||
if (!is_array($conflicts) && $conflicts)
|
if (!is_array($conflicts) && $conflicts)
|
||||||
{
|
{
|
||||||
// now we need to add the original start as recur-execption to the series
|
// now we need to add the original start as recur-execption to the series
|
||||||
@ -2961,18 +2961,14 @@ class calendar_uiforms extends calendar_ui
|
|||||||
}
|
}
|
||||||
$conflicts=$this->bo->update($event,false, true, false, true, $message);
|
$conflicts=$this->bo->update($event,false, true, false, true, $message);
|
||||||
|
|
||||||
$this->update_client($event['id'],$d);
|
|
||||||
$response = Api\Json\Response::get();
|
$response = Api\Json\Response::get();
|
||||||
if(!is_array($conflicts) && $conflicts)
|
|
||||||
{
|
if (is_array($conflicts) && $conflicts)
|
||||||
if(is_int($conflicts))
|
|
||||||
{
|
|
||||||
$event['id'] = $conflicts;
|
|
||||||
$response->call('egw.refresh', '','calendar',$event['id'],'edit');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($conflicts)
|
|
||||||
{
|
{
|
||||||
|
// Save it anyway, was done with explicit user interaction,
|
||||||
|
// and if we don't we lose the invite
|
||||||
|
$this->bo->update($event,true); // no conflict check here
|
||||||
|
$this->update_client($event['id'],$d);
|
||||||
$response->call(
|
$response->call(
|
||||||
'egw_openWindowCentered2',
|
'egw_openWindowCentered2',
|
||||||
$GLOBALS['egw_info']['server']['webserver_url'].'/index.php?menuaction=calendar.calendar_uiforms.edit
|
$GLOBALS['egw_info']['server']['webserver_url'].'/index.php?menuaction=calendar.calendar_uiforms.edit
|
||||||
@ -2987,6 +2983,18 @@ class calendar_uiforms extends calendar_ui
|
|||||||
{
|
{
|
||||||
$response->call('egw.message', implode('<br />', $message));
|
$response->call('egw.message', implode('<br />', $message));
|
||||||
}
|
}
|
||||||
|
if($conflicts)
|
||||||
|
{
|
||||||
|
$this->update_client($event['id'],$d);
|
||||||
|
if(is_int($conflicts))
|
||||||
|
{
|
||||||
|
$event['id'] = $conflicts;
|
||||||
|
}
|
||||||
|
if($event['id'])
|
||||||
|
{
|
||||||
|
$response->call('egw.refresh', '','calendar',$event['id'],'edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -396,7 +396,6 @@ class calendar_uilist extends calendar_ui
|
|||||||
(count($search_params['users']) == 1 ? $this->bo->participant_name($search_params['users'][0]).': ' : '') .
|
(count($search_params['users']) == 1 ? $this->bo->participant_name($search_params['users'][0]).': ' : '') .
|
||||||
$label);
|
$label);
|
||||||
}
|
}
|
||||||
error_log(__METHOD__ . ' ' .array2string($search_params));
|
|
||||||
foreach((array) $this->bo->search($search_params, !empty($col_filter) ? $col_filter : null) as $event)
|
foreach((array) $this->bo->search($search_params, !empty($col_filter) ? $col_filter : null) as $event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -837,10 +837,10 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
this.day_list = this._calculate_day_list(this.options.start_date, this.options.end_date, this.options.show_weekend);
|
this.day_list = this._calculate_day_list(this.options.start_date, this.options.end_date, this.options.show_weekend);
|
||||||
}
|
}
|
||||||
// For a single day, we show each owner in their own daycol
|
// For a single day, we show each owner in their own daycol
|
||||||
var daily_owner = this.day_list.length === 1 &&
|
this.daily_owner = this.day_list.length === 1 &&
|
||||||
this.options.owner.length > 1 &&
|
this.options.owner.length > 1 &&
|
||||||
this.options.owner.length < (parseInt(egw.preference('day_consolidate','calendar')) || 6);
|
this.options.owner.length < (parseInt(egw.preference('day_consolidate','calendar')) || 6);
|
||||||
var daycols_needed = daily_owner ? this.options.owner.length : this.day_list.length;
|
var daycols_needed = this.daily_owner ? this.options.owner.length : this.day_list.length;
|
||||||
var day_width = ( Math.min( $j(this.getInstanceManager().DOMContainer).width(),this.days.width())/daycols_needed);
|
var day_width = ( Math.min( $j(this.getInstanceManager().DOMContainer).width(),this.days.width())/daycols_needed);
|
||||||
if(!day_width || !this.day_list)
|
if(!day_width || !this.day_list)
|
||||||
{
|
{
|
||||||
@ -856,7 +856,9 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
|
|
||||||
while(daycols_needed > this.day_widgets.length)
|
while(daycols_needed > this.day_widgets.length)
|
||||||
{
|
{
|
||||||
var existing_index = this.day_widgets[add_index] && !daily_owner ? this.day_list.indexOf(this.day_widgets[add_index].options.date) : -1;
|
var existing_index = this.day_widgets[add_index] && !this.daily_owner ?
|
||||||
|
this.day_list.indexOf(this.day_widgets[add_index].options.date) :
|
||||||
|
-1;
|
||||||
before = existing_index > add_index;
|
before = existing_index > add_index;
|
||||||
|
|
||||||
var day = et2_createWidget('calendar-daycol',{
|
var day = et2_createWidget('calendar-daycol',{
|
||||||
@ -920,7 +922,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
|
|
||||||
// Position
|
// Position
|
||||||
day.set_left((day_width * i) + 'px');
|
day.set_left((day_width * i) + 'px');
|
||||||
if(daily_owner)
|
if(this.daily_owner)
|
||||||
{
|
{
|
||||||
// Each 'day' is the same date, different user
|
// Each 'day' is the same date, different user
|
||||||
day.set_id(this.day_list[0]+'-'+this.options.owner[i]);
|
day.set_id(this.day_list[0]+'-'+this.options.owner[i]);
|
||||||
@ -945,7 +947,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
// Don't hold on to value any longer, use the data cache for best info
|
// Don't hold on to value any longer, use the data cache for best info
|
||||||
this.value = {};
|
this.value = {};
|
||||||
|
|
||||||
if(daily_owner)
|
if(this.daily_owner)
|
||||||
{
|
{
|
||||||
this.set_label('');
|
this.set_label('');
|
||||||
}
|
}
|
||||||
@ -1038,6 +1040,11 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This binds into the egw action system. Most user interactions (drag to move, resize)
|
||||||
|
// are handled internally using jQuery directly.
|
||||||
|
var widget_object = this._actionObject || parent.getObjectById(this.id);
|
||||||
|
var aoi = new et2_action_object_impl(this,this.getDOMNode());
|
||||||
|
|
||||||
for(var i = 0; i < parent.children.length; i++)
|
for(var i = 0; i < parent.children.length; i++)
|
||||||
{
|
{
|
||||||
var parent_finder = jQuery(parent.children[i].iface.doGetDOMNode()).find(this.div);
|
var parent_finder = jQuery(parent.children[i].iface.doGetDOMNode()).find(this.div);
|
||||||
@ -1053,11 +1060,11 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
var event = event.iface.getWidget();
|
var event = event.iface.getWidget();
|
||||||
var timegrid = target.iface.getWidget() || false;
|
var timegrid = target.iface.getWidget() || false;
|
||||||
if(event === timegrid || !event || !timegrid ||
|
if(event === timegrid || !event || !timegrid ||
|
||||||
!event.options.value.owner || !timegrid.options.owner ) return false;
|
!event.options || !event.options.value.participants || !timegrid.options.owner ) return false;
|
||||||
var owner_match = false;
|
var owner_match = false;
|
||||||
if(event.options.value.participants)
|
for(var id in event.options.value.participants)
|
||||||
{
|
{
|
||||||
for(var id in event.options.value.participants)
|
if(!timegrid.daily_owner)
|
||||||
{
|
{
|
||||||
if(timegrid.options.owner === id ||
|
if(timegrid.options.owner === id ||
|
||||||
timegrid.options.owner.indexOf &&
|
timegrid.options.owner.indexOf &&
|
||||||
@ -1066,14 +1073,23 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
owner_match = true;
|
owner_match = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timegrid.iterateOver(function(col) {
|
||||||
|
if(col.div.has(timegrid.gridHover).length)
|
||||||
|
{
|
||||||
|
owner_match = owner_match || col.options.owner.indexOf(id) !== -1;
|
||||||
|
}
|
||||||
|
}, this, et2_calendar_daycol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return !owner_match;
|
var enabled = !owner_match;
|
||||||
};
|
widget_object.getActionLink('invite').enabled = enabled;
|
||||||
|
widget_object.getActionLink('change_participant').enabled = enabled;
|
||||||
|
|
||||||
// This binds into the egw action system. Most user interactions (drag to move, resize)
|
// If invite or change participant are enabled, drag is not
|
||||||
// are handled internally using jQuery directly.
|
widget_object.getActionLink('egw_link_drop').enabled = !enabled;
|
||||||
var widget_object = this._actionObject || parent.getObjectById(this.id);
|
};
|
||||||
var aoi = new et2_action_object_impl(this,this.getDOMNode());
|
|
||||||
|
|
||||||
aoi.doTriggerEvent = function(_event, _data) {
|
aoi.doTriggerEvent = function(_event, _data) {
|
||||||
// Determine target node
|
// Determine target node
|
||||||
@ -1096,8 +1112,16 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
}
|
}
|
||||||
this.getWidget()._event_drop.call($j('.calendar_d-n-d_timeCounter',_data.ui.helper)[0],this.getWidget(),event, _data.ui, dropEnd);
|
this.getWidget()._event_drop.call($j('.calendar_d-n-d_timeCounter',_data.ui.helper)[0],this.getWidget(),event, _data.ui, dropEnd);
|
||||||
}
|
}
|
||||||
var drag_listener = function(event, ui) {
|
var drag_listener = function(_event, ui) {
|
||||||
aoi.getWidget()._drag_helper($j('.calendar_d-n-d_timeCounter',ui.helper)[0],ui.helper[0],0);
|
aoi.getWidget()._drag_helper($j('.calendar_d-n-d_timeCounter',ui.helper)[0],ui.helper[0],0);
|
||||||
|
if(aoi.getWidget().daily_owner)
|
||||||
|
{
|
||||||
|
_invite_enabled(
|
||||||
|
widget_object.getActionLink('invite').actionObj,
|
||||||
|
event,
|
||||||
|
widget_object
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
var time = $j('.calendar_d-n-d_timeCounter',_data.ui.helper);
|
var time = $j('.calendar_d-n-d_timeCounter',_data.ui.helper);
|
||||||
switch(_event)
|
switch(_event)
|
||||||
@ -1121,17 +1145,14 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
{
|
{
|
||||||
event = false;
|
event = false;
|
||||||
}
|
}
|
||||||
var enabled = event ? _invite_enabled(
|
if(event)
|
||||||
widget_object.getActionLink('invite').actionObj,
|
{
|
||||||
event,
|
_invite_enabled(
|
||||||
widget_object
|
widget_object.getActionLink('invite').actionObj,
|
||||||
) : false;
|
event,
|
||||||
|
widget_object
|
||||||
widget_object.getActionLink('invite').enabled = enabled;
|
);
|
||||||
widget_object.getActionLink('change_participant').enabled = enabled;
|
}
|
||||||
|
|
||||||
// If invite or change participant are enabled, drag is not
|
|
||||||
widget_object.getActionLink('egw_link_drop').enabled = !enabled;
|
|
||||||
|
|
||||||
if(time.length)
|
if(time.length)
|
||||||
{
|
{
|
||||||
@ -1341,9 +1362,20 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var add_owner = jQuery.extend([],timegrid.options.owner);
|
||||||
|
if(timegrid.daily_owner)
|
||||||
|
{
|
||||||
|
timegrid.iterateOver(function(col) {
|
||||||
|
if(col.div.has(timegrid.gridHover).length)
|
||||||
|
{
|
||||||
|
add_owner = col.options.owner;
|
||||||
|
}
|
||||||
|
}, this, et2_calendar_daycol);
|
||||||
|
}
|
||||||
|
debugger;
|
||||||
egw().json('calendar.calendar_uiforms.ajax_invite', [
|
egw().json('calendar.calendar_uiforms.ajax_invite', [
|
||||||
button_id==='series' ? event_data.id : event_data.app_id,
|
button_id==='series' ? event_data.id : event_data.app_id,
|
||||||
timegrid.options.owner,
|
add_owner,
|
||||||
action.id === 'change_participant' ?
|
action.id === 'change_participant' ?
|
||||||
jQuery.extend([],source[i].iface.getWidget().getParent().options.owner) :
|
jQuery.extend([],source[i].iface.getWidget().getParent().options.owner) :
|
||||||
[]
|
[]
|
||||||
|
Loading…
Reference in New Issue
Block a user