2011-02-26 20:21:55 +01:00
|
|
|
/**
|
|
|
|
* eGroupWare egw_action framework - egw action framework
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Andreas Stöckel <as@stylite.de>
|
|
|
|
* @copyright 2011 by Andreas Stöckel
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package egw_action
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (typeof window._egwActionClasses == "undefined")
|
|
|
|
window._egwActionClasses = {}
|
|
|
|
_egwActionClasses["popup"] = {
|
|
|
|
"actionConstructor": egwPopupAction,
|
|
|
|
"implementation": getPopupImplementation
|
|
|
|
}
|
|
|
|
|
|
|
|
function egwPopupAction(_id, _handler, _caption, _icon, _onExecute, _allowOnMultiple)
|
|
|
|
{
|
|
|
|
var action = new egwAction(_id, _handler, _caption, _icon, _onExecute, _allowOnMultiple);
|
|
|
|
action.type = "popup";
|
2011-03-23 15:05:39 +01:00
|
|
|
action.canHaveChildren = ["popup"];
|
2011-02-26 20:21:55 +01:00
|
|
|
action["default"] = false;
|
|
|
|
action.order = 0;
|
|
|
|
action.group = 0;
|
Fixed problems with executeActionImplementation when called from a container object, fixed problem with popup menu which did not open in some cases, added the ability to use the 'enabled' property of an action as an callback function (actionObject is passed as parameter), introduced egwFnct-class which consistently handles 'javaScript:fnct' strings, added 'allowOnMultiple':'only' setting, added 'hint', 'checkbox', 'checked', 'radioGroup' properties to popup actions, added 'setDefaultExecute' function to egwAction objects, which applies an handler to all objects which don't have a handler yet
2011-04-17 17:38:46 +02:00
|
|
|
action.hint = false;
|
|
|
|
action.checkbox = false;
|
|
|
|
action.radioGroup = 0;
|
|
|
|
action.checked = false;
|
2011-02-26 20:21:55 +01:00
|
|
|
|
|
|
|
action.set_default = function(_value) {
|
|
|
|
action["default"] = _value;
|
|
|
|
}
|
|
|
|
|
|
|
|
action.set_order = function(_value) {
|
|
|
|
action.order = _value;
|
|
|
|
}
|
|
|
|
|
|
|
|
action.set_group = function(_value) {
|
|
|
|
action.group = _value;
|
|
|
|
}
|
|
|
|
|
Fixed problems with executeActionImplementation when called from a container object, fixed problem with popup menu which did not open in some cases, added the ability to use the 'enabled' property of an action as an callback function (actionObject is passed as parameter), introduced egwFnct-class which consistently handles 'javaScript:fnct' strings, added 'allowOnMultiple':'only' setting, added 'hint', 'checkbox', 'checked', 'radioGroup' properties to popup actions, added 'setDefaultExecute' function to egwAction objects, which applies an handler to all objects which don't have a handler yet
2011-04-17 17:38:46 +02:00
|
|
|
action.set_hint = function(_value) {
|
|
|
|
action.hint = _value;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If true, the action will be rendered as checkbox
|
|
|
|
action.set_checkbox = function(_value) {
|
|
|
|
action.checkbox = _value;
|
|
|
|
}
|
|
|
|
|
|
|
|
action.set_checked = function(_value) {
|
|
|
|
action.checked = _value;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If radioGroup is >0 and the element is a checkbox, radioGroup specifies
|
|
|
|
// the group of radio buttons this one belongs to
|
|
|
|
action.set_radioGroup = function(_value) {
|
|
|
|
action.radioGroup = _value;
|
|
|
|
}
|
|
|
|
|
2011-02-26 20:21:55 +01:00
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
var
|
|
|
|
_popupActionImpl = null;
|
|
|
|
|
|
|
|
function getPopupImplementation()
|
|
|
|
{
|
|
|
|
if (!_popupActionImpl)
|
|
|
|
{
|
|
|
|
_popupActionImpl = new egwPopupActionImplementation();
|
|
|
|
}
|
|
|
|
return _popupActionImpl
|
|
|
|
}
|
|
|
|
|
|
|
|
function egwPopupActionImplementation()
|
|
|
|
{
|
|
|
|
var ai = new egwActionImplementation();
|
|
|
|
|
|
|
|
ai.type = "popup";
|
|
|
|
|
2011-06-03 00:53:23 +02:00
|
|
|
/**
|
|
|
|
* Registers the handler for the default action
|
|
|
|
*/
|
|
|
|
ai._registerDefault = function(_node, _callback, _context) {
|
|
|
|
var defaultHandler = function(e) {
|
|
|
|
if (typeof document.selection != "undefined" && typeof document.selection.empty != "undefined")
|
|
|
|
{
|
|
|
|
document.selection.empty();
|
|
|
|
}
|
|
|
|
else if( typeof window.getSelection != "undefined")
|
|
|
|
{
|
|
|
|
var sel = window.getSelection();
|
|
|
|
sel.removeAllRanges();
|
|
|
|
}
|
2011-02-26 20:21:55 +01:00
|
|
|
|
2011-06-03 00:53:23 +02:00
|
|
|
_callback.call(_context, "default", ai);
|
2011-03-16 18:50:25 +01:00
|
|
|
|
2011-06-03 00:53:23 +02:00
|
|
|
return false;
|
|
|
|
}
|
2011-03-14 21:11:08 +01:00
|
|
|
|
2011-06-03 00:53:23 +02:00
|
|
|
if (egwIsMobile()) {
|
|
|
|
$(_node).bind('click', defaultHandler);
|
|
|
|
} else {
|
2011-06-03 13:21:36 +02:00
|
|
|
_node.ondblclick = defaultHandler;
|
2011-06-03 00:53:23 +02:00
|
|
|
}
|
|
|
|
}
|
2011-03-14 21:11:08 +01:00
|
|
|
|
2011-06-16 15:43:46 +02:00
|
|
|
ai._getDefaultLink = function(_links) {
|
|
|
|
var defaultAction = null;
|
|
|
|
for (var k in _links)
|
|
|
|
{
|
|
|
|
if (_links[k].actionObj["default"] && _links[k].enabled)
|
|
|
|
{
|
|
|
|
defaultAction = _links[k].actionObj;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return defaultAction;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles a key press
|
|
|
|
*/
|
|
|
|
ai._handleKeyPress = function(_key, _selected, _links, _target) {
|
|
|
|
if (_key.keyCode == EGW_KEY_ENTER && !_key.ctrl && !_key.shift && !_key.alt) {
|
|
|
|
var defaultAction = this._getDefaultLink(_links);
|
|
|
|
if (defaultAction)
|
|
|
|
{
|
|
|
|
defaultAction.execute(_selected);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-03 00:53:23 +02:00
|
|
|
/**
|
|
|
|
* Registers the handler for the context menu
|
|
|
|
*/
|
|
|
|
ai._registerContext = function(_node, _callback, _context) {
|
|
|
|
var contextHandler = function(e) {
|
|
|
|
//Obtain the event object
|
|
|
|
if (!e)
|
|
|
|
{
|
|
|
|
e = window.event;
|
|
|
|
}
|
2011-02-26 20:21:55 +01:00
|
|
|
|
2011-06-03 00:53:23 +02:00
|
|
|
if (_egw_active_menu)
|
|
|
|
{
|
|
|
|
_egw_active_menu.hide()
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_xy = ai._getPageXY(e);
|
|
|
|
_callback.call(_context, _xy, ai);
|
|
|
|
}
|
2011-02-26 20:21:55 +01:00
|
|
|
|
2011-06-03 00:53:23 +02:00
|
|
|
e.cancelBubble = true;
|
|
|
|
if (e.stopPropagation)
|
|
|
|
{
|
|
|
|
e.stopPropagation();
|
2011-02-26 20:21:55 +01:00
|
|
|
}
|
2011-06-03 00:53:23 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (egwIsMobile()) {
|
|
|
|
$(_node).bind('taphold', contextHandler);
|
|
|
|
} else {
|
|
|
|
_node.oncontextmenu = contextHandler;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ai.doRegisterAction = function(_aoi, _callback, _context)
|
|
|
|
{
|
|
|
|
var node = _aoi.getDOMNode();
|
2011-03-02 22:18:20 +01:00
|
|
|
|
2011-06-03 00:53:23 +02:00
|
|
|
if (node)
|
|
|
|
{
|
|
|
|
this._registerDefault(node, _callback, _context);
|
|
|
|
this._registerContext(node, _callback, _context);
|
2011-03-02 22:18:20 +01:00
|
|
|
return true;
|
2011-02-26 20:21:55 +01:00
|
|
|
}
|
2011-03-02 22:18:20 +01:00
|
|
|
return false;
|
2011-02-26 20:21:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ai.doUnregisterAction = function(_aoi)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
2011-02-26 21:40:27 +01:00
|
|
|
/**
|
|
|
|
* Builds the context menu and shows it at the given position/DOM-Node.
|
|
|
|
*/
|
2011-03-24 18:06:44 +01:00
|
|
|
ai.doExecuteImplementation = function(_context, _selected, _links, _target)
|
2011-02-26 20:21:55 +01:00
|
|
|
{
|
2011-03-24 18:06:44 +01:00
|
|
|
if (typeof _target == "undefined")
|
|
|
|
{
|
|
|
|
_target = null;
|
|
|
|
}
|
|
|
|
|
2011-06-16 15:43:46 +02:00
|
|
|
if (typeof _context == "object" && typeof _context.keyEvent == "object")
|
|
|
|
{
|
|
|
|
return ai._handleKeyPress(_context.keyEvent, _selected, _links, _target);
|
|
|
|
}
|
|
|
|
else if (_context != "default")
|
2011-02-26 21:40:27 +01:00
|
|
|
{
|
2011-03-14 21:11:08 +01:00
|
|
|
//Check whether the context has the posx and posy parameters
|
|
|
|
if ((typeof _context.posx != "number" || typeof _context.posy != "number") &&
|
|
|
|
typeof _context.id != "undefined")
|
|
|
|
{
|
|
|
|
// Calculate context menu position from the given DOM-Node
|
|
|
|
var node = _context;
|
2011-02-26 21:40:27 +01:00
|
|
|
|
Fixed problems with executeActionImplementation when called from a container object, fixed problem with popup menu which did not open in some cases, added the ability to use the 'enabled' property of an action as an callback function (actionObject is passed as parameter), introduced egwFnct-class which consistently handles 'javaScript:fnct' strings, added 'allowOnMultiple':'only' setting, added 'hint', 'checkbox', 'checked', 'radioGroup' properties to popup actions, added 'setDefaultExecute' function to egwAction objects, which applies an handler to all objects which don't have a handler yet
2011-04-17 17:38:46 +02:00
|
|
|
x = $(node).offset().left;
|
|
|
|
y = $(node).offset().top;
|
2011-02-26 21:40:27 +01:00
|
|
|
|
2011-03-14 21:11:08 +01:00
|
|
|
_context = {"posx": x, "posy": y}
|
|
|
|
}
|
|
|
|
|
2011-03-24 18:06:44 +01:00
|
|
|
var menu = ai._buildMenu(_links, _selected, _target);
|
2011-03-14 21:11:08 +01:00
|
|
|
menu.showAt(_context.posx, _context.posy);
|
|
|
|
|
|
|
|
return true;
|
2011-02-26 21:40:27 +01:00
|
|
|
}
|
2011-03-14 21:11:08 +01:00
|
|
|
else
|
|
|
|
{
|
2011-06-16 15:43:46 +02:00
|
|
|
var defaultAction = ai._getDefaultLink(_links);
|
2011-03-14 21:11:08 +01:00
|
|
|
if (defaultAction)
|
|
|
|
{
|
|
|
|
defaultAction.execute(_selected);
|
|
|
|
}
|
|
|
|
}
|
2011-02-26 21:40:27 +01:00
|
|
|
|
2011-03-14 21:11:08 +01:00
|
|
|
return false;
|
2011-02-26 20:21:55 +01:00
|
|
|
}
|
|
|
|
|
2011-02-26 21:40:27 +01:00
|
|
|
/**
|
2011-03-23 15:05:39 +01:00
|
|
|
* Groups and sorts the given action tree layer
|
2011-02-26 21:40:27 +01:00
|
|
|
*/
|
2011-03-23 15:05:39 +01:00
|
|
|
ai._groupLayers = function(_layer, _links, _parentGroup)
|
2011-02-26 20:21:55 +01:00
|
|
|
{
|
2011-03-23 15:05:39 +01:00
|
|
|
// Seperate the multiple groups out of the layer
|
2011-02-26 20:21:55 +01:00
|
|
|
var link_groups = {};
|
2011-03-23 15:05:39 +01:00
|
|
|
|
|
|
|
for (var i = 0; i < _layer.children.length; i++)
|
2011-02-26 20:21:55 +01:00
|
|
|
{
|
2011-03-23 15:05:39 +01:00
|
|
|
var actionObj = _layer.children[i].action;
|
|
|
|
|
2011-02-26 20:21:55 +01:00
|
|
|
// Check whether the link group of the current element already exists,
|
|
|
|
// if not, create the group
|
2011-03-23 15:05:39 +01:00
|
|
|
var grp = actionObj.group;
|
2011-02-26 20:21:55 +01:00
|
|
|
if (typeof link_groups[grp] == "undefined")
|
|
|
|
{
|
|
|
|
link_groups[grp] = [];
|
|
|
|
}
|
|
|
|
|
2011-03-23 15:05:39 +01:00
|
|
|
// Search the link data for this action object if none is found,
|
|
|
|
// visible and enabled = true is assumed
|
|
|
|
var visible = true;
|
|
|
|
var enabled = true;
|
|
|
|
|
|
|
|
if (typeof _links[actionObj.id] != "undefined")
|
|
|
|
{
|
|
|
|
visible = _links[actionObj.id].visible;
|
|
|
|
enabled = _links[actionObj.id].enabled;
|
|
|
|
}
|
|
|
|
|
2011-02-26 20:21:55 +01:00
|
|
|
// Insert the element in order
|
|
|
|
var inserted = false;
|
2011-03-23 15:05:39 +01:00
|
|
|
var groupObj = {
|
|
|
|
"actionObj": actionObj,
|
|
|
|
"visible": visible,
|
|
|
|
"enabled": enabled,
|
|
|
|
"groups": []
|
|
|
|
};
|
|
|
|
|
|
|
|
for (var j = 0; j < link_groups[grp].length; j++)
|
2011-02-26 20:21:55 +01:00
|
|
|
{
|
2011-03-23 15:05:39 +01:00
|
|
|
var elem = link_groups[grp][j].actionObj;
|
|
|
|
if (elem.order > actionObj.order)
|
2011-02-26 20:21:55 +01:00
|
|
|
{
|
|
|
|
inserted = true;
|
2011-03-23 15:05:39 +01:00
|
|
|
link_groups[grp].splice(j, 0, groupObj);
|
2011-02-26 20:21:55 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the object hasn't been inserted, add it to the end of the list
|
|
|
|
if (!inserted)
|
|
|
|
{
|
2011-03-23 15:05:39 +01:00
|
|
|
link_groups[grp].push(groupObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If this child itself has children, group those elements too
|
|
|
|
if (_layer.children[i].children.length > 0)
|
|
|
|
{
|
|
|
|
this._groupLayers(_layer.children[i], _links, groupObj);
|
2011-02-26 20:21:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-23 15:05:39 +01:00
|
|
|
// Transform the link_groups object into an sorted array
|
2011-02-26 20:21:55 +01:00
|
|
|
var groups = [];
|
2011-03-23 15:05:39 +01:00
|
|
|
|
2011-04-23 11:07:31 +02:00
|
|
|
for (var k in link_groups)
|
2011-03-23 15:05:39 +01:00
|
|
|
{
|
2011-02-26 20:21:55 +01:00
|
|
|
groups.push({"grp": k, "links": link_groups[k]});
|
2011-03-23 15:05:39 +01:00
|
|
|
}
|
|
|
|
|
2011-02-26 20:21:55 +01:00
|
|
|
groups.sort(function(a, b) {
|
2011-03-23 15:05:39 +01:00
|
|
|
var ia = parseInt(a.grp);
|
|
|
|
var ib = parseInt(b.grp);
|
|
|
|
return (ia > ib) ? 1 : ((ia < ib) ? -1 : 0);
|
2011-02-26 20:21:55 +01:00
|
|
|
});
|
|
|
|
|
2011-03-23 15:05:39 +01:00
|
|
|
// Append the groups to the groups2 array
|
|
|
|
var groups2 = [];
|
2011-03-25 14:12:24 +01:00
|
|
|
for (var i = 0; i < groups.length; i++)
|
2011-03-23 15:05:39 +01:00
|
|
|
{
|
2011-03-25 14:12:24 +01:00
|
|
|
groups2.push(groups[i].links);
|
2011-03-23 15:05:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_parentGroup.groups = groups2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the menu layers
|
|
|
|
*/
|
2011-03-24 18:06:44 +01:00
|
|
|
ai._buildMenuLayer = function(_menu, _groups, _selected, _enabled, _target)
|
2011-03-23 15:05:39 +01:00
|
|
|
{
|
2011-03-23 21:08:33 +01:00
|
|
|
var firstGroup = true;
|
|
|
|
|
2011-03-23 15:05:39 +01:00
|
|
|
for (var i = 0; i < _groups.length; i++)
|
2011-02-26 20:21:55 +01:00
|
|
|
{
|
2011-03-23 21:08:33 +01:00
|
|
|
var firstElem = true;
|
2011-02-26 20:21:55 +01:00
|
|
|
|
|
|
|
// Go through the elements of each group
|
2011-03-23 15:05:39 +01:00
|
|
|
for (var j = 0; j < _groups[i].length; j++)
|
2011-02-26 20:21:55 +01:00
|
|
|
{
|
2011-03-23 15:05:39 +01:00
|
|
|
var link = _groups[i][j];
|
|
|
|
|
2011-02-26 20:21:55 +01:00
|
|
|
if (link.visible)
|
|
|
|
{
|
2011-03-23 21:08:33 +01:00
|
|
|
// Add an seperator after each group
|
|
|
|
if (!firstGroup && firstElem)
|
|
|
|
{
|
|
|
|
_menu.addItem("", "-");
|
|
|
|
}
|
|
|
|
firstElem = false;
|
|
|
|
|
2011-03-23 15:05:39 +01:00
|
|
|
var item = _menu.addItem(link.actionObj.id, link.actionObj.caption,
|
2011-02-26 20:21:55 +01:00
|
|
|
link.actionObj.iconUrl);
|
2011-03-14 21:11:08 +01:00
|
|
|
item["default"] = link.actionObj["default"];
|
Fixed problems with executeActionImplementation when called from a container object, fixed problem with popup menu which did not open in some cases, added the ability to use the 'enabled' property of an action as an callback function (actionObject is passed as parameter), introduced egwFnct-class which consistently handles 'javaScript:fnct' strings, added 'allowOnMultiple':'only' setting, added 'hint', 'checkbox', 'checked', 'radioGroup' properties to popup actions, added 'setDefaultExecute' function to egwAction objects, which applies an handler to all objects which don't have a handler yet
2011-04-17 17:38:46 +02:00
|
|
|
|
|
|
|
// As this code is also used when a drag-drop popup menu is built,
|
|
|
|
// we have to perform this check
|
|
|
|
if (link.actionObj.type == "popup")
|
|
|
|
{
|
|
|
|
item.set_hint(link.actionObj.hint);
|
|
|
|
item.set_checkbox(link.actionObj.checkbox);
|
|
|
|
item.set_checked(link.actionObj.checked);
|
|
|
|
item.set_groupIndex(link.actionObj.radioGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
item.set_data(link.actionObj);
|
2011-03-23 15:05:39 +01:00
|
|
|
if (link.enabled && _enabled)
|
2011-02-26 20:21:55 +01:00
|
|
|
{
|
|
|
|
item.set_onClick(function(elem) {
|
Fixed problems with executeActionImplementation when called from a container object, fixed problem with popup menu which did not open in some cases, added the ability to use the 'enabled' property of an action as an callback function (actionObject is passed as parameter), introduced egwFnct-class which consistently handles 'javaScript:fnct' strings, added 'allowOnMultiple':'only' setting, added 'hint', 'checkbox', 'checked', 'radioGroup' properties to popup actions, added 'setDefaultExecute' function to egwAction objects, which applies an handler to all objects which don't have a handler yet
2011-04-17 17:38:46 +02:00
|
|
|
// Copy the "checked" state
|
2011-04-17 19:55:37 +02:00
|
|
|
if (typeof elem.data.checked != "undefined")
|
|
|
|
{
|
|
|
|
elem.data.checked = elem.checked;
|
|
|
|
}
|
|
|
|
|
|
|
|
elem.data.execute(_selected, _target);
|
|
|
|
|
|
|
|
if (typeof elem.data.checkbox != "undefined" && elem.data.checkbox)
|
|
|
|
{
|
|
|
|
return elem.data.checked;
|
|
|
|
}
|
2011-02-26 20:21:55 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
item.set_enabled(false);
|
|
|
|
}
|
2011-03-23 15:05:39 +01:00
|
|
|
|
|
|
|
// Append the parent groups
|
|
|
|
if (link.groups)
|
|
|
|
{
|
2011-03-24 18:06:44 +01:00
|
|
|
this._buildMenuLayer(item, link.groups, _selected, link.enabled, _target);
|
2011-03-23 15:05:39 +01:00
|
|
|
}
|
2011-02-26 20:21:55 +01:00
|
|
|
}
|
|
|
|
}
|
2011-03-23 21:08:33 +01:00
|
|
|
|
|
|
|
firstGroup = firstGroup && firstElem;
|
2011-02-26 20:21:55 +01:00
|
|
|
}
|
2011-03-23 15:05:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds the context menu from the given action links
|
|
|
|
*/
|
2011-03-24 18:06:44 +01:00
|
|
|
ai._buildMenu = function(_links, _selected, _target)
|
2011-03-23 15:05:39 +01:00
|
|
|
{
|
|
|
|
// Build a tree containing all actions
|
|
|
|
var tree = {"root": []};
|
|
|
|
|
2011-04-23 11:07:31 +02:00
|
|
|
for (var k in _links)
|
2011-03-23 15:05:39 +01:00
|
|
|
{
|
|
|
|
_links[k].actionObj.appendToTree(tree);
|
|
|
|
}
|
|
|
|
|
2011-03-23 15:36:25 +01:00
|
|
|
// We need the dummy object container in order to pass the array by
|
|
|
|
// reference
|
2011-03-23 15:05:39 +01:00
|
|
|
var groups = {
|
|
|
|
"groups": []
|
|
|
|
};
|
|
|
|
|
|
|
|
if (tree.root.length > 0)
|
|
|
|
{
|
|
|
|
// Sort every action object layer by the given sort position and grouping
|
|
|
|
this._groupLayers(tree.root[0], _links, groups);
|
|
|
|
}
|
|
|
|
|
|
|
|
var menu = new egwMenu();
|
|
|
|
|
|
|
|
// Build the menu layers
|
2011-03-24 18:06:44 +01:00
|
|
|
this._buildMenuLayer(menu, groups.groups, _selected, true, _target);
|
2011-02-26 20:21:55 +01:00
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2011-02-26 21:40:27 +01:00
|
|
|
ai._getPageXY = function getPageXY(event)
|
|
|
|
{
|
|
|
|
// document.body.scrollTop does not work in IE
|
|
|
|
var scrollTop = document.body.scrollTop ? document.body.scrollTop :
|
|
|
|
document.documentElement.scrollTop;
|
|
|
|
var scrollLeft = document.body.scrollLeft ? document.body.scrollLeft :
|
|
|
|
document.documentElement.scrollLeft;
|
|
|
|
|
|
|
|
return {'posx': (event.clientX + scrollLeft), 'posy': (event.clientY + scrollTop)};
|
|
|
|
}
|
|
|
|
|
2011-02-26 20:21:55 +01:00
|
|
|
return ai;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|