From 9627e5dd8daf38bc87dd95255411dd8cd9525be8 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 22 Feb 2016 15:43:03 +0000 Subject: [PATCH] Stop calendar from activating itself on every infolog save. --- calendar/js/app.js | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/calendar/js/app.js b/calendar/js/app.js index 7eceaae59c..8f4c3f9437 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -255,7 +255,7 @@ app.classes.calendar = AppJS.extend( if (do_refresh) { // Discard cache, reload - return this.observer('','calendar',_id ? 'infolog'+_id : false, _type); + this._clear_cache(); } break; case 'calendar': @@ -297,18 +297,8 @@ app.classes.calendar = AppJS.extend( } else { - // Full refresh, clear the caches - var events = egw.dataKnownUIDs(_app); - for(var i = 0; i < events.length; i++) - { - egw.dataDeleteUID(_app + '::' + events[i]); - } - var daywise = egw.dataKnownUIDs(app.classes.calendar.DAYWISE_CACHE_ID); - for(var i = 0; i < daywise.length; i++) - { - // Empty to clear existing widgets - egw.dataStoreUID(app.classes.calendar.DAYWISE_CACHE_ID + '::' + daywise[i], null); - } + this._clear_cache(); + // Force redraw to current state this.setState({state: this.state}); } @@ -2584,6 +2574,25 @@ app.classes.calendar = AppJS.extend( } }, + + /** + * Clear all calendar data from egw.data cache + */ + _clear_cache: function() { + // Full refresh, clear the caches + var events = egw.dataKnownUIDs('calendar'); + for(var i = 0; i < events.length; i++) + { + egw.dataDeleteUID('calendar::' + events[i]); + } + var daywise = egw.dataKnownUIDs(app.classes.calendar.DAYWISE_CACHE_ID); + for(var i = 0; i < daywise.length; i++) + { + // Empty to clear existing widgets + egw.dataStoreUID(app.classes.calendar.DAYWISE_CACHE_ID + '::' + daywise[i], null); + } + }, + /** * Take the date range(s) in the value and decide if we need to fetch data * for the date ranges, or if they're already cached fill them in.