From 1ba07f070998d32d115d90d0d73db2dca59c4690 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 11 Apr 2012 08:52:51 -0400
Subject: [PATCH] Allow mass-removal of addresses from a group (#1487748)

---
 program/js/app.js |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 025a366..963049b 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4016,6 +4016,10 @@
       }
     }
 
+    // if a group is currently selected, and there is at least one contact selected
+    // thend we can enable the group-remove-selected command
+    this.enable_command('group-remove-selected', typeof this.env.group != 'undefined' && list.selection.length > 0);
+
     this.enable_command('compose', this.env.group || list.selection.length > 0);
     this.enable_command('edit', id && writable);
     this.enable_command('delete', list.selection.length && writable);
@@ -4375,6 +4379,28 @@
     this.name_input.select().focus();
   };
 
+  //remove selected contacts from current active group
+  this.group_remove_selected = function()
+  {
+    ref.http_post('group-delmembers','_cid='+urlencode(this.contact_list.selection)
+		  + '&_source='+urlencode(this.env.source)
+		  + '&_gid='+urlencode(this.env.group));
+  };
+
+  //callback after deleting contact(s) from current group
+  this.remove_group_contacts = function(props)
+  {
+    if('undefined' != typeof this.env.group && (this.env.group === props.gid)){
+      var selection = this.contact_list.get_selection();
+      for (var n=0; n<selection.length; n++) {
+	id = selection[n];
+	this.contact_list.remove_row(id, (n == selection.length-1));
+      }
+    }
+  }
+
+
+
   // handler for keyboard events on the input field
   this.add_input_keydown = function(e)
   {

--
Gitblit v1.9.1