WIP of framework's multitab implementation

This commit is contained in:
Hadi Nategh 2020-09-23 16:55:35 +02:00
parent b5ef5126c6
commit 4bf65486ef
7 changed files with 26 additions and 10 deletions

View File

@ -202,7 +202,7 @@ var AddressbookApp = /** @class */ (function (_super) {
if (_action.id != 'view') {
extras.crm_list = _action.id.replace('view-', '');
}
this.egw.open(id, 'addressbook', 'view', extras, '_self', 'addressbook');
this.egw.open(id, 'addressbook', 'view', extras, '_tab', 'addressbook');
};
/**
* Set link filter for the already open & rendered list

View File

@ -228,7 +228,7 @@ class AddressbookApp extends EgwApp
extras.crm_list = _action.id.replace('view-','');
}
this.egw.open(id, 'addressbook', 'view', extras, '_self', 'addressbook');
this.egw.open(id, 'addressbook', 'view', extras, '_tab', 'addressbook');
}
/**

View File

@ -342,8 +342,9 @@ var etemplate2 = /** @class */ (function () {
* @param {function} _callback called after template is loaded
* @param {object} _app local app object
* @param {boolean} _no_et2_ready true: do not send et2_ready, used by et2_dialog to not overwrite app.js et2 object
* @param {string} _open_target flag of string to distinguishe between tab target and normal app object
*/
etemplate2.prototype.load = function (_name, _url, _data, _callback, _app, _no_et2_ready) {
etemplate2.prototype.load = function (_name, _url, _data, _callback, _app, _no_et2_ready, _open_target) {
var app = _app || window.app;
this.name = _name; // store top-level template name to have it available in widgets
// store template base url, in case initial template is loaded via webdav, to use that for further loads too
@ -361,7 +362,7 @@ var etemplate2 = /** @class */ (function () {
var appname = _name.split('.')[0];
// if no app object provided and template app is not currentapp (eg. infolog CRM view)
// create private app object / closure with just classes / prototypes
if (!_app && appname && appname != currentapp) {
if (!_app && appname && appname != currentapp || _open_target == "_tab") {
app = { classes: window.app.classes };
}
// remember used app object, to eg. use: onchange="widget.getInstanceMgr().app_object[app].callback()"
@ -1016,7 +1017,7 @@ var etemplate2 = /** @class */ (function () {
old.clear();
}
var et2 = new etemplate2(node, data.menuaction);
et2.load(data.name, data.url, data.data);
et2.load(data.name, data.url, data.data, null, null, null, data['open-target']);
return true;
}
else {

View File

@ -436,8 +436,9 @@ export class etemplate2
* @param {function} _callback called after template is loaded
* @param {object} _app local app object
* @param {boolean} _no_et2_ready true: do not send et2_ready, used by et2_dialog to not overwrite app.js et2 object
* @param {string} _open_target flag of string to distinguishe between tab target and normal app object
*/
load(_name, _url, _data, _callback?, _app?, _no_et2_ready?)
load(_name, _url, _data, _callback?, _app?, _no_et2_ready?, _open_target?)
{
let app = _app || window.app;
this.name = _name; // store top-level template name to have it available in widgets
@ -459,7 +460,7 @@ export class etemplate2
const appname = _name.split('.')[0];
// if no app object provided and template app is not currentapp (eg. infolog CRM view)
// create private app object / closure with just classes / prototypes
if (!_app && appname && appname != currentapp)
if (!_app && appname && appname != currentapp || _open_target == "_tab")
{
app = {classes: window.app.classes};
}
@ -1307,7 +1308,7 @@ export class etemplate2
if (old) old.clear();
}
const et2 = new etemplate2(node, data.menuaction);
et2.load(data.name, data.url, data.data);
et2.load(data.name, data.url, data.data, null, null, null, data['open-target']);
return true;
}
else

View File

@ -697,6 +697,19 @@ var fw_base = (function(){ "use strict"; return Class.extend(
if (app)
{
if (_app == '_tab')
{
// add target flag
_link += '&target=_tab';
var appname = app.appName+":"+btoa(_link);
this.applications[appname] = app;
this.applications[appname]['appName'] = appname;
this.applications[appname]['indexUrl'] = _link;
this.applications[appname]['tab'] = null;
this.applications[appname]['browser'] = null;
this.applications[appname]['title'] = 'view';
app = this.getApplicationByName(appname);
}
this.applicationTabNavigate(app, _link);
}
else

View File

@ -315,7 +315,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
return popup_window;
}
else if ((typeof _target == 'undefined' || _target == '_self' || typeof this.link_app_list()[_target] != "undefined"))
else if ((typeof _target == 'undefined' || _target == '_tab' || _target == '_self' || typeof this.link_app_list()[_target] != "undefined"))
{
if(_target == '_self')
{

View File

@ -1006,7 +1006,8 @@ abstract class Ajax extends Api\Framework
// send Api\Preferences, so we dont need to request them in a second ajax request
$GLOBALS['egw']->framework->response->call('egw.set_preferences',
(array)$GLOBALS['egw_info']['user']['preferences'][$app], $app);
// flag to indicate target of output e.g. _tab
if ($_GET['target']) $GLOBALS['egw']->framework->set_extra('open','target',$_GET['target']);
// call application menuaction
ob_start();
$obj->$method();