forked from extern/egroupware
Add actions (Add) for blank parts of planner view
This commit is contained in:
parent
82e4696e21
commit
b3a71be4a2
@ -848,51 +848,54 @@ function egwPopupActionImplementation()
|
||||
}
|
||||
|
||||
// Add into links so it's included in menu
|
||||
if(typeof _links[paste_action.id] == 'undefined')
|
||||
if(paste_action && paste_action.enabled.exec())
|
||||
{
|
||||
_links[paste_action.id] = {
|
||||
"actionObj": paste_action,
|
||||
"enabled": false,
|
||||
"visible": clipboard != null,
|
||||
"cnt": 0
|
||||
};
|
||||
}
|
||||
while(paste_action.children.length > 0)
|
||||
{
|
||||
paste_action.children[0].remove();
|
||||
}
|
||||
|
||||
// If nothing [valid] in the clipboard, don't bother with children
|
||||
if(clipboard == null || typeof clipboard.type != 'object')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Add in actual actions as children
|
||||
for(var k in drop)
|
||||
{
|
||||
// Add some choices - need to be a copy, or they interfere with
|
||||
// the original
|
||||
var drop_clone = jQuery.extend({},drop[k].actionObj);
|
||||
drop_clone.parent = paste_action;
|
||||
drop_clone.onExecute = new egwFnct(this, null, []);
|
||||
drop_clone.set_onExecute(paste_exec);
|
||||
paste_action.children.push(drop_clone);
|
||||
paste_action.allowOnMultiple = paste_action.allowOnMultiple && drop_clone.allowOnMultiple;
|
||||
_links[k] = jQuery.extend({},drop[k]);
|
||||
_links[k].actionObj = drop_clone;
|
||||
|
||||
// Drop is allowed if clipboard types intersect drop types
|
||||
_links[k].enabled = false;
|
||||
_links[k].visible = false;
|
||||
for (var i = 0; i < drop_clone.acceptedTypes.length; i++)
|
||||
if(typeof _links[paste_action.id] == 'undefined')
|
||||
{
|
||||
if (clipboard.type.indexOf(drop_clone.acceptedTypes[i]) != -1)
|
||||
_links[paste_action.id] = {
|
||||
"actionObj": paste_action,
|
||||
"enabled": false,
|
||||
"visible": clipboard != null,
|
||||
"cnt": 0
|
||||
};
|
||||
}
|
||||
while(paste_action.children.length > 0)
|
||||
{
|
||||
paste_action.children[0].remove();
|
||||
}
|
||||
|
||||
// If nothing [valid] in the clipboard, don't bother with children
|
||||
if(clipboard == null || typeof clipboard.type != 'object')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Add in actual actions as children
|
||||
for(var k in drop)
|
||||
{
|
||||
// Add some choices - need to be a copy, or they interfere with
|
||||
// the original
|
||||
var drop_clone = jQuery.extend({},drop[k].actionObj);
|
||||
drop_clone.parent = paste_action;
|
||||
drop_clone.onExecute = new egwFnct(this, null, []);
|
||||
drop_clone.set_onExecute(paste_exec);
|
||||
paste_action.children.push(drop_clone);
|
||||
paste_action.allowOnMultiple = paste_action.allowOnMultiple && drop_clone.allowOnMultiple;
|
||||
_links[k] = jQuery.extend({},drop[k]);
|
||||
_links[k].actionObj = drop_clone;
|
||||
|
||||
// Drop is allowed if clipboard types intersect drop types
|
||||
_links[k].enabled = false;
|
||||
_links[k].visible = false;
|
||||
for (var i = 0; i < drop_clone.acceptedTypes.length; i++)
|
||||
{
|
||||
_links[paste_action.id].enabled = true;
|
||||
_links[k].enabled = true;
|
||||
_links[k].visible = true;
|
||||
break;
|
||||
if (clipboard.type.indexOf(drop_clone.acceptedTypes[i]) != -1)
|
||||
{
|
||||
_links[paste_action.id].enabled = true;
|
||||
_links[k].enabled = true;
|
||||
_links[k].visible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1389,7 +1389,7 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
|
||||
this._init_links_dnd(widget_object.manager, action_links);
|
||||
|
||||
//widget_object.updateActionLinks(action_links);
|
||||
widget_object.updateActionLinks(action_links);
|
||||
this._actionObject = widget_object;
|
||||
},
|
||||
|
||||
@ -1409,6 +1409,14 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
var drop_change_participant = mgr.getActionById('change_participant');
|
||||
var drop_invite = mgr.getActionById('invite');
|
||||
var drag_action = mgr.getActionById('egw_link_drag');
|
||||
var paste_action = mgr.getActionById('egw_paste');
|
||||
|
||||
// Disable paste action
|
||||
if(paste_action == null)
|
||||
{
|
||||
paste_action = mgr.addAction('popup', 'egw_paste', egw.lang('Paste'), egw.image('editpaste'), function(){},true);
|
||||
}
|
||||
paste_action.set_enabled(false);
|
||||
|
||||
// Check if this app supports linking
|
||||
if(!egw.link_get_registry(this.dataStorePrefix || 'calendar', 'query') ||
|
||||
@ -1583,15 +1591,24 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
_get_action_links: function(actions)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
// Disable automatic paste action, it doesn't have what is needed to work
|
||||
action_links.push({
|
||||
"actionObj": 'egw_paste',
|
||||
"enabled": false,
|
||||
"visible": false
|
||||
});
|
||||
return action_links;
|
||||
},
|
||||
|
||||
@ -2129,6 +2146,9 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
*/
|
||||
_mouse_down: function(event)
|
||||
{
|
||||
// Only left mouse button
|
||||
if(event.which !== 1) return;
|
||||
|
||||
// Ignore headers
|
||||
if(this.headers.has(event.target).length !== 0) return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user