From d58b11116553baf4d795317ea7a35bccb22df246 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 26 May 2014 14:01:18 +0000 Subject: [PATCH] Remove _targetapp argument from observer and add _links. Additionally, make sure if the application, fired observer, is linked and needs to be refreshed --- infolog/js/app.js | 22 +++++++++++++--------- mail/js/app.js | 5 +++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/infolog/js/app.js b/infolog/js/app.js index cbfc35c558..600b0d710d 100644 --- a/infolog/js/app.js +++ b/infolog/js/app.js @@ -79,17 +79,21 @@ app.classes.infolog = AppJS.extend( * - delete: just delete the given rows clientside (no server interaction neccessary) * - add: requires full reload for proper sorting * @param {string} _msg_type 'error', 'warning' or 'success' (default) - * @param {string} _targetapp which app's window should be refreshed, default current + * @param {object|null} _links app => array of ids of linked entries + * or null, if not triggered on server-side, which adds that info */ - observer: function(_msg, _app, _id, _type, _msg_type, _targetapp) + observer: function(_msg, _app, _id, _type, _msg_type, _links) { - switch (_app) - { - case 'timesheet': - var nm = this.et2 ? this.et2.getWidgetById('nm') : null; - if (nm) nm.applyFilters(); - break; - } + if (typeof _links['infolog'] != 'undefined') + { + switch (_app) + { + case 'timesheet': + var nm = this.et2 ? this.et2.getWidgetById('nm') : null; + if (nm) nm.applyFilters(); + break; + } + } }, /** diff --git a/mail/js/app.js b/mail/js/app.js index b6c9f2dfb8..8751eda40b 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -173,10 +173,11 @@ app.classes.mail = AppJS.extend( * - delete: just delete the given rows clientside (no server interaction neccessary) * - add: requires full reload for proper sorting * @param {string} _msg_type 'error', 'warning' or 'success' (default) - * @param {string} _targetapp which app's window should be refreshed, default current + * @param {object|null} _links app => array of ids of linked entries + * or null, if not triggered on server-side, which adds that info * @return {false|*} false to stop regular refresh, thought all observers are run */ - observer: function(_msg, _app, _id, _type, _msg_type, _targetapp) + observer: function(_msg, _app, _id, _type, _msg_type, _links) { switch(_app) {