mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
WIP Multitabs:
- Fix wrong ids generated for sideboxes - Fix tab header refresh
This commit is contained in:
parent
765b545697
commit
7d1cd4c12c
@ -208,9 +208,19 @@ var AddressbookApp = /** @class */ (function (_super) {
|
||||
this.egw.openTab(id, 'addressbook', 'view', extras, {
|
||||
displayName: data.n_fn,
|
||||
icon: data.photo,
|
||||
id: id + '_' + extras.crm_list
|
||||
refreshCallback: this.view_refresh,
|
||||
id: id + '-' + extras.crm_list,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* callback for refreshing relative crm view list
|
||||
*/
|
||||
AddressbookApp.prototype.view_refresh = function () {
|
||||
var et2 = etemplate2_1.etemplate2.getById("addressbook-view-" + this.appName);
|
||||
if (et2) {
|
||||
et2.app_obj.addressbook.view_set_list();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Set link filter for the already open & rendered list
|
||||
*
|
||||
|
@ -231,10 +231,23 @@ class AddressbookApp extends EgwApp
|
||||
this.egw.openTab(id, 'addressbook', 'view', extras, {
|
||||
displayName: data.n_fn,
|
||||
icon: data.photo,
|
||||
id: id+'_'+extras.crm_list
|
||||
refreshCallback: this.view_refresh,
|
||||
id: id+'-'+extras.crm_list,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* callback for refreshing relative crm view list
|
||||
*/
|
||||
view_refresh()
|
||||
{
|
||||
let et2 = etemplate2.getById("addressbook-view-"+this.appName);
|
||||
if (et2)
|
||||
{
|
||||
et2.app_obj.addressbook.view_set_list();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set link filter for the already open & rendered list
|
||||
*
|
||||
|
@ -865,9 +865,18 @@ var etemplate2 = /** @class */ (function () {
|
||||
*/
|
||||
etemplate2.app_refresh = function (_msg, _app, _id, _type) {
|
||||
var refresh_done = false;
|
||||
var et2 = etemplate2.getByApplication(_app);
|
||||
var app = _app.split('-');
|
||||
var et2 = etemplate2.getByApplication(app[0]);
|
||||
for (var i = 0; i < et2.length; i++) {
|
||||
refresh_done = et2[i].refresh(_msg, _app, _id, _type) || refresh_done;
|
||||
if (app[1]) {
|
||||
if (et2[i]['uniqueId'].match(_app)) {
|
||||
refresh_done = et2[i].refresh(_msg, app[0], _id, _type) || refresh_done;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
refresh_done = et2[i].refresh(_msg, app[0], _id, _type) || refresh_done;
|
||||
}
|
||||
}
|
||||
return refresh_done;
|
||||
};
|
||||
@ -995,8 +1004,8 @@ var etemplate2 = /** @class */ (function () {
|
||||
}
|
||||
// handle framework.setSidebox calls
|
||||
if (window.framework && jQuery.isArray(data.setSidebox)) {
|
||||
if (data['open-target'])
|
||||
data.setSidebox[0] = data['open-target'];
|
||||
if (data['fw-target'])
|
||||
data.setSidebox[0] = data['fw-target'];
|
||||
window.framework.setSidebox.apply(window.framework, data.setSidebox);
|
||||
}
|
||||
// regular et2 re-load
|
||||
@ -1013,7 +1022,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
else {
|
||||
// Not etemplate
|
||||
var node = document.getElementById(data.DOMNodeID);
|
||||
var uniqueId = '';
|
||||
var uniqueId = data.DOMNodeID;
|
||||
if (node) {
|
||||
if (node.children.length) {
|
||||
// Node has children already? Check for loading over an
|
||||
@ -1022,11 +1031,11 @@ var etemplate2 = /** @class */ (function () {
|
||||
if (old)
|
||||
old.clear();
|
||||
}
|
||||
if (data['open_target']) {
|
||||
if (data['open_target'] && !uniqueId.match(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']);
|
||||
et2.load(data.name, data.url, data.data, null, null, null, data['fw-target']);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -1108,10 +1108,22 @@ export class etemplate2
|
||||
static app_refresh (_msg, _app, _id, _type)
|
||||
{
|
||||
let refresh_done = false;
|
||||
const et2 = etemplate2.getByApplication(_app);
|
||||
let app = _app.split('-');
|
||||
const et2 = etemplate2.getByApplication(app[0]);
|
||||
for (let i = 0; i < et2.length; i++)
|
||||
{
|
||||
refresh_done = et2[i].refresh(_msg, _app, _id, _type) || refresh_done;
|
||||
if (app[1])
|
||||
{
|
||||
if (et2[i]['uniqueId'].match(_app))
|
||||
{
|
||||
refresh_done = et2[i].refresh(_msg, app[0], _id, _type) || refresh_done;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
refresh_done = et2[i].refresh(_msg, app[0], _id, _type) || refresh_done;
|
||||
}
|
||||
}
|
||||
return refresh_done;
|
||||
}
|
||||
@ -1280,7 +1292,7 @@ export class etemplate2
|
||||
// handle framework.setSidebox calls
|
||||
if (window.framework && jQuery.isArray(data.setSidebox))
|
||||
{
|
||||
if (data['open-target']) data.setSidebox[0] = data['open-target'];
|
||||
if (data['fw-target']) data.setSidebox[0] = data['fw-target'];
|
||||
|
||||
window.framework.setSidebox.apply(window.framework, data.setSidebox);
|
||||
}
|
||||
@ -1302,7 +1314,7 @@ export class etemplate2
|
||||
{
|
||||
// Not etemplate
|
||||
const node = document.getElementById(data.DOMNodeID);
|
||||
let uniqueId = '';
|
||||
let uniqueId = data.DOMNodeID;
|
||||
if (node)
|
||||
{
|
||||
if (node.children.length)
|
||||
@ -1312,12 +1324,12 @@ export class etemplate2
|
||||
const old = etemplate2.getById(node.id);
|
||||
if (old) old.clear();
|
||||
}
|
||||
if (data['open_target'])
|
||||
if (data['open_target'] && !uniqueId.match(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']);
|
||||
et2.load(data.name, data.url, data.data, null, null, null, data['fw-target']);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -308,7 +308,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
|
||||
//Lookup whether this entry was opened before. If no data is
|
||||
//stored about this, use the information we got from the server
|
||||
var opened = egw.preference('jdots_sidebox_'+_data[i].menu_name, _app.appName);
|
||||
var opened = egw.preference('jdots_sidebox_'+_data[i].menu_name, _app.internalName);
|
||||
if (typeof opened == 'undefined')
|
||||
{
|
||||
opened = _data[i].opened;
|
||||
@ -446,7 +446,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
*/
|
||||
categoryOpenCloseCallback: function(_opened)
|
||||
{
|
||||
egw.set_preference(this.tag.appName, 'jdots_sidebox_'+this.catName, _opened);
|
||||
if (!framework.isAnInternalApp(this.tag)) egw.set_preference(this.tag.internalName, 'jdots_sidebox_'+this.catName, _opened);
|
||||
},
|
||||
|
||||
categoryAnimationCallback: function()
|
||||
@ -680,7 +680,7 @@ 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+"-"+btoa(_extra.id ? _extra.id : _link);
|
||||
this.applications[appname] = this.getApplicationByName(appname);
|
||||
if (this.applications[appname])
|
||||
{
|
||||
@ -1090,7 +1090,12 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
refresh: function(_msg, _app, _id, _type, _targetapp, _replace, _with, _msg_type)
|
||||
{
|
||||
//alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
|
||||
|
||||
let app_object = this.getApplicationByName(_app);
|
||||
if (this.isAnInternalApp(app_object) && typeof app_object.refreshCallback == 'function')
|
||||
{
|
||||
app_object.refreshCallback();
|
||||
return;
|
||||
}
|
||||
if (!_app) // force reload of entire framework, eg. when template-set changes
|
||||
{
|
||||
window.location.href = window.egw_webserverUrl+'/index.php?cd=yes'+(_msg ? '&msg='+encodeURIComponent(_msg) : '');
|
||||
@ -1255,5 +1260,15 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if the app is an internal app object like multitab views
|
||||
* @param _app app object
|
||||
* @return {boolean}
|
||||
*/
|
||||
isAnInternalApp: function(_app)
|
||||
{
|
||||
return _app.appName != _app.internalName;
|
||||
}
|
||||
});}).call(this);
|
||||
|
@ -276,7 +276,7 @@
|
||||
//Set the sidebox width if a application specific sidebox width is set
|
||||
// do not trigger resize if the sidebar is already in toggle on mode and
|
||||
// the next set state is the same
|
||||
if (_app.sideboxWidth !== false && egw.preference('toggleSidebar',_app.appName) == 'off')
|
||||
if (_app.sideboxWidth !== false && egw.preference('toggleSidebar',_app.internalName) == 'off')
|
||||
{
|
||||
this.sideboxSizeCallback(_app.sideboxWidth);
|
||||
this.splitterUi.constraints[0].size = _app.sideboxWidth;
|
||||
@ -330,7 +330,7 @@
|
||||
|
||||
if (_toggleMode !== "toggle")
|
||||
{
|
||||
egw.set_preference(this.tag.activeApp.internalName, 'jdotssideboxwidth', _width);
|
||||
if (!framework.isAnInternalApp(this.tag.activeApp)) egw.set_preference(this.tag.activeApp.internalName, 'jdotssideboxwidth', _width);
|
||||
|
||||
//If there are no global application width values, set the sidebox width of
|
||||
//the application every time the splitter is resized
|
||||
@ -441,7 +441,7 @@
|
||||
*/
|
||||
categoryOpenCloseCallback: function(_opened)
|
||||
{
|
||||
egw.set_preference(this.tag.appName, 'jdots_sidebox_'+this.catName, _opened);
|
||||
if (!framework.isAnInternalApp(this.tag)) egw.set_preference(this.tag.internalName, 'jdots_sidebox_'+this.catName, _opened);
|
||||
},
|
||||
|
||||
categoryAnimationCallback: function()
|
||||
@ -455,16 +455,16 @@
|
||||
*/
|
||||
_toggleSidebarCallback: function (_state)
|
||||
{
|
||||
var splitterWidth = egw.preference('jdotssideboxwidth',this.activeApp.appName) || this.activeApp.sideboxWidth;
|
||||
var splitterWidth = egw.preference('jdotssideboxwidth',this.activeApp.internalName) || this.activeApp.sideboxWidth;
|
||||
if (_state === "on")
|
||||
{
|
||||
this.splitterUi.resizeCallback(70,'toggle');
|
||||
egw.set_preference(this.activeApp.appName, 'toggleSidebar', 'on');
|
||||
if (!framework.isAnInternalApp(this.activeApp)) egw.set_preference(this.activeApp.internalName, 'toggleSidebar', 'on');
|
||||
}
|
||||
else
|
||||
{
|
||||
this.splitterUi.resizeCallback(splitterWidth);
|
||||
egw.set_preference(this.activeApp.appName, 'toggleSidebar', 'off');
|
||||
if (!framework.isAnInternalApp(this.activeApp)) egw.set_preference(this.activeApp.internalName, 'toggleSidebar', 'off');
|
||||
}
|
||||
},
|
||||
|
||||
@ -473,7 +473,7 @@
|
||||
*/
|
||||
getToggleSidebarState: function()
|
||||
{
|
||||
var toggleSidebar = egw.preference('toggleSidebar',this.activeApp.appName);
|
||||
var toggleSidebar = egw.preference('toggleSidebar',this.activeApp.internalName);
|
||||
this.toggleSidebarUi.set_toggle(toggleSidebar?toggleSidebar:"off", this._toggleSidebarCallback, this);
|
||||
},
|
||||
|
||||
|
@ -527,8 +527,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
$this->version=$version, $this->laod_via = $load_via);
|
||||
//error_log(__METHOD__."('$name', '$template_set', '$lang', $group, '$version', '$load_via') rel_path=".array2string($this->rel_path));
|
||||
|
||||
$this->dom_id = isset($_GET['fw_target']) && preg_match('/^[a-z0-9-]+$/i', $_GET['fw_target']) ?
|
||||
$name.'-'.$_GET['fw_target'] : $name;
|
||||
$this->dom_id = isset($_GET['fw_target']) ? $name.'-'.$_GET['fw_target'] : $name;
|
||||
|
||||
return (boolean)$this->rel_path;
|
||||
}
|
||||
|
@ -1013,7 +1013,7 @@ abstract class Ajax extends Api\Framework
|
||||
$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['fw_target']) $GLOBALS['egw']->framework->set_extra('open','target',$_GET['fw_target']);
|
||||
if ($_GET['fw_target']) $GLOBALS['egw']->framework->set_extra('fw','target',$_GET['fw_target']);
|
||||
// call application menuaction
|
||||
ob_start();
|
||||
$obj->$method();
|
||||
|
Loading…
Reference in New Issue
Block a user