forked from extern/egroupware
Return an object for egw message in order to have access to it after display
This commit is contained in:
parent
9c63ee5d23
commit
e120bdb189
@ -173,8 +173,6 @@ class admin_hooks
|
|||||||
}
|
}
|
||||||
// allow apps to hook into "Admin >> Clear cache and register hooks"
|
// allow apps to hook into "Admin >> Clear cache and register hooks"
|
||||||
Api\Hooks::process('clear_cache', array(), true);
|
Api\Hooks::process('clear_cache', array(), true);
|
||||||
|
|
||||||
Api\Json\Response::get()->apply('egw.message', array(lang('Done'), 'success'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1101,9 +1101,13 @@ var AdminApp = /** @class */ (function (_super) {
|
|||||||
* cache to use different method not requiring eg. so much memory
|
* cache to use different method not requiring eg. so much memory
|
||||||
*/
|
*/
|
||||||
AdminApp.prototype.clear_cache = function () {
|
AdminApp.prototype.clear_cache = function () {
|
||||||
this.egw.message(this.egw.lang('Clear cache and register hooks') + "\n" + this.egw.lang('Please wait...'), 'info');
|
var wait = this.egw.message(this.egw.lang('Clear cache and register hooks') + "\n" + this.egw.lang('Please wait...'), 'info');
|
||||||
this.egw.json('admin.admin_hooks.ajax_clear_cache').sendRequest(true, undefined, jQuery.proxy(function (_xmlhttp, _err) {
|
var success = function () {
|
||||||
this.egw.json('admin.admin_hooks.ajax_clear_cache&errored=1').sendRequest(true);
|
wait.close();
|
||||||
|
egw.message('Done');
|
||||||
|
};
|
||||||
|
this.egw.json('admin.admin_hooks.ajax_clear_cache', null, success).sendRequest(true, undefined, jQuery.proxy(function (_xmlhttp, _err) {
|
||||||
|
this.egw.json('admin.admin_hooks.ajax_clear_cache&errored=1', null, success).sendRequest(true);
|
||||||
}, this));
|
}, this));
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
@ -1335,11 +1335,14 @@ class AdminApp extends EgwApp
|
|||||||
*/
|
*/
|
||||||
clear_cache()
|
clear_cache()
|
||||||
{
|
{
|
||||||
this.egw.message(this.egw.lang('Clear cache and register hooks')+"\n"+this.egw.lang('Please wait...'),'info');
|
let wait = this.egw.message(this.egw.lang('Clear cache and register hooks')+"\n"+this.egw.lang('Please wait...'),'info');
|
||||||
|
let success = function (){
|
||||||
this.egw.json('admin.admin_hooks.ajax_clear_cache').sendRequest(true, undefined, jQuery.proxy(function(_xmlhttp, _err)
|
wait.close();
|
||||||
|
egw.message('Done');
|
||||||
|
};
|
||||||
|
this.egw.json('admin.admin_hooks.ajax_clear_cache', null, success).sendRequest(true, undefined, jQuery.proxy(function(_xmlhttp, _err)
|
||||||
{
|
{
|
||||||
this.egw.json('admin.admin_hooks.ajax_clear_cache&errored=1').sendRequest(true);
|
this.egw.json('admin.admin_hooks.ajax_clear_cache&errored=1', null, success).sendRequest(true);
|
||||||
}, this));
|
}, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
api/js/jsapi/egw_global.d.ts
vendored
14
api/js/jsapi/egw_global.d.ts
vendored
@ -547,7 +547,7 @@ declare interface IegwGlobal
|
|||||||
* @param {function} _callback
|
* @param {function} _callback
|
||||||
* @param {object} _context
|
* @param {object} _context
|
||||||
*/
|
*/
|
||||||
accountData(_account_ids : number|number[], _field : string, _resolve_groups : boolean,
|
accountData(_account_ids : number|number[], _field : string, _resolve_groups : boolean,
|
||||||
_callback : Function, _context : object) : void;
|
_callback : Function, _context : object) : void;
|
||||||
/**
|
/**
|
||||||
* Set account data. This one can be called from the server to pre-fill the cache.
|
* Set account data. This one can be called from the server to pre-fill the cache.
|
||||||
@ -827,8 +827,10 @@ declare interface IegwWndLocal extends IegwGlobal
|
|||||||
* @param {string} _discardID unique string id (appname:id) in order to register
|
* @param {string} _discardID unique string id (appname:id) in order to register
|
||||||
* the message as discardable. If no appname given, the id will be prefixed with
|
* the message as discardable. If no appname given, the id will be prefixed with
|
||||||
* current app. The discardID will be stored in local storage.
|
* current app. The discardID will be stored in local storage.
|
||||||
|
*
|
||||||
|
* @returns {object} returns an object containing data and methods related to the message
|
||||||
*/
|
*/
|
||||||
message(_msg : string, _type? : "help"|"info"|"error"|"warning"|"success", _discardID? : string) : void;
|
message(_msg: string, _type?: "help" | "info" | "error" | "warning" | "success", _discardID?: string): {node: JQuery, message: string, index: number, close: Function};
|
||||||
/**
|
/**
|
||||||
* Are we running in a popup
|
* Are we running in a popup
|
||||||
*
|
*
|
||||||
@ -886,7 +888,7 @@ declare interface IegwWndLocal extends IegwGlobal
|
|||||||
* @param {object|null} _links app => array of ids of linked entries
|
* @param {object|null} _links app => array of ids of linked entries
|
||||||
* or null, if not triggered on server-side, which adds that info
|
* or null, if not triggered on server-side, which adds that info
|
||||||
*/
|
*/
|
||||||
refresh(_msg : string, _app : string, _id? : string|number, _type? : "update"|"edit"|"delete"|"add"|null,
|
refresh(_msg : string, _app : string, _id? : string|number, _type? : "update"|"edit"|"delete"|"add"|null,
|
||||||
_targetapp? : string, _replace? : string|RegExp, _with? : string, _msg_type? : "error"|"warning"|"success", _links? : object) : void;
|
_targetapp? : string, _replace? : string|RegExp, _with? : string, _msg_type? : "error"|"warning"|"success", _links? : object) : void;
|
||||||
/**
|
/**
|
||||||
* Handle a push notification about entry changes from the websocket
|
* Handle a push notification about entry changes from the websocket
|
||||||
@ -925,7 +927,7 @@ declare interface IegwWndLocal extends IegwGlobal
|
|||||||
* }
|
* }
|
||||||
* @return {boolean} false if Notification is not supported by browser
|
* @return {boolean} false if Notification is not supported by browser
|
||||||
*/
|
*/
|
||||||
notification(_title : string, _options : {dir?: "ltr"|"rtl"|"auto", lang: string, body?: string, icon?: string,
|
notification(_title : string, _options : {dir?: "ltr"|"rtl"|"auto", lang: string, body?: string, icon?: string,
|
||||||
tag?: string, onclick: Function, onshow?: Function, onclose?: Function, onerror?: Function}) : false|void;
|
tag?: string, onclick: Function, onshow?: Function, onclose?: Function, onerror?: Function}) : false|void;
|
||||||
/**
|
/**
|
||||||
* Check Notification availability by browser
|
* Check Notification availability by browser
|
||||||
@ -974,7 +976,7 @@ declare interface IegwWndLocal extends IegwGlobal
|
|||||||
* - This option only makes sense to be enabled when the open_link requested without user interaction
|
* - This option only makes sense to be enabled when the open_link requested without user interaction
|
||||||
* @param {string} _mime_type if given, we check if any app has registered a mime-handler for that type and use it
|
* @param {string} _mime_type if given, we check if any app has registered a mime-handler for that type and use it
|
||||||
*/
|
*/
|
||||||
open_link(_link : string, _target? : string, _popup? : string, _target_app? : string,
|
open_link(_link : string, _target? : string, _popup? : string, _target_app? : string,
|
||||||
_check_popup_blocker? : boolean, _mime_type? : string) : Window|void;
|
_check_popup_blocker? : boolean, _mime_type? : string) : Window|void;
|
||||||
/**
|
/**
|
||||||
* Open a (centered) popup window with given size and url
|
* Open a (centered) popup window with given size and url
|
||||||
@ -989,7 +991,7 @@ declare interface IegwWndLocal extends IegwGlobal
|
|||||||
* @param {boolean} _skip_framework
|
* @param {boolean} _skip_framework
|
||||||
* @returns {Window|void}
|
* @returns {Window|void}
|
||||||
*/
|
*/
|
||||||
openPopup(_url : string, _width : number, _height : number|"availHeight", _windowName? : string, _app? : string|boolean,
|
openPopup(_url : string, _width : number, _height : number|"availHeight", _windowName? : string, _app? : string|boolean,
|
||||||
_returnID? : boolean, _status? : "yes"|"no", _skip_framework? : boolean) : Window|void;
|
_returnID? : boolean, _status? : "yes"|"no", _skip_framework? : boolean) : Window|void;
|
||||||
/**
|
/**
|
||||||
* Get available height of screen
|
* Get available height of screen
|
||||||
|
@ -62,6 +62,8 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
* @param {string} _discardID unique string id (appname:id) in order to register
|
* @param {string} _discardID unique string id (appname:id) in order to register
|
||||||
* the message as discardable. If no appname given, the id will be prefixed with
|
* the message as discardable. If no appname given, the id will be prefixed with
|
||||||
* current app. The discardID will be stored in local storage.
|
* current app. The discardID will be stored in local storage.
|
||||||
|
*
|
||||||
|
* @return {object} returns an object containing data and methods related to the message
|
||||||
*/
|
*/
|
||||||
message: function(_msg, _type, _discardID)
|
message: function(_msg, _type, _discardID)
|
||||||
{
|
{
|
||||||
@ -206,6 +208,12 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
node: msg_div,
|
||||||
|
message: _msg,
|
||||||
|
index: msg_index,
|
||||||
|
close: function(){msg_close.click();}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user