Permalink
Browse files

Added basic contact groups feature

  • Loading branch information...
1 parent c75f8e9 commit a61bbb24aafec5718ca9bc985e7c596c5821f018 @thomascube thomascube committed Mar 26, 2010
View
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Added contact groups in address book (not finished yet)
- Added PageUp/PageDown/Home/End keys support on lists (#1486430)
- Added possibility to select all messages in a folder (#1484756)
- Added 'imap_force_caps' option for after-login CAPABILITY checking (#1485750)
View
@@ -94,6 +94,31 @@ CREATE TABLE `contacts` (
INDEX `user_contacts_index` (`user_id`,`email`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
+-- Table structure for table `contactgroups`
+
+CREATE TABLE `contactgroups` (
+ `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
+ `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `del` tinyint(1) NOT NULL DEFAULT '0',
+ `name` varchar(128) NOT NULL DEFAULT '',
+ PRIMARY KEY(`contactgroup_id`),
+ CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ INDEX `contactgroups_user_index` (`user_id`,`del`)
+) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
+
+CREATE TABLE `contactgroupmembers` (
+ `contactgroup_id` int(10) UNSIGNED NOT NULL,
+ `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`contactgroup_id`, `contact_id`),
+ CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
+ REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
+ REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE
+) /*!40000 ENGINE=INNODB */;
+
-- Table structure for table `identities`
View
@@ -83,4 +83,27 @@ ALTER TABLE `contacts` ALTER `surname` SET DEFAULT '';
ALTER TABLE `identities` ADD INDEX `user_identities_index` (`user_id`, `del`);
+CREATE TABLE `contactgroups` (
+ `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
+ `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `del` tinyint(1) NOT NULL DEFAULT '0',
+ `name` varchar(128) NOT NULL DEFAULT '',
+ PRIMARY KEY(`contactgroup_id`),
+ CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ INDEX `contactgroups_user_index` (`user_id`,`del`)
+) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
+
+CREATE TABLE `contactgroupmembers` (
+ `contactgroup_id` int(10) UNSIGNED NOT NULL,
+ `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`contactgroup_id`, `contact_id`),
+ CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
+ REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
+ REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE
+) /*!40000 ENGINE=INNODB */;
+
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
@@ -19,7 +19,7 @@ CREATE INDEX ix_cache_created ON cache(created);
-- --------------------------------------------------------
--
--- Table structure for table contacts
+-- Table structure for table contacts and related
--
CREATE TABLE contacts (
@@ -36,6 +36,26 @@ CREATE TABLE contacts (
CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);
+
+CREATE TABLE contactgroups (
+ contactgroup_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL default '0',
+ changed datetime NOT NULL default '0000-00-00 00:00:00',
+ del tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default ''
+);
+
+CREATE INDEX ix_contactgroups_user_id ON contactgroups(user_id, del);
+
+
+CREATE TABLE contactgroupmembers (
+ contactgroup_id integer NOT NULL,
+ contact_id integer NOT NULL default '0',
+ created datetime NOT NULL default '0000-00-00 00:00:00',
+ PRIMARY KEY (contactgroup_id, contact_id)
+);
+
+
-- --------------------------------------------------------
--
View
@@ -47,3 +47,21 @@ CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);
DROP INDEX ix_identities_user_id;
CREATE INDEX ix_identities_user_id ON identities (user_id, del);
+
+CREATE TABLE contactgroups (
+ contactgroup_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL default '0',
+ changed datetime NOT NULL default '0000-00-00 00:00:00',
+ del tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default ''
+);
+
+CREATE INDEX ix_contactgroups_user_id ON contactgroups(user_id, del);
+
+CREATE TABLE contactgroupmembers (
+ contactgroup_id integer NOT NULL,
+ contact_id integer NOT NULL default '0',
+ created datetime NOT NULL default '0000-00-00 00:00:00',
+ PRIMARY KEY (contactgroup_id, contact_id)
+);
+
@@ -44,6 +44,10 @@ $rcmail_config['db_table_identities'] = 'identities';
$rcmail_config['db_table_contacts'] = 'contacts';
+$rcmail_config['db_table_contactgroups'] = 'contactgroups';
+
+$rcmail_config['db_table_contactgroupmembers'] = 'contactgroupmembers';
+
$rcmail_config['db_table_session'] = 'session';
$rcmail_config['db_table_cache'] = 'cache';
View
@@ -217,6 +217,10 @@
'addressbook' => array(
'add' => 'edit.inc',
+ 'create-group' => 'groups.inc',
+ 'delete-group' => 'groups.inc',
+ 'removefromgroup' => 'groups.inc',
+ 'add2group' => 'groups.inc',
),
'settings' => array(
@@ -300,19 +300,21 @@ public function get_address_sources($writeable = false)
if ($abook_type != 'ldap') {
$list['0'] = array(
'id' => 0,
- 'name' => rcube_label('personaladrbook'),
+ 'name' => rcube_label('personaladrbook'),
+ 'groups' => true,
'readonly' => false,
- 'autocomplete' => in_array('sql', $autocomplete)
+ 'autocomplete' => in_array('sql', $autocomplete)
);
}
if (is_array($ldap_config)) {
foreach ($ldap_config as $id => $prop)
$list[$id] = array(
- 'id' => $id,
- 'name' => $prop['name'],
- 'readonly' => !$prop['writable'],
- 'autocomplete' => in_array('sql', $autocomplete)
+ 'id' => $id,
+ 'name' => $prop['name'],
+ 'groups' => false,
+ 'readonly' => !$prop['writable'],
+ 'autocomplete' => in_array('sql', $autocomplete)
);
}
@@ -29,6 +29,7 @@
{
/** public properties */
var $primary_key;
+ var $groups = false;
var $readonly = true;
var $ready = false;
var $list_page = 1;
@@ -63,6 +64,13 @@
abstract function list_records($cols=null, $subset=0);
/**
+ * List all active contact groups of this source
+ *
+ * @return array Indexed list of contact groups, each a hash array
+ */
+ function list_groups() { }
+
+ /**
* Search records
*
* @param array List of fields to search in
@@ -124,6 +132,12 @@ function set_pagesize($size)
}
/**
+ * Setter for the current group
+ * (empty, has to be re-implemented by extending class)
+ */
+ function set_group($gid) { }
+
+ /**
* Create a new contact record
*
* @param array Assoziative array with save data
Oops, something went wrong.

0 comments on commit a61bbb2

Please sign in to comment.