got tree-actions in admin working and fixed tutorials (et2.load() stalled if no app.js or lang-files)

This commit is contained in:
Ralf Becker 2021-06-10 14:54:16 +02:00
parent 31c7b87faa
commit 77a4aad7d6
5 changed files with 29 additions and 18 deletions

View File

@ -1,25 +1,27 @@
/** /**
* eGroupWare egw_dragdrop_dhtmlxmenu - egw action framework * EGroupware egw_dragdrop_dhtmlxmenu - egw action framework
* *
* @link http://www.egroupware.org * @link https://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de> * @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel * @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action * @package egw_action
* @version $Id$
*/ */
/*egw:uses /*egw:uses
egw_action; egw_action;
*/ */
import {EGW_AO_STATE_FOCUSED, EGW_AO_STATE_SELECTED, egwActionObjectInterface, EGW_AI_DRAG_OVER, EGW_AI_DRAG_OUT} from "./egw_action";
import {egwBitIsSet} from "./egw_action_common";
/** /**
* This file contains an egw_actionObjectInterface which allows a dhtmlx tree * This file contains an egw_actionObjectInterface which allows a dhtmlx tree
* row to be a drag target and contains a function which transforms a complete * row to be a drag target and contains a function which transforms a complete
* dhtmlx tree into egw_actionObjects * dhtmlx tree into egw_actionObjects
*/ */
function dhtmlxTree_getNode(_tree, _itemId) { export function dhtmlxTree_getNode(_tree, _itemId) {
var node = _tree._globalIdStorageFind(_itemId); var node = _tree._globalIdStorageFind(_itemId);
if (node != null) if (node != null)
{ {
@ -31,7 +33,7 @@ function dhtmlxTree_getNode(_tree, _itemId) {
// An action object interface for an dhtmlxTree entry - it only contains the // An action object interface for an dhtmlxTree entry - it only contains the
// code needed for drag/drop handling // code needed for drag/drop handling
function dhtmlxtreeItemAOI(_tree, _itemId) export function dhtmlxtreeItemAOI(_tree, _itemId)
{ {
var aoi = new egwActionObjectInterface(); var aoi = new egwActionObjectInterface();

View File

@ -25,7 +25,8 @@ import { ClassWithAttributes } from "./et2_core_inheritance";
import { et2_no_init } from "./et2_core_common"; import { et2_no_init } from "./et2_core_common";
import { egw, framework } from "../jsapi/egw_global"; import { egw, framework } from "../jsapi/egw_global";
import { EGW_AO_FLAG_IS_CONTAINER, egw_getAppObjectManager, egw_getObjectManager, egwActionObject } from "../egw_action/egw_action.js"; import { EGW_AO_FLAG_IS_CONTAINER, egw_getAppObjectManager, egw_getObjectManager, egwActionObject } from "../egw_action/egw_action.js";
import { egwIsMobile } from "../egw_action/egw_action_common"; import { dhtmlxtreeItemAOI } from "../egw_action/egw_dragdrop_dhtmlx_tree.js";
import { egwIsMobile } from "../egw_action/egw_action_common.js";
/* no module, but egw:uses is ignored, so adding it here commented out /* no module, but egw:uses is ignored, so adding it here commented out
import '../../../api/js/dhtmlxtree/sources/dhtmlxtree.js'; import '../../../api/js/dhtmlxtree/sources/dhtmlxtree.js';
import '../../../api/js/dhtmlxtree/sources/ext/dhtmlxtree_json.js'; import '../../../api/js/dhtmlxtree/sources/ext/dhtmlxtree_json.js';

View File

@ -27,7 +27,8 @@ import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_no_init} from "./et2_core_common"; import {et2_no_init} from "./et2_core_common";
import {egw, framework} from "../jsapi/egw_global"; import {egw, framework} from "../jsapi/egw_global";
import {EGW_AO_FLAG_IS_CONTAINER, egw_getAppObjectManager, egw_getObjectManager, egwActionObject} from "../egw_action/egw_action.js"; import {EGW_AO_FLAG_IS_CONTAINER, egw_getAppObjectManager, egw_getObjectManager, egwActionObject} from "../egw_action/egw_action.js";
import {egwIsMobile} from "../egw_action/egw_action_common"; import {dhtmlxtreeItemAOI} from "../egw_action/egw_dragdrop_dhtmlx_tree.js";
import {egwIsMobile} from "../egw_action/egw_action_common.js";
/* no module, but egw:uses is ignored, so adding it here commented out /* no module, but egw:uses is ignored, so adding it here commented out
import '../../../api/js/dhtmlxtree/sources/dhtmlxtree.js'; import '../../../api/js/dhtmlxtree/sources/dhtmlxtree.js';

View File

@ -18,6 +18,7 @@ import { et2_compileLegacyJS } from "./et2_core_legacyJSFunctions";
import { et2_loadXMLFromURL } from "./et2_core_xml"; import { et2_loadXMLFromURL } from "./et2_core_xml";
import { et2_nextmatch, et2_nextmatch_header_bar } from "./et2_extension_nextmatch"; import { et2_nextmatch, et2_nextmatch_header_bar } from "./et2_extension_nextmatch";
import '../jsapi/egw_json.js'; import '../jsapi/egw_json.js';
import { egwIsMobile } from "../egw_action/egw_action_common";
/* Include all widget classes here, we only care about them registering, not importing anything /* Include all widget classes here, we only care about them registering, not importing anything
import './et2_widget_template'; import './et2_widget_template';
import './et2_widget_grid'; import './et2_widget_grid';
@ -375,12 +376,14 @@ export class etemplate2 {
var start_time = (new Date).getTime(); var start_time = (new Date).getTime();
} }
// require necessary translations from server AND the app.js file, if not already loaded // require necessary translations from server AND the app.js file, if not already loaded
if (!jQuery.isArray(_data.langRequire)) let promisses = [];
_data.langRequire = []; if (Array.isArray(_data.langRequire)) {
Promise.all([ promisses.push(egw(currentapp, window).langRequire(window, _data.langRequire));
egw(currentapp, window).langRequire(window, _data.langRequire), }
egw(currentapp, window).includeJS('/' + appname + '/js/app.js', undefined, undefined, egw.webserverUrl) if (appname) {
]).catch((err) => { promisses.push(egw(currentapp, window).includeJS('/' + appname + '/js/app.js', undefined, undefined, egw.webserverUrl));
}
Promise.all(promisses).catch((err) => {
console.log("et2.load(): error loading lang-files and app.js: " + err.message); console.log("et2.load(): error loading lang-files and app.js: " + err.message);
}).then(() => { }).then(() => {
this.clear(); this.clear();

View File

@ -85,6 +85,7 @@ import {et2_loadXMLFromURL} from "./et2_core_xml";
import {et2_nextmatch, et2_nextmatch_header_bar} from "./et2_extension_nextmatch"; import {et2_nextmatch, et2_nextmatch_header_bar} from "./et2_extension_nextmatch";
import {et2_tabbox} from "./et2_widget_tabs"; import {et2_tabbox} from "./et2_widget_tabs";
import '../jsapi/egw_json.js'; import '../jsapi/egw_json.js';
import {egwIsMobile} from "../egw_action/egw_action_common";
/* Include all widget classes here, we only care about them registering, not importing anything /* Include all widget classes here, we only care about them registering, not importing anything
import './et2_widget_template'; import './et2_widget_template';
@ -564,11 +565,14 @@ export class etemplate2
} }
// require necessary translations from server AND the app.js file, if not already loaded // require necessary translations from server AND the app.js file, if not already loaded
if (!jQuery.isArray(_data.langRequire)) _data.langRequire = []; let promisses = [];
Promise.all([ if (Array.isArray(_data.langRequire)) {
egw(currentapp, window).langRequire(window, _data.langRequire), promisses.push(egw(currentapp, window).langRequire(window, _data.langRequire));
egw(currentapp, window).includeJS('/'+appname+'/js/app.js', undefined, undefined, egw.webserverUrl) }
]).catch((err) => { if (appname) {
promisses.push(egw(currentapp, window).includeJS('/'+appname+'/js/app.js', undefined, undefined, egw.webserverUrl));
}
Promise.all(promisses).catch((err) => {
console.log("et2.load(): error loading lang-files and app.js: "+err.message); console.log("et2.load(): error loading lang-files and app.js: "+err.message);
}).then(() => { }).then(() => {
this.clear(); this.clear();