only bind session/request destroy handler, if we have an etemplate_exec_id. Not the case for pure client-side call like from et2_dialog

This commit is contained in:
Ralf Becker 2014-01-17 17:51:17 +00:00
parent b31befc23b
commit 0c2d8f87b9

View File

@ -198,19 +198,25 @@ etemplate2.prototype._createArrayManagers = function(_data)
/** /**
* Bind our unload handler to notify server that eT session/request no longer needed * Bind our unload handler to notify server that eT session/request no longer needed
*
* We only bind, if we have an etemplate_exec_id: not the case for pure client-side
* calls, eg. via et2_dialog.
*/ */
etemplate2.prototype.bind_unload = function() etemplate2.prototype.bind_unload = function()
{ {
this.destroy_session = jQuery.proxy(function(ev) if (this.etemplate_exec_id)
{ {
var request = egw.json(this.app+".etemplate_new.ajax_destroy_session.etemplate", this.destroy_session = jQuery.proxy(function(ev)
[this.etemplate_exec_id], null, null, false); {
request.sendRequest(); var request = egw.json(this.app+".etemplate_new.ajax_destroy_session.etemplate",
}, this); [this.etemplate_exec_id], null, null, false);
request.sendRequest();
}, this);
if (!window.onbeforeunload) if (!window.onbeforeunload)
{ {
window.onbeforeunload = this.destroy_session; window.onbeforeunload = this.destroy_session;
}
} }
}; };