From 8be03a98acdeb7bfd13762c4b2620b8b1cddf25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=B6ckel?= Date: Tue, 18 May 2010 11:32:40 +0000 Subject: [PATCH] Fixed unlocking of calendar entries when the edit window is closed --- calendar/inc/class.calendar_uiforms.inc.php | 31 +++++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index e41e1e6739..3d2676b0b2 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -994,8 +994,33 @@ class calendar_uiforms extends calendar_ui } elseif(egw_vfs::lock($lock_path,$preserv['lock_token'],$locktime,$lock_owner,$scope='shared',$type='write',false,false)) { - // install ajax handler to unlock the entry again, if the window get's closed by the user - $GLOBALS['egw']->js->set_onunload("xajax_doXMLHTTP('calendar.calendar_uiforms.ajax_unlock',$event[id],'$preserv[lock_token]');"); + // install ajax handler to unlock the entry again, if the window get's closed by the user (X of window or our [Close] button) + $GLOBALS['egw']->js->set_onunload("if (do_onunload) xajax_doXMLHTTPsync('calendar.calendar_uiforms.ajax_unlock',$event[id],'$preserv[lock_token]');"); + $GLOBALS['egw']->js->set_onload("replace_eTemplate_onsubmit();"); + + // overwrite submit method of eTemplate form AND onSubmit event, to switch off onUnload handler for regular form submits + // selectboxes use onchange(this.form.submit()) which does not fire onSubmit event --> need to overwrite submit() method + // regular submit buttons dont call submit(), but trigger onSubmit event --> need to overwrite onSubmit event + $GLOBALS['egw_info']['flags']['java_script'] .= ' + +'; } else { @@ -1715,4 +1740,4 @@ class calendar_uiforms extends calendar_ui $etpl->exec('calendar.calendar_uiforms.import',$content); } -} \ No newline at end of file +}