mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
Implement openTab for egw_open object and make tab attributes configurable
This commit is contained in:
parent
6c6759549e
commit
2ed186079e
@ -198,11 +198,16 @@ var AddressbookApp = /** @class */ (function (_super) {
|
|||||||
var extras = {
|
var extras = {
|
||||||
index: index
|
index: index
|
||||||
};
|
};
|
||||||
|
var data = egw.dataGetUIDdata(_senders[0].id)['data'];
|
||||||
// CRM list
|
// CRM list
|
||||||
if (_action.id != 'view') {
|
if (_action.id != 'view') {
|
||||||
extras.crm_list = _action.id.replace('view-', '');
|
extras.crm_list = _action.id.replace('view-', '');
|
||||||
}
|
}
|
||||||
this.egw.open(id, 'addressbook', 'view', extras, '_tab', 'addressbook');
|
this.egw.openTab(id, 'addressbook', 'view', extras, {
|
||||||
|
displayName: data.n_fn,
|
||||||
|
icon: data.photo,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Set link filter for the already open & rendered list
|
* Set link filter for the already open & rendered list
|
||||||
|
@ -221,14 +221,18 @@ class AddressbookApp extends EgwApp
|
|||||||
var extras : any = {
|
var extras : any = {
|
||||||
index: index
|
index: index
|
||||||
};
|
};
|
||||||
|
var data = egw.dataGetUIDdata(_senders[0].id)['data'];
|
||||||
// CRM list
|
// CRM list
|
||||||
if(_action.id != 'view')
|
if(_action.id != 'view')
|
||||||
{
|
{
|
||||||
extras.crm_list = _action.id.replace('view-','');
|
extras.crm_list = _action.id.replace('view-','');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.egw.open(id, 'addressbook', 'view', extras, '_tab', 'addressbook');
|
this.egw.openTab(id, 'addressbook', 'view', extras, {
|
||||||
|
displayName: data.n_fn,
|
||||||
|
icon: data.photo,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,7 +153,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
|||||||
*
|
*
|
||||||
* @param {egw_fw_class_application} _app
|
* @param {egw_fw_class_application} _app
|
||||||
* @param {string} _url optional url, default index page of app
|
* @param {string} _url optional url, default index page of app
|
||||||
* @param {bool} _hidden specifies, whether the application should be set active
|
* @param {boolean} _hidden specifies, whether the application should be set active
|
||||||
* after opening the tab
|
* after opening the tab
|
||||||
* @param {int} _pos
|
* @param {int} _pos
|
||||||
* @param {status} _status
|
* @param {status} _status
|
||||||
@ -671,6 +671,32 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
tabLinkHandler: function(_link, _extra)
|
||||||
|
{
|
||||||
|
var app = this.parseAppFromUrl(_link);
|
||||||
|
if (app)
|
||||||
|
{
|
||||||
|
// add target flag
|
||||||
|
_link += '&target=_tab';
|
||||||
|
var appname = app.appName+":"+(_extra.id ? _extra.id : btoa(_link));
|
||||||
|
// create an actual clone of existing app object
|
||||||
|
this.applications[appname] = jQuery.extend(true, {}, app);
|
||||||
|
// merge extra framework app data into the new one
|
||||||
|
this.applications[appname] = jQuery.extend(true, this.applications[appname], _extra);
|
||||||
|
this.applications[appname]['appName'] = appname; // better to control it here
|
||||||
|
this.applications[appname]['indexUrl'] = _link;
|
||||||
|
this.applications[appname]['tab'] = null; // must be rest to create a new tab
|
||||||
|
this.applications[appname]['browser'] = null; // must be rest to create a new browser content
|
||||||
|
|
||||||
|
this.applicationTabNavigate(this.applications[appname], _link, false, -1, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
egw_alertHandler("No appropriate target application has been found.",
|
||||||
|
"Target link: " + _link);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {type} _link
|
* @param {type} _link
|
||||||
|
11
api/js/jsapi/egw_global.d.ts
vendored
11
api/js/jsapi/egw_global.d.ts
vendored
@ -993,6 +993,17 @@ declare interface IegwWndLocal extends IegwGlobal
|
|||||||
*/
|
*/
|
||||||
openPopup(_url : string, _width : number, _height : number|"availHeight", _windowName? : string, _app? : string|boolean,
|
openPopup(_url : string, _width : number, _height : number|"availHeight", _windowName? : string, _app? : string|boolean,
|
||||||
_returnID? : boolean, _status? : "yes"|"no", _skip_framework? : boolean) : Window|void;
|
_returnID? : boolean, _status? : "yes"|"no", _skip_framework? : boolean) : Window|void;
|
||||||
|
/**
|
||||||
|
* View an EGroupware entry: opens a framework tab for the given app entry
|
||||||
|
*
|
||||||
|
* @param {string}|int|object _id either just the id or if app=="" "app:id" or object with all data
|
||||||
|
* @param {string} _app app-name or empty (app is part of id)
|
||||||
|
* @param {string} _type default "edit", possible "view", "view_list", "edit" (falls back to "view") and "add"
|
||||||
|
* @param {object|string} _extra extra url parameters to append as object or string
|
||||||
|
* @param {object} _framework_app framework app attributes e.g. title or displayName
|
||||||
|
*/
|
||||||
|
openTab(_id, _app, _type, _extra, _framework_app) : void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get available height of screen
|
* Get available height of screen
|
||||||
*/
|
*/
|
||||||
|
@ -96,6 +96,8 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
|
|||||||
* @param {boolean} _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check
|
* @param {boolean} _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check
|
||||||
* - This option only makes sense to be enabled when the open_link requested without user interaction
|
* - This option only makes sense to be enabled when the open_link requested without user interaction
|
||||||
* @memberOf egw
|
* @memberOf egw
|
||||||
|
*
|
||||||
|
* @return {object|void} returns object for given specific target like '_tab'
|
||||||
*/
|
*/
|
||||||
open: function(id_data, app, type, extra, target, target_app, _check_popup_blocker)
|
open: function(id_data, app, type, extra, target, target_app, _check_popup_blocker)
|
||||||
{
|
{
|
||||||
@ -221,9 +223,33 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
|
|||||||
{
|
{
|
||||||
url = this.link(url, params);
|
url = this.link(url, params);
|
||||||
}
|
}
|
||||||
|
if (target == '_tab') return {url: url};
|
||||||
return this.open_link(url, target, popup, target_app, _check_popup_blocker);
|
return this.open_link(url, target, popup, target_app, _check_popup_blocker);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View an EGroupware entry: opens a framework tab for the given app entry
|
||||||
|
*
|
||||||
|
* @param {string}|int|object _id either just the id or if app=="" "app:id" or object with all data
|
||||||
|
* @param {string} _app app-name or empty (app is part of id)
|
||||||
|
* @param {string} _type default "edit", possible "view", "view_list", "edit" (falls back to "view") and "add"
|
||||||
|
* @param {object|string} _extra extra url parameters to append as object or string
|
||||||
|
* @param {object} _framework_app framework app attributes e.g. title or displayName
|
||||||
|
*/
|
||||||
|
openTab: function(_id, _app, _type, _extra, _framework_app)
|
||||||
|
{
|
||||||
|
if (_wnd.framework && _wnd.framework.tabLinkHandler)
|
||||||
|
{
|
||||||
|
var data = this.open(_id, _app, _type, _extra, "_tab", false);
|
||||||
|
// Use framework's link handler
|
||||||
|
_wnd.framework.tabLinkHandler(data.url, _framework_app);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.open(_id, _app, _type, _extra);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a link, which can be either a menuaction, a EGroupware relative url or a full url
|
* Open a link, which can be either a menuaction, a EGroupware relative url or a full url
|
||||||
*
|
*
|
||||||
@ -315,7 +341,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
|
|||||||
|
|
||||||
return popup_window;
|
return popup_window;
|
||||||
}
|
}
|
||||||
else if ((typeof _target == 'undefined' || _target == '_tab' || _target == '_self' || typeof this.link_app_list()[_target] != "undefined"))
|
else if ((typeof _target == 'undefined' || _target == '_self' || typeof this.link_app_list()[_target] != "undefined"))
|
||||||
{
|
{
|
||||||
if(_target == '_self')
|
if(_target == '_self')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user