Better ask for confirmation before deleting a calendar.
authorJan Schneider <jan@horde.org>
Thu, 4 Nov 2010 21:00:31 +0000 (22:00 +0100)
committerJan Schneider <jan@horde.org>
Thu, 4 Nov 2010 21:01:08 +0000 (22:01 +0100)
kronolith/js/kronolith.js
kronolith/lib/Kronolith.php

index 7784724..3f01078 100644 (file)
@@ -4532,10 +4532,19 @@ KronolithCore = {
                 e.stop();
                 break;
             } else if (elt.hasClassName('kronolithCalendarDelete')) {
-                elt.disable();
                 var form = elt.up('form'),
                     type = form.id.replace(/kronolithCalendarForm/, ''),
                     calendar = $F('kronolithCalendar' + type + 'Id');
+
+                if ((type == 'tasklists' &&
+                     !window.confirm(Kronolith.text.delete_tasklist)) ||
+                    (type != 'tasklists' &&
+                     !window.confirm(Kronolith.text.delete_calendar))) {
+                    e.stop();
+                    break;
+                }
+
+                elt.disable();
                 this.doAction('deleteCalendar',
                               { type: type, calendar: calendar },
                               function(r) {
index 25c5732..c15b265 100644 (file)
@@ -307,6 +307,8 @@ class Kronolith
             'no_url' => _("You must specify a URL."),
             'no_calendar_title' => _("The calendar title must not be empty."),
             'no_tasklist_title' => _("The task list title must not be empty."),
+            'delete_calendar' => _("Are you sure you want to delete this calendar and all the events in it?"),
+            'delete_tasklist' => _("Are you sure you want to delete this task list and all the tasks in it?"),
             'wrong_auth' => _("The authentication information you specified wasn't accepted."),
             'geocode_error' => _("Unable to locate requested address"),
             'wrong_date_format' => sprintf(_("You used an unknown date format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'),