Close exiting dialog before opening a new one.
authorJan Schneider <jan@horde.org>
Tue, 2 Mar 2010 22:57:23 +0000 (23:57 +0100)
committerJan Schneider <jan@horde.org>
Tue, 2 Mar 2010 23:02:34 +0000 (00:02 +0100)
horde/js/redbox.js
kronolith/js/kronolith.js

index d92f52a..bfc8596 100644 (file)
@@ -119,6 +119,11 @@ var RedBox = {
         this.setWindowPosition();
     },
 
+    getWindow: function()
+    {
+        return $('RB_window');
+    },
+
     getWindowContents: function()
     {
         var w = $('RB_window');
index 8da2208..99f5bab 100644 (file)
@@ -1880,6 +1880,8 @@ KronolithCore = {
 
     editTask: function(tasklist, id)
     {
+        this.closeRedBox();
+
         RedBox.onDisplay = function() {
             try {
                 $('kronolithTaskForm').focusFirstElement();
@@ -2056,6 +2058,8 @@ KronolithCore = {
      */
     editCalendar: function(calendar)
     {
+        this.closeRedBox();
+
         if ($('kronolithCalendarDialog')) {
             RedBox.showHtml($('kronolithCalendarDialog').show());
             this.editCalendarCallback(calendar);
@@ -3366,6 +3370,8 @@ KronolithCore = {
 
     editEvent: function(calendar, id, date)
     {
+        this.closeRedBox();
+
         if (Object.isUndefined($('kronolithEventTags').autocompleter)) {
             this.editEvent.bind(this, calendar, id, date).defer();
             return;
@@ -3809,6 +3815,9 @@ KronolithCore = {
 
     closeRedBox: function()
     {
+        if (!RedBox.getWindow()) {
+            return;
+        }
         var content = RedBox.getWindowContents();
         if (content) {
             document.body.insert(content.hide());