Fix setting and hiding the Delete button in the calendar dialog.
authorJan Schneider <jan@horde.org>
Mon, 3 May 2010 16:26:11 +0000 (18:26 +0200)
committerJan Schneider <jan@horde.org>
Mon, 3 May 2010 16:38:04 +0000 (18:38 +0200)
kronolith/js/kronolith.js

index 6533b96..35a844b 100644 (file)
@@ -2571,16 +2571,20 @@ KronolithCore = {
                 }
                 form.down('.kronolithCalendarSubscribe').hide();
                 form.down('.kronolithCalendarUnsubscribe').hide();
-                if (newCalendar || calendar == Kronolith.conf.user) {
-                    form.down('.kronolithCalendarDelete').hide();
-                } else {
-                    form.down('.kronolithCalendarDelete').show();
-                }
                 $('kronolithCalendar' + type + 'LinkPerms').up('li').show();
                 if (!Object.isUndefined(info) && info.owner) {
                     this.setPermsFields(type, info.perms);
                 }
             }
+            if (type == 'remote' || type == 'internal' || type == 'tasklists') {
+                if (newCalendar ||
+                    (type == 'internal' && calendar == Kronolith.conf.user) ||
+                    (type == 'tasklists' && calendar == 'tasks/' + Kronolith.conf.user)) {
+                    form.select('.kronolithCalendarDelete').invoke('hide');
+                } else {
+                    form.select('.kronolithCalendarDelete').invoke('show');
+                }
+            }
             form.down('.kronolithCalendarSave').show();
             form.down('.kronolithFormActions .kronolithSeparator').show();
         } else {