From 520a4b41b3776c0ffb71af5580668d6530d9ed05 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 24 Mar 2009 17:30:06 +0000 Subject: Add a "form_closing" custom event to the dialog processing. This allows the form in the dialog todo custom processing when the form closes. For example, the server_add dialog (next commit) uses this callback to determine if the upload task was cancelled and display a warning message when the page reloads. Usage: $("#gServerAdd form").bind("form_closing", function(target){...}); --- lib/gallery.dialog.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/gallery.dialog.js') diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index 7f2de843..6ff06d39 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -104,17 +104,19 @@ function on_form_loaded() { $("#gDialog .submit").addClass("ui-state-default ui-corner-all"); $("#gDialog .submit").parent().append(eCancel); } + $("#gDialog").dialog("option", "form", $("#gDialog form")); $("#gDialog .ui-state-default").hover( - function(){ + function() { $(this).addClass("ui-state-hover"); }, - function(){ + function() { $(this).removeClass("ui-state-hover"); } ); } function closeDialog() { + $("#gDialog").dialog("option", "form").trigger("form_closing"); $("#gDialog").dialog("destroy").remove(); } -- cgit v1.2.3