some egw object interface changes and using it in app.ts base object

This commit is contained in:
Ralf Becker 2020-01-27 13:43:13 +01:00
parent 5b5c2a6cff
commit 9f574b4a38
2 changed files with 27 additions and 6 deletions

View File

@ -108,7 +108,7 @@ export abstract class EgwApp
* *
* @var {egw} * @var {egw}
*/ */
egw: any; egw: IegwAppLocal;
sidebox: JQuery; sidebox: JQuery;
@ -428,7 +428,7 @@ export abstract class EgwApp
url = egw.link('/index.php', jQuery.extend({'favorite': safe_name}, egw.link_get_registry(this.appname, 'list'))); url = egw.link('/index.php', jQuery.extend({'favorite': safe_name}, egw.link_get_registry(this.appname, 'list')));
} }
// if no list try index value from application // if no list try index value from application
else if (egw.app(this.appname).index) else if (egw.app(this.appname)?.index)
{ {
url = egw.link('/index.php', 'menuaction='+egw.app(this.appname).index+'&favorite='+safe_name); url = egw.link('/index.php', 'menuaction='+egw.app(this.appname).index+'&favorite='+safe_name);
} }

View File

@ -21,7 +21,24 @@ declare var egw : Iegw;
/** /**
* Interface for global egw with window global or local methods or as function returning an object allowing also application local methods * Interface for global egw with window global or local methods or as function returning an object allowing also application local methods
*/ */
declare interface Iegw extends IegwWndLocal { (_app : string, _wnd? : Window) : IegwAppLocal } declare interface Iegw extends IegwWndLocal { (_app? : string, _wnd? : Window) : IegwAppLocal, webserverUrl : string }
/**
* Return type for egw.app() call
*/
declare interface Iapplication
{
title : string; // application title untranslated, better use egw.lang(app.name)
name : string; // app-name
enabled : number;
status : number;
id : number;
order : number;
version : string;
index? : string;
icon? : string;
icon_app? : string;
}
/** /**
* Interface for all window global methods (existing only in top window) * Interface for all window global methods (existing only in top window)
@ -164,8 +181,11 @@ declare interface IegwGlobal
* java script console. The first parameter specifies the debug * java script console. The first parameter specifies the debug
* level, all other parameters are passed to the corresponding * level, all other parameters are passed to the corresponding
* console function. * console function.
*
* @param {String} _level "navigation", "log", "info", "warn", "error"
* @param args arguments to egw.debug
*/ */
debug(_level : number, ...args : any[]) : void; debug(_level : "navigation"|"log"|"info"|"warn"|"error", ...args : any[]) : void;
/** /**
* Display log to user because he clicked on icon showed by raise_error * Display log to user because he clicked on icon showed by raise_error
* *
@ -487,9 +507,10 @@ declare interface IegwGlobal
* *
* @param {string} _app * @param {string} _app
* @param {string} _name attribute to return, default return whole app-data-object * @param {string} _name attribute to return, default return whole app-data-object
* @return object|string|undefined undefined if not found * @return Iapplication|string|undefined undefined if not found
*/ */
app(_app : string, _name? : string) : string|object|undefined; app(_app : string, _name : string) : string|undefined;
app(_app : string) : Iapplication|undefined;
/** /**
* Get a list of accounts the user has access to * Get a list of accounts the user has access to
* The list is filtered by type, one of 'accounts','groups','both', 'owngroups' * The list is filtered by type, one of 'accounts','groups','both', 'owngroups'