Changeset 5723 in subversion
- Timestamp:
- Jan 5, 2012 11:07:27 AM (17 months ago)
- Location:
- trunk/roundcubemail/program
- Files:
-
- 1 added
- 2 edited
-
js/app.js (modified) (11 diffs)
-
steps/mail/compose.inc (modified) (3 diffs)
-
steps/mail/list_contacts.inc (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/js/app.js
r5717 r5723 4 4 | | 5 5 | This file is part of the Roundcube Webmail client | 6 | Copyright (C) 2005-201 1, The Roundcube Dev Team |6 | Copyright (C) 2005-2012, The Roundcube Dev Team | 7 7 | Copyright (C) 2011, Kolab Systems AG | 8 8 | Licensed under the GNU GPL | … … 31 31 this.onloads = []; 32 32 this.messages = {}; 33 this.group2expand = {}; 33 34 34 35 // create protected reference to myself … … 247 248 } 248 249 else if (this.env.action == 'compose') { 249 this.env.compose_commands = ['send-attachment', 'remove-attachment', 'send', 'cancel', 'toggle-editor']; 250 this.env.compose_commands = ['send-attachment', 'remove-attachment', 'send', 'cancel', 'toggle-editor', 251 'list-adresses', 'add-recipient', 'firstpage', 'previouspage', 'nextpage', 'lastpage']; 250 252 251 253 if (this.env.drafts_mailbox) … … 266 268 // init message compose form 267 269 this.init_messageform(); 270 271 // init address book widget 272 if (this.gui_objects.contactslist) { 273 this.contact_list = new rcube_list_widget(this.gui_objects.contactslist, 274 { multiselect:true, draggable:false, keyboard:false }); 275 this.contact_list.addEventListener('select', function(o){ ref.compose_recipeint_select(o); }); 276 this.contact_list.addEventListener('dblclick', function(o){ ref.compose_add_recipient('to'); }); 277 this.contact_list.init(); 278 } 279 280 if (this.gui_objects.adressbookslist) { 281 this.gui_objects.folderlist = this.gui_objects.adressbookslist; 282 this.enable_command('list-adresses', true); 283 } 268 284 } 269 285 // show printing dialog … … 947 963 break; 948 964 965 case 'list-adresses': 966 this.list_contacts(props); 967 this.enable_command('add-recipient', false); 968 break; 969 970 case 'add-recipient': 971 this.compose_add_recipient(props); 972 break; 973 949 974 case 'reply-all': 950 975 case 'reply-list': … … 1978 2003 this.env.current_page = page; 1979 2004 1980 if (this.task == 'mail') 2005 if (this.task == 'addressbook' || this.contact_list) 2006 this.list_contacts(this.env.source, this.env.group, page); 2007 else if (this.task == 'mail') 1981 2008 this.list_mailbox(this.env.mailbox, page); 1982 else if (this.task == 'addressbook')1983 this.list_contacts(this.env.source, this.env.group, page);1984 2009 } 1985 2010 }; … … 2966 2991 .attr('autocomplete', 'off'); 2967 2992 }; 2993 2994 this.compose_recipeint_select = function(list) 2995 { 2996 this.enable_command('add-recipient', list.selection.length > 0); 2997 }; 2998 2999 this.compose_add_recipient = function(field) 3000 { 3001 var recipients = [], input = $('#_'+field); 3002 3003 if (this.contact_list && this.contact_list.selection.length) { 3004 for (var id, n=0; n < this.contact_list.selection.length; n++) { 3005 id = this.contact_list.selection[n]; 3006 if (id && this.env.contactdata[id]) { 3007 recipients.push(this.env.contactdata[id]); 3008 3009 // group is added, expand it 3010 if (id.charAt(0) == 'E' && this.env.contactdata[id].indexOf('@') < 0 && input.length) { 3011 var gid = id.substr(1); 3012 this.group2expand[gid] = { name:this.env.contactdata[id], input:input.get(0) }; 3013 this.http_request('group-expand', '_source='+urlencode(this.env.source)+'&_gid='+urlencode(gid), false); 3014 } 3015 } 3016 } 3017 } 3018 3019 if (recipients.length && input.length) { 3020 var oldval = input.val(); 3021 input.val((oldval ? oldval + this.env.recipients_delimiter : '') + recipients.join(this.env.recipients_delimiter)); 3022 this.triggerEvent('add-recipient', { field:field, recipients:recipients }); 3023 } 3024 }; 2968 3025 2969 3026 // checks the input fields before sending a message … … 3638 3695 if (typeof this.env.contacts[id] === 'object' && this.env.contacts[id].id) { 3639 3696 insert += this.env.contacts[id].name + this.env.recipients_delimiter; 3640 this.group2expand = $.extend({}, this.env.contacts[id]); 3641 this.group2expand.input = this.ksearch_input; 3697 this.group2expand[this.env.contacts[id].id] = $.extend({ input: this.ksearch_input }, this.env.contacts[id]); 3642 3698 this.http_request('mail/group-expand', '_source='+urlencode(this.env.contacts[id].source)+'&_gid='+urlencode(this.env.contacts[id].id), false); 3643 3699 } … … 3660 3716 this.replace_group_recipients = function(id, recipients) 3661 3717 { 3662 if (this.group2expand && this.group2expand.id == id) {3663 this.group2expand .input.value = this.group2expand.input.value.replace(this.group2expand.name, recipients);3664 this.triggerEvent('autocomplete_insert', { field:this.group2expand .input, insert:recipients });3665 this.group2expand = null;3718 if (this.group2expand[id]) { 3719 this.group2expand[id].input.value = this.group2expand[id].input.value.replace(this.group2expand[id].name, recipients); 3720 this.triggerEvent('autocomplete_insert', { field:this.group2expand[id].input, insert:recipients }); 3721 this.group2expand[id] = null; 3666 3722 } 3667 3723 }; … … 4002 4058 url += '&_search='+this.env.search_request; 4003 4059 4004 this.http_request( 'list', url, lock);4060 this.http_request(this.env.task == 'mail' ? 'list-contacts' : 'list', url, lock); 4005 4061 }; 4006 4062 … … 6039 6095 this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading && this.env.messagecount); 6040 6096 6041 if ( response.action == 'list' || response.action == 'search') {6097 if ((response.action == 'list' || response.action == 'search') && this.message_list) { 6042 6098 this.msglist_select(this.message_list); 6043 6099 this.triggerEvent('listupdate', { folder:this.env.mailbox, rowcount:this.message_list.rowcount }); -
trunk/roundcubemail/program/steps/mail/compose.inc
r5716 r5723 6 6 | | 7 7 | This file is part of the Roundcube Webmail client | 8 | Copyright (C) 2005-201 1, The Roundcube Dev Team |8 | Copyright (C) 2005-2012, The Roundcube Dev Team | 9 9 | Licensed under the GNU GPL | 10 10 | | … … 1472 1472 1473 1473 1474 function rcmail_adressbook_list($attrib = array()) 1475 { 1476 global $RCMAIL, $OUTPUT; 1477 1478 $attrib += array('id' => 'rcmdirectorylist'); 1479 1480 $out = ''; 1481 $line_templ = html::tag('li', array( 1482 'id' => 'rcmli%s', 'class' => '%s'), 1483 html::a(array('href' => '#list', 1484 'rel' => '%s', 1485 'onclick' => "return ".JS_OBJECT_NAME.".command('list-adresses','%s',this)"), '%s')); 1486 1487 foreach ($RCMAIL->get_address_sources() as $j => $source) { 1488 $id = strval(strlen($source['id']) ? $source['id'] : $j); 1489 $js_id = JQ($id); 1490 1491 // set class name(s) 1492 $class_name = 'addressbook'; 1493 if ($source['class_name']) 1494 $class_name .= ' ' . $source['class_name']; 1495 1496 $out .= sprintf($line_templ, 1497 html_identifier($id), 1498 $class_name, 1499 $source['id'], 1500 $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id))); 1501 } 1502 1503 $OUTPUT->add_gui_object('adressbookslist', $attrib['id']); 1504 1505 return html::tag('ul', $attrib, $out, html::$common_attrib); 1506 } 1507 1508 // return the contacts list as HTML table 1509 function rcmail_contacts_list($attrib = array()) 1510 { 1511 global $OUTPUT; 1512 1513 $attrib += array('id' => 'rcmAddressList'); 1514 1515 // set client env 1516 $OUTPUT->add_gui_object('contactslist', $attrib['id']); 1517 $OUTPUT->set_env('pagecount', 0); 1518 $OUTPUT->set_env('current_page', 0); 1519 $OUTPUT->include_script('list.js'); 1520 1521 return rcube_table_output($attrib, array(), array('name'), 'ID'); 1522 } 1523 1524 1525 1474 1526 // register UI objects 1475 1527 $OUTPUT->add_handlers(array( … … 1485 1537 'dsncheckbox' => 'rcmail_dsn_checkbox', 1486 1538 'storetarget' => 'rcmail_store_target_selection', 1539 'adressbooks' => 'rcmail_adressbook_list', 1540 'addresslist' => 'rcmail_contacts_list', 1487 1541 )); 1488 1542
Note: See TracChangeset
for help on using the changeset viewer.
