Ask the right app when getting appObjectManager, appname might not always be the current app (e.g. running app content under admin tab)

This commit is contained in:
Hadi Nategh 2021-04-19 14:00:38 +02:00
parent fb83d97150
commit 85feb685f3
4 changed files with 9 additions and 5 deletions

View File

@ -44,9 +44,10 @@ declare function egw_getObjectManager(_id: any, _create?: boolean, _search_depth
* Returns the object manager for the current application
*
* @param {boolean} _create
* @param {string} _appName
* @return {egwActionObjectManager}
*/
declare function egw_getAppObjectManager(_create?: boolean): typeof egwActionObjectManager;
declare function egw_getAppObjectManager(_create?: boolean, _appName?: string): typeof egwActionObjectManager;
/**
* Returns the action manager for the current application
*

View File

@ -103,10 +103,11 @@ function egw_getObjectManager(_id, _create, _search_depth) {
* Returns the object manager for the current application
*
* @param {boolean} _create
* @param {string} _appName //appname might not always be the current app, e.g. running app content under admin tab
* @return {egwActionObjectManager}
*/
function egw_getAppObjectManager(_create) {
return egw_getObjectManager(egw_getAppName(), _create,1);
function egw_getAppObjectManager(_create, _appName) {
return egw_getObjectManager(_appName ?? egw_getAppName(), _create,1);
}
/**

View File

@ -740,8 +740,9 @@ var et2_grid = /** @class */ (function (_super) {
*/
et2_grid.prototype._link_actions = function (actions) {
// Get the top level element for the tree
// get appObjectManager for the actual app, it might not always be the current app(e.g. running app content under admin tab)
// @ts-ignore
var objectManager = window.egw_getAppObjectManager(true);
var objectManager = window.egw_getAppObjectManager(true, this.getInstanceManager().app);
objectManager = objectManager.getObjectById(this.getInstanceManager().uniqueId, 2) || objectManager;
var widget_object = objectManager.getObjectById(this.id);
if (widget_object == null) {

View File

@ -1002,8 +1002,9 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
_link_actions(actions : object[])
{
// Get the top level element for the tree
// get appObjectManager for the actual app, it might not always be the current app(e.g. running app content under admin tab)
// @ts-ignore
let objectManager = window.egw_getAppObjectManager(true);
let objectManager = window.egw_getAppObjectManager(true, this.getInstanceManager().app);
objectManager = objectManager.getObjectById(this.getInstanceManager().uniqueId,2) || objectManager;
let widget_object = objectManager.getObjectById(this.id);
if (widget_object == null) {