[Svn] r4454 - in trunk/roundcubemail/program: js steps/addressbook

trac at roundcube.net trac at roundcube.net
Sun Jan 23 19:10:40 CET 2011


Author: thomasb
Date: 2011-01-23 12:10:40 -0600 (Sun, 23 Jan 2011)
New Revision: 4454

Modified:
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/steps/addressbook/save.inc
Log:
When creating a new contact, add it to the selected group; consider the selected group when deleting a contact

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2011-01-23 17:02:06 UTC (rev 4453)
+++ trunk/roundcubemail/program/js/app.js	2011-01-23 18:10:40 UTC (rev 4454)
@@ -3766,6 +3766,9 @@
         this.show_contentframe(false);
     }
 
+    if (this.env.group)
+      qs += '&_gid='+urlencode(this.env.group);
+
     // also send search request to get the right records from the next page
     if (this.env.search_request) 
       qs += '&_search='+this.env.search_request;

Modified: trunk/roundcubemail/program/steps/addressbook/save.inc
===================================================================
--- trunk/roundcubemail/program/steps/addressbook/save.inc	2011-01-23 17:02:06 UTC (rev 4453)
+++ trunk/roundcubemail/program/steps/addressbook/save.inc	2011-01-23 18:10:40 UTC (rev 4454)
@@ -131,7 +131,6 @@
 if (empty($a_record['name']))
   $a_record['name'] = join(' ', array_filter(array($a_record['prefix'], $a_record['firstname'], $a_record['middlename'], $a_record['surname'], $a_record['suffix'],)));
 
-#var_dump($a_record);
 
 // Basic input checks (TODO: delegate to $CONTACTS instance)
 if (empty($a_record['name'])/* || empty($a_record['email'])*/) {
@@ -242,6 +241,18 @@
 
 
   if ($insert_id) {
+    // add new contact to the specified group
+    if ($CONTACTS->group_id) {
+      $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $CONTACTS->group_id, 'ids' => $insert_id, 'source' => $source));
+
+      if (!$plugin['abort']) {
+        if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + 1 > $maxnum))
+          $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
+
+        $CONTACTS->add_to_group($gid, $plugin['ids']);
+      }
+    }
+    
     // add contact row or jump to the page where it should appear
     $CONTACTS->reset();
     $result = $CONTACTS->search($CONTACTS->primary_key, $insert_id);

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list