summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-10-04 08:07:21 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-10-04 08:08:27 (GMT)
commitcdc9a2a45450d90cbade9049daf75d375830f1c2 (patch)
tree1ea607ce523dd7f3b8075c9956b8feae979bc458
parent53d0345d29f553c56744e81f044ebd1e890c9a52 (diff)
downloadroundcubemail-plugins-kolab-cdc9a2a45450d90cbade9049daf75d375830f1c2.tar.gz
Fix deletion of task lists with sub-folders (similar as in bug #2283)
-rw-r--r--plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php1
-rw-r--r--plugins/tasklist/localization/de_CH.inc1
-rw-r--r--plugins/tasklist/localization/de_DE.inc1
-rw-r--r--plugins/tasklist/localization/en_US.inc1
-rw-r--r--plugins/tasklist/tasklist.js40
5 files changed, 33 insertions, 11 deletions
diff --git a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
index 078243a..671bcef 100644
--- a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
+++ b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
@@ -122,6 +122,7 @@ class tasklist_kolab_driver extends tasklist_driver
'active' => $folder->is_active(),
'parentfolder' => $path_imap,
'default' => $folder->default,
+ 'children' => true, // TODO: determine if that folder indeed has child folders
'class_name' => trim($folder->get_namespace() . ($folder->default ? ' default' : '')),
);
$this->lists[$tasklist['id']] = $tasklist;
diff --git a/plugins/tasklist/localization/de_CH.inc b/plugins/tasklist/localization/de_CH.inc
index 740b0db..6237798 100644
--- a/plugins/tasklist/localization/de_CH.inc
+++ b/plugins/tasklist/localization/de_CH.inc
@@ -66,3 +66,4 @@ $labels['invalidstartduedates'] = 'Beginn der Aufgabe darf nicht grösser als da
$labels['deletetasktconfirm'] = 'Möchten Sie diese Aufgabe wirklich löschen?';
$labels['deleteparenttasktconfirm'] = 'Möchten Sie diese Aufgabe inklusive aller Teilaufgaben wirklich löschen?';
$labels['deletelistconfirm'] = 'Möchten Sie diese Liste mit allen Aufgaben wirklich löschen?';
+$labels['deletelistconfirmrecursive'] = 'Möchten Sie diese Liste mit allen Aufgaben und Unter-Listen wirklich löschen?';
diff --git a/plugins/tasklist/localization/de_DE.inc b/plugins/tasklist/localization/de_DE.inc
index 1cbd2c0..b6d1cc3 100644
--- a/plugins/tasklist/localization/de_DE.inc
+++ b/plugins/tasklist/localization/de_DE.inc
@@ -67,3 +67,4 @@ $labels['invalidstartduedates'] = 'Beginn der Aufgabe darf nicht größer als da
$labels['deletetasktconfirm'] = 'Möchten Sie diese Aufgabe wirklich löschen?';
$labels['deleteparenttasktconfirm'] = 'Möchten Sie diese Aufgabe inklusive aller Teilaufgaben wirklich löschen?';
$labels['deletelistconfirm'] = 'Möchten Sie diese Liste mit allen Aufgaben wirklich löschen?';
+$labels['deletelistconfirmrecursive'] = 'Möchten Sie diese Liste mit allen Aufgaben und Unter-Listen wirklich löschen?'; \ No newline at end of file
diff --git a/plugins/tasklist/localization/en_US.inc b/plugins/tasklist/localization/en_US.inc
index 8a31be3..57d6c3c 100644
--- a/plugins/tasklist/localization/en_US.inc
+++ b/plugins/tasklist/localization/en_US.inc
@@ -66,3 +66,4 @@ $labels['invalidstartduedates'] = 'Start date must not be greater than due date.
$labels['deletetasktconfirm'] = 'Do you really want to delete this task?';
$labels['deleteparenttasktconfirm'] = 'Do you really want to delete this task and all its subtasks?';
$labels['deletelistconfirm'] = 'Do you really want to delete this list with all its tasks?';
+$labels['deletelistconfirmrecursive'] = 'Do you really want to delete this list with all its sub-lists and tasks?';
diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index 84215b0..49da4f1 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -1418,7 +1418,7 @@ function rcube_tasklist_ui(settings)
function list_remove(id)
{
var list = me.tasklists[id];
- if (list && list.editable && confirm(rcmail.gettext('deletelistconfirm', 'tasklist'))) {
+ if (list && list.editable && confirm(rcmail.gettext(list.children ? 'deletelistconfirmrecursive' : 'deletelistconfirm', 'tasklist'))) {
saving_lock = rcmail.set_busy(true, 'tasklist.savingdata');
rcmail.http_post('tasklist', { action:'remove', l:{ id:list.id } });
return true;
@@ -1431,17 +1431,35 @@ function rcube_tasklist_ui(settings)
*/
function destroy_list(prop)
{
- var list = me.tasklists[prop.id],
- li = rcmail.get_folder_li(prop.id, 'rcmlitasklist');
-
- if (li) {
- $(li).remove();
+ var li, delete_ids = [],
+ list = me.tasklists[prop.id];
+
+ // find sub-lists
+ if (list && list.children) {
+ for (var child_id in me.tasklists) {
+ if (String(child_id).indexOf(prop.id) == 0)
+ delete_ids.push(child_id);
+ }
}
- if (list) {
- list.active = false;
- // delete me.tasklists[prop.id];
- unlock_saving();
- remove_tasks(list.id);
+ else {
+ delete_ids.push(prop.id);
+ }
+
+ // delete all calendars in the list
+ for (var i=0; i < delete_ids.length; i++) {
+ id = delete_ids[i];
+ list = me.tasklists[id];
+ li = rcmail.get_folder_li(id, 'rcmlitasklist');
+
+ if (li) {
+ $(li).remove();
+ }
+ if (list) {
+ list.active = false;
+ // delete me.tasklists[prop.id];
+ unlock_saving();
+ remove_tasks(list.id);
+ }
}
}