From 8e3a6039cfefb8f351d2696ebdcfa26cc5d4cef9 Mon Sep 17 00:00:00 2001 From: thomascube Date: Tue, 13 Apr 2010 07:24:09 +0000 Subject: Assign newly created contacts to the active group (#1486626) and fix group selection display (#1486619) --- CHANGELOG | 2 ++ program/include/rcube_contacts.php | 6 +++++- program/js/app.js | 7 +++---- program/steps/addressbook/edit.inc | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f14be5198..d78b9997f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ CHANGELOG RoundCube Webmail =========================== +- Fix address book/group selection (#1486619) +- Assign newly created contacts to the active group (#1486626) - Added option not to mark messages as read when viewed in preview pane (#1485012) - Allow plugins modify the Sent folder when composing (#1486548) - Added optional (max_recipients) support to restrict total number of recipients per message (#1484542) diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php index 070e00ffd..dd37972c2 100644 --- a/program/include/rcube_contacts.php +++ b/program/include/rcube_contacts.php @@ -212,7 +212,7 @@ class rcube_contacts extends rcube_addressbook if ($col == 'ID' || $col == $this->primary_key) { $ids = !is_array($value) ? explode(',', $value) : $value; - $add_where[] = $this->primary_key.' IN ('.join(',', $ids).')'; + $add_where[] = 'c.' . $this->primary_key.' IN ('.join(',', $ids).')'; } else if ($strict) $add_where[] = $this->db->quoteIdentifier($col).'='.$this->db->quote($value); @@ -336,6 +336,10 @@ class rcube_contacts extends rcube_addressbook $insert_id = $this->db->insert_id('contacts'); } + + // also add the newly created contact to the active group + if ($insert_id && $this->group_id) + $this->add_to_group($this->group_id, $insert_id); return $insert_id; } diff --git a/program/js/app.js b/program/js/app.js index 946c43062..8b5460ac4 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -525,7 +525,7 @@ function rcube_webmail() this.reset_qsearch(); this.list_contacts(props); - this.enable_command('add', 'import', (this.env.address_sources && !this.env.address_sources[props].readonly)); + this.enable_command('add', 'import', (this.env.address_sources && !this.env.address_sources[this.env.source].readonly)); } break; @@ -3443,8 +3443,7 @@ function rcube_webmail() else if (group != this.env.group) page = this.env.current_page = 1; - this.select_folder(src, this.env.source); - this.select_folder(group, this.env.group, 'rcmliG'); + this.select_folder((group ? 'G'+group : src), (this.env.group ? 'G'+this.env.group : this.env.source)); this.env.source = src; this.env.group = group; @@ -3516,7 +3515,7 @@ function rcube_webmail() if (action && (cid || action=='add') && !this.drag_active) { this.set_busy(true); - target.location.href = this.env.comm_path+'&_action='+action+'&_source='+urlencode(this.env.source)+'&_cid='+urlencode(cid) + add_url; + target.location.href = this.env.comm_path+'&_action='+action+'&_source='+urlencode(this.env.source)+'&_gid='+urlencode(this.env.group)+'&_cid='+urlencode(cid) + add_url; } return true; }; diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc index fa97bc0a2..3e2d8c583 100644 --- a/program/steps/addressbook/edit.inc +++ b/program/steps/addressbook/edit.inc @@ -88,6 +88,7 @@ function get_form_tags($attrib) if (empty($EDIT_FORM)) { $hiddenfields = new html_hiddenfield(array('name' => '_source', 'value' => get_input_value('_source', RCUBE_INPUT_GPC))); + $hiddenfields->add(array('name' => '_gid', 'value' => $CONTACTS->group_id)); if (($result = $CONTACTS->get_result()) && ($record = $result->first())) $hiddenfields->add(array('name' => '_cid', 'value' => $record['ID'])); -- cgit v1.2.3