Index: branches/RC/core/admin_templates/js/forms.js =================================================================== diff -u -r9266 -r9639 --- branches/RC/core/admin_templates/js/forms.js (.../forms.js) (revision 9266) +++ branches/RC/core/admin_templates/js/forms.js (.../forms.js) (revision 9639) @@ -104,6 +104,35 @@ } } } + + addEvent(window, 'unload', function() { + if (!unload_legal) { // it's set in submit_kernel_form - if we are submitting form, the unload is already handled + // if we got here, it means that we are closing window ilegally (through OS interace X button) +// alert('closing window'); + // we need to clear temp tables then + + var req = Request.getRequest(); + var $ajax_mark = (_DropTempUrl.indexOf('?') ? '&' : '?') + 'ajax=yes'; + req.open('GET', _DropTempUrl + $ajax_mark, false); //!!!SYNCRONIOUS!!! REQUEST (3rd param = false!!!) + req.send(null); + +// window.opener.EditWindowClosed(_DropTempUrl); +// alert('request sent, closing widow'); + } + }); + + // we need to set unload_legal to true if we are refreshing current window, because onunload will still fire + addEvent(document, 'keydown', function(e) { + var code; + if (!e) var e = window.event; + if (e.keyCode) code = e.keyCode; + else if (e.which) code = e.which; + if (code == 116 || (e.ctrlKey && code == 82)) unload_legal = true; //F5 or Ctrl+R + }); + + if (_Simultanious_Edit_Message != '') { + alert(_Simultanious_Edit_Message); + } } Form.addControl = function(id, options) {