From ccc3a4037bba201051be1adebcb1739e286cd8ac Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 16 Dec 2014 10:27:40 +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 3f0d6b5497..2fa6ff1cd1 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -379,7 +379,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 8242c359b1..b566b4774e 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 @@ -183,9 +189,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({ @@ -4130,5 +4136,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