mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-27 10:23:28 +01:00
Fix methods in hidden app objects could not be used as action handlers
Now nextmatch sets the etemplate's EgwApp object as context for the action manager. Actions now check and will use the set context instead of global when binding to handlers
This commit is contained in:
parent
4b9d561bbe
commit
20a48d2fe4
@ -381,15 +381,24 @@ egwFnct.prototype.setValue = function(_value)
|
||||
}
|
||||
|
||||
// egw application specific function
|
||||
else if (typeof _value == "string" &&
|
||||
_value.substr(0,15) == "javaScript:app." && app)
|
||||
else if (typeof _value === "string" &&
|
||||
_value.substr(0,15) === "javaScript:app." && app)
|
||||
{
|
||||
var parts = _value.split(".");
|
||||
if(parts.length == 3 && typeof app[parts[1]] == "object" &&
|
||||
typeof app[parts[1]][parts[2]] == "function")
|
||||
{
|
||||
this.fnct = app[parts[1]][parts[2]];
|
||||
this.context = app[parts[1]];
|
||||
var existing_func = parts.pop();
|
||||
var parent = this.context.getManager().data.context || window.app;
|
||||
for (var i = 1; i < parts.length; ++i) {
|
||||
if (typeof parent[parts[i]] !== "undefined") {
|
||||
parent = parent[parts[i]];
|
||||
}
|
||||
// Nope
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (typeof parent[existing_func] === "function") {
|
||||
this.fnct = parent[existing_func];
|
||||
this.context = parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,13 +236,14 @@ var et2_nextmatch_controller = /** @class */ (function (_super) {
|
||||
if (this._actionManager == null) {
|
||||
this._actionManager = gam.addAction("actionManager", uid);
|
||||
}
|
||||
this._actionManager.updateActions(_actions, this.egw.appName);
|
||||
var data = this._actionManager.data;
|
||||
if (data == 'undefined' || !data) {
|
||||
data = {};
|
||||
}
|
||||
data.nextmatch = this._widget;
|
||||
data.context = this._widget.getInstanceManager().app_obj;
|
||||
this._actionManager.set_data(data);
|
||||
this._actionManager.updateActions(_actions, this.egw.appName);
|
||||
// Set the default execute handler
|
||||
var self = this;
|
||||
this._actionManager.setDefaultExecute(function (_action, _senders, _target) {
|
||||
|
@ -278,14 +278,15 @@ export class et2_nextmatch_controller extends et2_dataview_controller implements
|
||||
{
|
||||
this._actionManager = gam.addAction("actionManager", uid);
|
||||
}
|
||||
this._actionManager.updateActions(_actions, this.egw.appName);
|
||||
var data = this._actionManager.data;
|
||||
if (data == 'undefined' || !data)
|
||||
{
|
||||
data = {};
|
||||
}
|
||||
data.nextmatch = this._widget;
|
||||
data.context = this._widget.getInstanceManager().app_obj;
|
||||
this._actionManager.set_data(data);
|
||||
this._actionManager.updateActions(_actions, this.egw.appName);
|
||||
|
||||
// Set the default execute handler
|
||||
var self = this;
|
||||
|
Loading…
Reference in New Issue
Block a user