* Api: change default submit to async call and try to block user interfering with submitted popup until the response

This commit is contained in:
Hadi Nategh 2018-10-04 17:22:15 +02:00
parent 13598f5342
commit 577850cfd0
5 changed files with 18 additions and 5 deletions

View File

@ -666,13 +666,21 @@ etemplate2.prototype.autocomplete_fixer = function ()
* Submit form via ajax * Submit form via ajax
* *
* @param {(et2_button|string)} button button widget or string with id * @param {(et2_button|string)} button button widget or string with id
* @param {boolean} async true: do an asynchronious submit, default is synchronious * @param {boolean|string} async true: do an asynchronious submit, string: spinner message (please wait...)
* default is asynchronoush with message
* @param {boolean} no_validation - Do not do individual widget validation, just submit their current values * @param {boolean} no_validation - Do not do individual widget validation, just submit their current values
* @param {et2_widget|undefined} _container container to submit, default whole template * @param {et2_widget|undefined} _container container to submit, default whole template
* @return {boolean} true if submit was send, false if eg. validation stoped submit * @return {boolean} true if submit was send, false if eg. validation stoped submit
*/ */
etemplate2.prototype.submit = function(button, async, no_validation, _container) etemplate2.prototype.submit = function(button, async, no_validation, _container)
{ {
var api = this.widgetContainer.egw();
if (typeof async == 'undefined' || typeof async == 'string')
{
api.loading_prompt('et2_submit_spinner', true, api.lang(typeof async == 'string' ? async : 'Please wait...'));
async = true;
}
if(typeof no_validation == 'undefined') if(typeof no_validation == 'undefined')
{ {
no_validation = false; no_validation = false;
@ -751,8 +759,10 @@ etemplate2.prototype.submit = function(button, async, no_validation, _container)
// unbind our session-destroy handler, as we are submitting // unbind our session-destroy handler, as we are submitting
this.unbind_unload(); this.unbind_unload();
var api = this.widgetContainer.egw();
var request = api.json(this.menuaction, [this.etemplate_exec_id, values, no_validation], null, this, async); var request = api.json(this.menuaction, [this.etemplate_exec_id, values, no_validation], function(){
api.loading_prompt('et2_submit_spinner', false);
}, this, async);
request.sendRequest(); request.sendRequest();
} }
else else

View File

@ -504,6 +504,7 @@ class mail_compose
{ {
try try
{ {
$GLOBALS['egw']->session->commit_session();
$success = $this->send($_content); $success = $this->send($_content);
if ($success==false) if ($success==false)
{ {

View File

@ -5321,7 +5321,7 @@ app.classes.mail = AppJS.extend(
}); });
return false; return false;
} }
this.et2._inst.submit(); this.et2._inst.submit(null, 'Please wait while sending your mail');
}, },
/** /**

View File

@ -393,6 +393,7 @@ please enter password mail de Bitte geben Sie ein Passwort ein
please select a address mail de Bitte wählen Sie eine Adresse please select a address mail de Bitte wählen Sie eine Adresse
please select the number of days to wait between responses mail de Bitte wählen wie viele Tage zwischen den Antworten gewartet werden soll. please select the number of days to wait between responses mail de Bitte wählen wie viele Tage zwischen den Antworten gewartet werden soll.
please supply the message to send with auto-responses mail de Bitte geben Sie eine Nachricht ein, die mit der automatischen Antwort gesendet werden soll please supply the message to send with auto-responses mail de Bitte geben Sie eine Nachricht ein, die mit der automatischen Antwort gesendet werden soll
please wait while sending your mail mail de Bitte warten, Ihre Mail wird gesendet
post mail de versenden post mail de versenden
prevent managing filters mail de Zugriff auf Filterregeln deaktivieren prevent managing filters mail de Zugriff auf Filterregeln deaktivieren
prevent managing folders mail de Zugriff auf die Ordnerverwaltung deaktivieren prevent managing folders mail de Zugriff auf die Ordnerverwaltung deaktivieren

View File

@ -393,6 +393,7 @@ please enter password mail en Please enter password
please select a address mail en Please select a address please select a address mail en Please select a address
please select the number of days to wait between responses mail en Please select the number of days to wait between responses please select the number of days to wait between responses mail en Please select the number of days to wait between responses
please supply the message to send with auto-responses mail en Please supply the message to send with auto-responses please supply the message to send with auto-responses mail en Please supply the message to send with auto-responses
please wait while sending your mail mail en Please wait while sending your mail
post mail en post post mail en post
prevent managing filters mail en Prevent managing filters prevent managing filters mail en Prevent managing filters
prevent managing folders mail en Prevent managing folders prevent managing folders mail en Prevent managing folders