mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Calendar - add participant or category to events created via planner view's context menu
This commit is contained in:
parent
257c1de4fe
commit
499c0a2de3
@ -1456,13 +1456,37 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
_action.menu_context && _action.menu_context.event
|
_action.menu_context && _action.menu_context.event
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Context menu has position information
|
// Non-row space in planner
|
||||||
var date = _events[0].iface.getWidget()._get_time_from_position(_action.menu_context.event.offsetX, _action.menu_context.event.offsetY);
|
// Context menu has position information, but target is not what we expact
|
||||||
|
var target = jQuery('.calendar_plannerGrid',_action.menu_context.event.currentTarget);
|
||||||
|
var y = _action.menu_context.event.pageY - target.offset().top;
|
||||||
|
var x = _action.menu_context.event.pageX - target.offset().left;
|
||||||
|
var date = _events[0].iface.getWidget()._get_time_from_position(x, y);
|
||||||
if(date)
|
if(date)
|
||||||
{
|
{
|
||||||
context.start = date.toJSON();
|
context.start = date.toJSON();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (_events[0].iface.getWidget() && _events[0].iface.getWidget().instanceOf(et2_calendar_planner_row))
|
||||||
|
{
|
||||||
|
// Empty space on a planner row
|
||||||
|
var widget = _events[0].iface.getWidget();
|
||||||
|
var parent = widget.getParent();
|
||||||
|
if(parent.options.group_by == 'month')
|
||||||
|
{
|
||||||
|
var date = parent._get_time_from_position(_action.menu_context.event.clientX, _action.menu_context.event.clientY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var date = parent._get_time_from_position(_action.menu_context.event.offsetX, _action.menu_context.event.offsetY);
|
||||||
|
}
|
||||||
|
if(date)
|
||||||
|
{
|
||||||
|
context.start = date.toJSON();
|
||||||
|
}
|
||||||
|
jQuery.extend(context, widget.getDOMNode().dataset);
|
||||||
|
|
||||||
|
}
|
||||||
else if (_events[0].iface.getWidget() && _events[0].iface.getWidget().instanceOf(et2_valueWidget))
|
else if (_events[0].iface.getWidget() && _events[0].iface.getWidget().instanceOf(et2_valueWidget))
|
||||||
{
|
{
|
||||||
// Able to extract something from the widget
|
// Able to extract something from the widget
|
||||||
|
@ -2211,7 +2211,9 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
|||||||
var interval = egw.preference('interval','calendar') || 30;
|
var interval = egw.preference('interval','calendar') || 30;
|
||||||
|
|
||||||
// Relative horizontal position, as a percentage
|
// Relative horizontal position, as a percentage
|
||||||
var rel_x = Math.min(x / jQuery('.calendar_eventRows',this.div).width(),1);
|
var width = 0;
|
||||||
|
jQuery('.calendar_eventRows',this.div).each(function() {width = Math.max(width,jQuery(this).width());});
|
||||||
|
var rel_x = Math.min(x / width,1);
|
||||||
|
|
||||||
// Relative time, in minutes from start
|
// Relative time, in minutes from start
|
||||||
var rel_time = 0;
|
var rel_time = 0;
|
||||||
|
@ -76,7 +76,9 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
|
|||||||
this.set_label(this.options.label);
|
this.set_label(this.options.label);
|
||||||
this._draw();
|
this._draw();
|
||||||
|
|
||||||
this._link_actions([]);
|
// Actions are set on the parent, so we need to explicitly get in here
|
||||||
|
// and get ours
|
||||||
|
this._link_actions(this._parent.options.actions || []);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -306,11 +308,14 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
|
|||||||
_get_action_links: function(actions)
|
_get_action_links: function(actions)
|
||||||
{
|
{
|
||||||
var action_links = [];
|
var action_links = [];
|
||||||
// TODO: determine which actions are allowed without an action (empty actions)
|
|
||||||
|
// Only these actions are allowed without a selection (empty actions)
|
||||||
|
var empty_actions = ['add'];
|
||||||
|
|
||||||
for(var i in actions)
|
for(var i in actions)
|
||||||
{
|
{
|
||||||
var action = actions[i];
|
var action = actions[i];
|
||||||
if(action.type == 'drop')
|
if(empty_actions.indexOf(action.id) !== -1 || action.type == 'drop')
|
||||||
{
|
{
|
||||||
action_links.push(typeof action.id != 'undefined' ? action.id : i);
|
action_links.push(typeof action.id != 'undefined' ? action.id : i);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user