summaryrefslogtreecommitdiff
path: root/plugins/kolab_notes
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-09-09 11:29:28 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-09-09 11:29:28 (GMT)
commit624f3b169566ffa0ce2a98b722c67307825669dd (patch)
tree6ba2300d79e30d077bc57e40892b8e100ece2bdb /plugins/kolab_notes
parente5c97c0dd20a92ded2dfe96f0cb07a778e13c9b1 (diff)
downloadroundcubemail-plugins-kolab-624f3b169566ffa0ce2a98b722c67307825669dd.tar.gz
Add action to remove a calendar/tasks/notes folders from the list which results in unsubscribing it (#3378)
Diffstat (limited to 'plugins/kolab_notes')
-rw-r--r--plugins/kolab_notes/kolab_notes.php10
-rw-r--r--plugins/kolab_notes/localization/en_US.inc1
-rw-r--r--plugins/kolab_notes/notes.js18
-rw-r--r--plugins/kolab_notes/skins/larry/templates/notes.html3
4 files changed, 28 insertions, 4 deletions
diff --git a/plugins/kolab_notes/kolab_notes.php b/plugins/kolab_notes/kolab_notes.php
index 01025a3..9637be2 100644
--- a/plugins/kolab_notes/kolab_notes.php
+++ b/plugins/kolab_notes/kolab_notes.php
@@ -855,6 +855,16 @@ class kolab_notes extends rcube_plugin
$success |= $folder->subscribe(intval($list['permanent']));
if (isset($list['active']))
$success |= $folder->activate(intval($list['active']));
+
+ // apply to child folders, too
+ if ($list['recursive']) {
+ foreach ((array)kolab_storage::list_folders($folder->name, '*', 'node') as $subfolder) {
+ if (isset($list['permanent']))
+ ($list['permanent'] ? kolab_storage::folder_subscribe($subfolder) : kolab_storage::folder_unsubscribe($subfolder));
+ if (isset($list['active']))
+ ($list['active'] ? kolab_storage::folder_activate($subfolder) : kolab_storage::folder_deactivate($subfolder));
+ }
+ }
}
break;
}
diff --git a/plugins/kolab_notes/localization/en_US.inc b/plugins/kolab_notes/localization/en_US.inc
index 9b3ee39..21e6e1a 100644
--- a/plugins/kolab_notes/localization/en_US.inc
+++ b/plugins/kolab_notes/localization/en_US.inc
@@ -33,6 +33,7 @@ $labels['findnotebooks'] = 'Find notebooks...';
$labels['listsearchresults'] = 'Additional notebooks';
$labels['nrnotebooksfound'] = '$nr notebooks found';
$labels['nonotebooksfound'] = 'No notebooks found';
+$labels['removelist'] = 'Remove';
$labels['savingdata'] = 'Saving data...';
$labels['recordnotfound'] = 'Record not found';
diff --git a/plugins/kolab_notes/notes.js b/plugins/kolab_notes/notes.js
index c8fd1bf..5f514c1 100644
--- a/plugins/kolab_notes/notes.js
+++ b/plugins/kolab_notes/notes.js
@@ -59,6 +59,7 @@ function rcube_kolab_notes_ui(settings)
}, false);
rcmail.register_command('list-create', function(){ list_edit_dialog(null); }, true);
rcmail.register_command('list-edit', function(){ list_edit_dialog(me.selected_list); }, false);
+ rcmail.register_command('list-delete', function(){ list_delete(me.selected_list); }, false);
rcmail.register_command('list-remove', function(){ list_remove(me.selected_list); }, false);
rcmail.register_command('list-sort', list_set_sort, true);
rcmail.register_command('save', save_note, true);
@@ -112,7 +113,8 @@ function rcube_kolab_notes_ui(settings)
var id = node.id;
if (me.notebooks[id] && id != me.selected_list) {
warn_unsaved_changes(function(){
- rcmail.enable_command('createnote', 'list-edit', 'list-remove', me.notebooks[id].editable);
+ rcmail.enable_command('createnote', 'list-edit', 'list-delete', me.notebooks[id].editable);
+ rcmail.enable_command('list-remove', !me.notebooks[id].default);
fetch_notes(id); // sets me.selected_list
},
function(){
@@ -554,11 +556,10 @@ function rcube_kolab_notes_ui(settings)
}
}
-
/**
*
*/
- function list_remove(id)
+ function list_delete(id)
{
var list = me.notebooks[id];
if (list && confirm(rcmail.gettext('deletenotebookconfirm', 'kolab_notes'))) {
@@ -568,6 +569,17 @@ function rcube_kolab_notes_ui(settings)
}
/**
+ *
+ */
+ function list_remove(id)
+ {
+ if (me.notebooks[id]) {
+ list_destroy(me.notebooks[id]);
+ rcmail.http_post('list', { _do:'subscribe', _list:{ id:id, permanent:0, recursive:1 } });
+ }
+ }
+
+ /**
* Callback from server on list delete command
*/
function list_destroy(prop)
diff --git a/plugins/kolab_notes/skins/larry/templates/notes.html b/plugins/kolab_notes/skins/larry/templates/notes.html
index e5f0edf..6cfcb71 100644
--- a/plugins/kolab_notes/skins/larry/templates/notes.html
+++ b/plugins/kolab_notes/skins/larry/templates/notes.html
@@ -62,7 +62,8 @@
<h3 id="aria-label-optionsmenu" class="voice"><roundcube:label name="kolab_notes.arialabelnotesoptionsmenu" /></h3>
<ul class="toolbarmenu" id="notesoptionsmenu-menu" role="menu" aria-labelledby="aria-label-optionsmenu">
<li role="menuitem"><roundcube:button command="list-edit" label="edit" classAct="active" /></li>
- <li role="menuitem"><roundcube:button command="list-remove" label="delete" classAct="active" /></li>
+ <li role="menuitem"><roundcube:button command="list-delete" label="delete" classAct="active" /></li>
+ <li role="menuitem"><roundcube:button command="list-remove" label="kolab_notes.removelist" classAct="active" /></li>
<li role="menuitem"><roundcube:button command="folders" task="settings" type="link" label="managefolders" classAct="active" /></li>
</ul>
</div>