Close quick event form if opening another form.
authorJan Schneider <jan@horde.org>
Mon, 17 May 2010 16:33:59 +0000 (18:33 +0200)
committerJan Schneider <jan@horde.org>
Mon, 17 May 2010 16:33:59 +0000 (18:33 +0200)
kronolith/js/kronolith.js

index f54cd86..be44a64 100644 (file)
@@ -2257,6 +2257,7 @@ KronolithCore = {
         }
 
         this.closeRedBox();
+        this.quickClose();
         this.redBoxOnDisplay = RedBox.onDisplay;
         RedBox.onDisplay = function() {
             if (this.redBoxOnDisplay) {
@@ -2444,6 +2445,7 @@ KronolithCore = {
         }
 
         this.closeRedBox();
+        this.quickClose();
         if ($('kronolithCalendarDialog')) {
             this.redBoxLoading = true;
             RedBox.showHtml($('kronolithCalendarDialog').show());
@@ -3471,7 +3473,7 @@ KronolithCore = {
             case Event.KEY_ESC:
                 switch (form.identify()) {
                 case 'kronolithQuickinsertForm':
-                    $('kronolithQuickinsert').fade({ duration: this.effectDur });
+                    this.quickClose();
                     break;
                 case 'kronolithEventForm':
                     this.closeRedBox();
@@ -3556,8 +3558,7 @@ KronolithCore = {
                 return;
 
             case 'kronolithQuickinsertCancel':
-                $('kronolithQuickinsert').fade({ duration: this.effectDur });
-                $('kronolithQuickinsertQ').value = '';
+                this.quickClose();
                 e.stop();
                 return;
 
@@ -4355,6 +4356,7 @@ KronolithCore = {
         }
 
         this.closeRedBox();
+        this.quickClose();
         this.redBoxOnDisplay = RedBox.onDisplay;
         RedBox.onDisplay = function() {
            if (this.redBoxOnDisplay) {
@@ -4481,6 +4483,15 @@ KronolithCore = {
                       }.bind(this));
     },
 
+    /**
+     * Closes and resets the quick event form.
+     */
+    quickClose: function()
+    {
+        $('kronolithQuickinsert').fade({ duration: this.effectDur });
+        $('kronolithQuickinsertQ').value = '';
+    },
+
     topTagsCallback: function(update, tagclass, r)
     {
         $('kronolithEventTabTags').select('label').each(function(e) {e.show()});