diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php index 409eeecaaf..d5becd4a55 100644 --- a/mail/inc/class.mail_sieve.inc.php +++ b/mail/inc/class.mail_sieve.inc.php @@ -320,7 +320,7 @@ class mail_sieve $msg .= "\n".lang("Error: Could not save rule").' '.lang("No action defined!"); $error++; } - egw_framework::refresh_opener($msg, 'mail'); + egw_framework::refresh_opener($msg, 'mail', 'sieve'); if ($button == "apply") { break; @@ -343,7 +343,7 @@ class mail_sieve $this->rules = array_values($this->rules); $this->updateScript(); } - egw_framework::refresh_opener($msg, 'mail'); + egw_framework::refresh_opener($msg, 'mail', 'sieve'); case 'cancel': egw_framework::window_close(); @@ -619,7 +619,7 @@ class mail_sieve // refresh vacationNotice on index $response = egw_json_response::get(); $response->call('app.mail.mail_callRefreshVacationNotice',$this->mailbo->profileID); - egw_framework::refresh_opener($msg, 'mail','edit'); + egw_framework::refresh_opener($msg, 'mail'); if ($button === 'apply' || $icServer->error !=="") { break; @@ -865,9 +865,9 @@ class mail_sieve ob_start(); $result = $this->updateScript(); - + $response = egw_json_response::get(); - + if($result) { $response->error($result); diff --git a/mail/js/app.js b/mail/js/app.js index 1d6f0ea0d9..7cbf56dfdc 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -137,7 +137,7 @@ app.classes.mail = AppJS.extend( if (w_h[1] == 'egw_getWindowOuterHeight()') { w_h[1] = (screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight()); - } + } } window.resizeTo((w_h[0]?w_h[0]:870),(w_h[1]?w_h[1]:(screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight()))); break; @@ -145,19 +145,62 @@ app.classes.mail = AppJS.extend( var app_registry = egw.link_get_registry('mail'); this.mail_isMainWindow = false; this.hide_cc_compose(); - + if (typeof app_registry['edit'] != 'undefined' && typeof app_registry['edit_popup'] != 'undefined' ) { var w_h =app_registry['edit_popup'].split('x'); if (w_h[1] == 'egw_getWindowOuterHeight()') w_h[1] = (screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight()); } - + window.resizeTo((w_h[0]?w_h[0]:870),(w_h[1]?w_h[1]:(screen.availHeight<800?screen.availHeight:800))); this.compose_cc_expander(); break; } }, + /** + * Observer method receives update notifications from all applications + * + * App is responsible for only reacting to "messages" it is interested in! + * + * @param {string} _msg message (already translated) to show, eg. 'Entry deleted' + * @param {string} _app application name + * @param {(string|number)} _id id of entry to refresh or null + * @param {string} _type either 'update', 'edit', 'delete', 'add' or null + * - update: request just modified data from given rows. Sorting is not considered, + * so if the sort field is changed, the row will not be moved. + * - edit: rows changed, but sorting may be affected. Requires full reload. + * - 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 + * @return {false|*} false to stop regular refresh, thought all observers are run + */ + observer: function(_msg, _app, _id, _type, _msg_type, _targetapp) + { + switch(_app) + { + case 'mail': + if (_id === 'sieve') + { + var iframe = this.et2.getWidgetById('extra_iframe'); + if (iframe && iframe.getDOMNode()) + { + var contentWindow = iframe.getDOMNode().contentWindow; + if (contentWindow && contentWindow.app && contentWindow.app.mail) + { + contentWindow.app.mail.sieve_refresh(); + } + } + return false; // mail nextmatch needs NOT to be refreshed + } + break; + + case 'emailadmin': + // ToDo: update tree with given account _id and _type + } + }, + /** * mail rebuild Action menu On nm-list * @@ -1400,10 +1443,10 @@ app.classes.mail = AppJS.extend( * @param {string} _previous - Previously selected node ID */ mail_changeFolder: function(_folder,_widget, _previous) { - + // to reset iframes to the normal status this.loadIframe(); - + // Abort if user selected an un-selectable node // Use image over anything else because...? var img = _widget.getSelectedNode().images[0]; @@ -2770,7 +2813,7 @@ app.classes.mail = AppJS.extend( var rowId = widget.id.replace(/[^0-9.]+/g, ''); var rights = (widget.get_value() == "custom"?[]:widget.get_value() == "aeiklprstwx")? widget.get_value().replace(/[k,x,t,e]/g,"cd").split(""):widget.get_value().split(""); - + for (var i=0;i