WIP multitabs and CRM view

This commit is contained in:
Hadi Nategh
2020-09-30 13:19:36 +02:00
parent 9cf0724420
commit 7f4535cf1d
12 changed files with 62 additions and 75 deletions

View File

@@ -84,7 +84,7 @@ var egw_app_1 = require("../jsapi/egw_app");
* @param _menuaction is the URL to which the form data should be submitted.
*/
var etemplate2 = /** @class */ (function () {
function etemplate2(_container, _menuaction) {
function etemplate2(_container, _menuaction, _uniqueId) {
if (typeof _menuaction == "undefined") {
_menuaction = "EGroupware\\Api\\Etemplate::ajax_process_content";
}
@@ -92,7 +92,7 @@ var etemplate2 = /** @class */ (function () {
this._DOMContainer = _container;
this.menuaction = _menuaction;
// Unique ID to prevent DOM collisions across multiple templates
this.uniqueId = _container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : '';
this.uniqueId = _uniqueId ? _uniqueId : (_container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : '');
/**
* Preset the object variable
* @type {et2_container}
@@ -1013,6 +1013,7 @@ var etemplate2 = /** @class */ (function () {
else {
// Not etemplate
var node = document.getElementById(data.DOMNodeID);
var uniqueId = '';
if (node) {
if (node.children.length) {
// Node has children already? Check for loading over an
@@ -1021,7 +1022,10 @@ var etemplate2 = /** @class */ (function () {
if (old)
old.clear();
}
var et2 = new etemplate2(node, data.menuaction);
if (data['open_target']) {
uniqueId = data.DOMNodeID.replace('.', '-') + '-' + data['open_target'];
}
var et2 = new etemplate2(node, data.menuaction, uniqueId);
et2.load(data.name, data.url, data.data, null, null, null, data['open-target']);
return true;
}

View File

@@ -112,7 +112,7 @@ export class etemplate2
private app_obj: EgwApp;
app: string;
constructor(_container : HTMLElement, _menuaction? : string)
constructor(_container : HTMLElement, _menuaction? : string, _uniqueId?: string)
{
if (typeof _menuaction == "undefined")
{
@@ -124,7 +124,7 @@ export class etemplate2
this.menuaction = _menuaction;
// Unique ID to prevent DOM collisions across multiple templates
this.uniqueId = _container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : '';
this.uniqueId = _uniqueId ? _uniqueId : (_container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : '');
/**
* Preset the object variable
@@ -1302,6 +1302,7 @@ export class etemplate2
{
// Not etemplate
const node = document.getElementById(data.DOMNodeID);
let uniqueId = '';
if (node)
{
if (node.children.length)
@@ -1311,7 +1312,11 @@ export class etemplate2
const old = etemplate2.getById(node.id);
if (old) old.clear();
}
const et2 = new etemplate2(node, data.menuaction);
if (data['open_target'])
{
uniqueId = data.DOMNodeID.replace('.', '-') + '-' + data['open_target'];
}
const et2 = new etemplate2(node, data.menuaction, uniqueId);
et2.load(data.name, data.url, data.data, null, null, null, data['open-target']);
return true;
}

View File

@@ -680,9 +680,10 @@ var fw_base = (function(){ "use strict"; return Class.extend(
var app = this.parseAppFromUrl(_link);
if (app)
{
var appname = app.appName+":"+(_extra.id ? _extra.id : btoa(_link));
var appname = app.appName+"-"+(_extra.id ? _extra.id : btoa(_link));
var self = this;
// add target flag
_link += '&target='+appname;
_link += '&fw_target='+appname;
// create an actual clone of existing app object
this.applications[appname] = jQuery.extend(true, {}, app);
// merge extra framework app data into the new one
@@ -693,7 +694,9 @@ var fw_base = (function(){ "use strict"; return Class.extend(
this.applications[appname]['browser'] = null; // must be rest to create a new browser content
this.applications[appname]['sidemenuEntry'] = this.sidemenuUi.addEntry(
this.applications[appname].displayName, this.applications[appname].icon,
this.applicationClickCallback, this.applications[appname], appname);
function(){
self.applicationTabNavigate(self.applications[appname], _link, false, -1, null);
}, this.applications[appname], appname);
this.applicationTabNavigate(this.applications[appname], _link, false, -1, null);