Changeset 5328 in subversion
- Timestamp:
- Oct 10, 2011 4:15:46 PM (20 months ago)
- Location:
- trunk/roundcubemail/program
- Files:
-
- 5 edited
-
include/rcube_addressbook.php (modified) (1 diff)
-
include/rcube_contacts.php (modified) (3 diffs)
-
js/app.js (modified) (3 diffs)
-
steps/addressbook/mailto.inc (modified) (2 diffs)
-
steps/mail/autocomplete.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_addressbook.php
r5322 r5328 297 297 298 298 /** 299 * Get group properties such as name and email address(es) 300 * 301 * @param string Group identifier 302 * @return array Group properties as hash array 303 */ 304 function get_group($group_id) 305 { 306 /* empty for address books don't supporting groups */ 307 return null; 308 } 309 310 /** 299 311 * Create a contact group with the given name 300 312 * -
trunk/roundcubemail/program/include/rcube_contacts.php
r5322 r5328 163 163 } 164 164 165 166 /** 167 * Get group properties such as name and email address(es) 168 * 169 * @param string Group identifier 170 * @return array Group properties as hash array 171 */ 172 function get_group($group_id) 173 { 174 $sql_result = $this->db->query( 175 "SELECT * FROM ".get_table_name($this->db_groups). 176 " WHERE del<>1". 177 " AND contactgroup_id=?". 178 " AND user_id=?", 179 $group_id, $this->user_id); 180 181 if ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { 182 $sql_arr['ID'] = $sql_arr['contactgroup_id']; 183 return $sql_arr; 184 } 185 186 return null; 187 } 165 188 166 189 /** … … 775 798 "UPDATE ".get_table_name($this->db_groups). 776 799 " SET del=1, changed=".$this->db->now(). 777 " WHERE contactgroup_id=?", 778 $gid 800 " WHERE contactgroup_id=?". 801 " AND user_id=?", 802 $gid, $this->user_id 779 803 ); 780 804 … … 800 824 "UPDATE ".get_table_name($this->db_groups). 801 825 " SET name=?, changed=".$this->db->now(). 802 " WHERE contactgroup_id=?", 803 $name, $gid 826 " WHERE contactgroup_id=?". 827 " AND user_id=?", 828 $name, $gid, $this->user_id 804 829 ); 805 830 -
trunk/roundcubemail/program/js/app.js
r5310 r5328 846 846 847 847 if (a_cids.length) 848 this.http_post('mailto', {_cid: a_cids.join(','), _source: this.env.source}, true); 848 this.http_post('mailto', { _cid: a_cids.join(','), _source: this.env.source}, true); 849 else if (this.env.group) 850 this.http_post('mailto', { _gid: this.env.group, _source: this.env.source}, true); 849 851 850 852 break; … … 3883 3885 } 3884 3886 3885 this.enable_command('compose', list.selection.length > 0);3887 this.enable_command('compose', this.env.group || list.selection.length > 0); 3886 3888 this.enable_command('edit', id && writable); 3887 3889 this.enable_command('delete', list.selection.length && writable); … … 3969 3971 this.contact_list.clear(true); 3970 3972 this.show_contentframe(false); 3971 this.enable_command('delete', 'compose', false); 3973 this.enable_command('delete', false); 3974 this.enable_command('compose', this.env.group ? true : false); 3972 3975 }; 3973 3976 -
trunk/roundcubemail/program/steps/addressbook/mailto.inc
r4850 r5328 22 22 $cids = rcmail_get_cids(); 23 23 $mailto = array(); 24 $recipients = null; 24 25 25 26 foreach ($cids as $source => $cid) … … 32 33 $CONTACTS->set_pagesize(count($cid) + 2); // +2 to skip counting query 33 34 $recipients = $CONTACTS->search($CONTACTS->primary_key, $cid, false, true, true, 'email'); 35 } 36 } 34 37 35 while (is_object($recipients) && ($rec = $recipients->iterate())) { 36 $emails = $CONTACTS->get_col_values('email', $rec, true); 37 $mailto[] = format_email_recipient($emails[0], $rec['name']); 38 } 38 if (!empty($_REQUEST['_gid']) && isset($_REQUEST['_source'])) 39 { 40 $source = get_input_value('_source', RCUBE_INPUT_GPC); 41 $CONTACTS = $RCMAIL->get_address_book($source); 42 43 $group_id = get_input_value('_gid', RCUBE_INPUT_GPC); 44 $group_data = $CONTACTS->get_group($group_id); 45 46 // group has an email address assigned: use that 47 if ($group_data['email']) { 48 $mailto[] = format_email_recipient($group_data['email'][0], $group_data['name']); 49 } 50 else if ($CONTACTS->ready) { 51 $CONTACTS->set_group($group_id); 52 $CONTACTS->set_page(1); 53 $CONTACTS->set_pagesize(200); // limit somehow 54 $recipients = $CONTACTS->list_records(); 55 } 56 } 57 58 if ($recipients) 59 { 60 while (is_object($recipients) && ($rec = $recipients->iterate())) { 61 $emails = $CONTACTS->get_col_values('email', $rec, true); 62 $mailto[] = format_email_recipient($emails[0], $rec['name']); 39 63 } 40 64 } -
trunk/roundcubemail/program/steps/mail/autocomplete.inc
r5128 r5328 86 86 $abook->reset(); 87 87 $abook->set_group($group['ID']); 88 $ result = $abook->count();88 $group_prop = $abook->get_group($group['ID']); 89 89 90 if ($result->count) { 90 // group (distribution list) with email address(es) 91 if ($group_prop['email']) { 92 foreach ((array)$group_prop['email'] as $email) { 93 $contacts[] = format_email_recipient($email, $group['name']); 94 if (count($contacts) >= $MAXNUM) 95 break 2; 96 } 97 } 98 // show group with count 99 else if (($result = $abook->count()) && $result->count) { 91 100 $contacts[] = array('name' => $group['name'] . ' (' . intval($result->count) . ')', 'id' => $group['ID'], 'source' => $id); 92 101 if (count($contacts) >= $MAXNUM)
Note: See TracChangeset
for help on using the changeset viewer.
