From 1677dd205c044f9a8edff547153a0b36edc457dc Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 14 Jul 2016 17:21:30 +0200 Subject: [PATCH] Create DOM node for pageGenTime data --- api/js/jsapi/egw_json.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/api/js/jsapi/egw_json.js b/api/js/jsapi/egw_json.js index 53ddfa8ab6..4d0020f3db 100644 --- a/api/js/jsapi/egw_json.js +++ b/api/js/jsapi/egw_json.js @@ -146,6 +146,11 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) json_request.prototype.handleResponse = function(data) { if (data && typeof data.response != 'undefined') { + if (egw.preference('show_generation_time', 'common')) + { + var gen_time_div = jQuery('#divGenTime').length > 0 ? jQuery('#divGenTime') + :jQuery('
').appendTo('#egw_fw_footer'); + } // Load files first var js_files = []; for (var i = data.response.length - 1; i > 0; --i) @@ -163,7 +168,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) this.egw.includeJS(js_files, function() { var end_time = (new Date).getTime(); this.handleResponse(data); - var gen_time_div = jQuery('#divGenTime_'+this.egw.appname); + var gen_time_div = jQuery('#divGenTime'); if (!gen_time_div.length) gen_time_div = jQuery('.pageGenTime'); gen_time_div.append(''+egw.lang('async includes took %1s', (end_time-start_time)/1000)+''); }, this); @@ -190,7 +195,21 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) try { // Get a reference to the plugin var plugin = handler_level[res.type][j]; - + if (res.type.match(/et2_load/)) + { + if (egw.preference('show_generation_time', 'common')) + { + if (gen_time_div.length > 0) + { + gen_time_div.find('span.pageTime').text(egw.lang("Page was generated in %1 seconds ", data.page_generation_time)); + if (data.session_restore_time) + { + var gen_time_session_span = gen_time_div.find('span.session').length > 0 ? gen_time_div.find('span.session'):gen_time_div.append(''); + gen_time_session_span.text(egw.lang("session restore time in %1 seconds ", data.page_generation_time)); + } + } + } + } // Call the plugin callback plugin.callback.call( plugin.context ? plugin.context : this.context,