From f529a4fae6f697c1ca921c789eb445c00d5575ab Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 16 Dec 2014 10:26:44 +0000 Subject: [PATCH] Clear intervals assigned to window after submit compose dialog --- mail/inc/class.mail_compose.inc.php | 2 ++ mail/js/app.js | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index dd62b879dd..4b538f0974 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -376,7 +376,9 @@ class mail_compose } if ($sendOK == false) { + $response = egw_json_response::get(); egw_framework::message(lang('Message send failed: %1',$message),'error');// maybe error is more appropriate + $response->call('app.mail.clearIntevals'); } } diff --git a/mail/js/app.js b/mail/js/app.js index edf5340ddd..2b32ed99fe 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -38,7 +38,7 @@ app.classes.mail = AppJS.extend( nm_index: 'nm', // nm name of index mail_fileSelectorWindow: null, mail_isMainWindow: true, - + // Some state variables to track preview pre-loading preview_preload: { timeout: null, @@ -57,6 +57,12 @@ app.classes.mail = AppJS.extend( * */ aclRights:['l','r','s','w','i','p','c','d','a'], + + /** + * In order to store Intervals assigned to window + * @array of setted intervals + */ + W_INTERVALS:[], /** * Initialize javascript for this application @@ -184,9 +190,9 @@ app.classes.mail = AppJS.extend( this.subject2title(); // Set autosaving interval to 2 minutes for compose message - window.setInterval(function (){ + this.W_INTERVALS.push(window.setInterval(function (){ that.saveAsDraft(null,that.et2.getWidgetById('button[saveAsDraft]'),'autosaving'); - }, 120000); + }, 120000)); /* Control focus actions on subject to handle expanders properly.*/ jQuery("#mail-compose_subject").on({ @@ -4176,5 +4182,17 @@ app.classes.mail = AppJS.extend( { document.title = _widget.get_value(); } + }, + + /** + * Clear intervals stored in W_INTERVALS which assigned to window + */ + clearIntevals: function () + { + for(var i=0;i