Changeset bb8012c in github
- Timestamp:
- May 13, 2010 5:13:25 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- d17a7fea
- Parents:
- af1cc9d
- Files:
-
- 7 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_contacts.php (modified) (1 diff)
-
program/include/rcube_imap.php (modified) (1 diff)
-
program/js/app.js (modified) (12 diffs)
-
program/steps/addressbook/func.inc (modified) (4 diffs)
-
program/steps/addressbook/groups.inc (modified) (4 diffs)
-
skins/default/addressbook.css (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r4880749 rbb8012c 2 2 =========================== 3 3 4 - Extend contact groups support (#1486682) 4 5 - Fix check-recent action issues and performance (#1486526) 5 6 - Fix messages order after checking for recent (#1484664) -
program/include/rcube_contacts.php
r25fdec5 rbb8012c 124 124 if (!$this->groups) 125 125 return $results; 126 126 console('---------------'); 127 127 $sql_filter = $search ? " AND " . $this->db->ilike('name', '%'.$search.'%') : ''; 128 128 -
program/include/rcube_imap.php
r4880749 rbb8012c 2769 2769 $this->clear_message_cache($mailbox.'.msg'); 2770 2770 } 2771 2771 2772 2772 foreach ($sub_mboxes as $c_mbox) { 2773 2773 if ($c_mbox != 'INBOX') { -
program/js/app.js
r4880749 rbb8012c 509 509 510 510 case 'listgroup': 511 this.list_contacts( null, props);511 this.list_contacts(props.source, props.id); 512 512 break; 513 513 … … 1259 1259 for (var k in this.env.folder_coords) { 1260 1260 pos = this.env.folder_coords[k]; 1261 if (mouse.x >= pos.x1 && mouse.x < pos.x2 && mouse.y >= pos.y1 && mouse.y < pos.y2 1262 && this.check_droptarget(k)) { 1263 1264 li = this.get_folder_li(k); 1265 div = $(li.getElementsByTagName('div')[0]); 1266 1267 // if the folder is collapsed, expand it after 1sec and restart the drag & drop process. 1268 if (div.hasClass('collapsed')) { 1269 if (this.folder_auto_timer) 1261 if (mouse.x >= pos.x1 && mouse.x < pos.x2 && mouse.y >= pos.y1 && mouse.y < pos.y2){ 1262 if (this.check_droptarget(k)) { 1263 li = this.get_folder_li(k); 1264 div = $(li.getElementsByTagName('div')[0]); 1265 1266 // if the folder is collapsed, expand it after 1sec and restart the drag & drop process. 1267 if (div.hasClass('collapsed')) { 1268 if (this.folder_auto_timer) 1269 window.clearTimeout(this.folder_auto_timer); 1270 1271 this.folder_auto_expand = k; 1272 this.folder_auto_timer = window.setTimeout(function() { 1273 rcmail.command('collapse-folder', rcmail.folder_auto_expand); 1274 rcmail.drag_start(null); 1275 }, 1000); 1276 } else if (this.folder_auto_timer) { 1270 1277 window.clearTimeout(this.folder_auto_timer); 1271 1272 this.folder_auto_expand = k; 1273 this.folder_auto_timer = window.setTimeout(function() { 1274 rcmail.command('collapse-folder', rcmail.folder_auto_expand); 1275 rcmail.drag_start(null); 1276 }, 1000); 1277 } else if (this.folder_auto_timer) { 1278 window.clearTimeout(this.folder_auto_timer); 1279 this.folder_auto_timer = null; 1280 this.folder_auto_expand = null; 1278 this.folder_auto_timer = null; 1279 this.folder_auto_expand = null; 1280 } 1281 1282 $(li).addClass('droptarget'); 1283 this.env.folder_coords[k].on = 1; 1284 this.env.last_folder_target = k; 1285 } else { // Clear target, otherwise drag end will trigger move into last valid droptarget 1286 this.env.last_folder_target = null; 1281 1287 } 1282 1283 $(li).addClass('droptarget');1284 this.env.last_folder_target = k;1285 this.env.folder_coords[k].on = 1;1286 1288 } 1287 1289 else if (pos.on) { … … 1503 1505 return (id != this.env.source && this.env.contactfolders[id] && !this.env.contactfolders[id].readonly && 1504 1506 !(!this.env.source && this.env.contactfolders[id].group) && 1507 !(this.env.contactfolders[id].type == 'group' && this.env.contactfolders[this.env.source].readonly) && 1508 !(this.env.contactfolders[id].type == 'group' && this.env.contactfolders[id].source != this.env.source) && 1505 1509 !(this.env.contactfolders[id].type == 'group' && this.env.contactfolders[id].id == this.env.group)); 1506 1510 else if (this.task == 'settings') … … 3418 3422 var target = window; 3419 3423 3420 // currently all groups belong to the local address book 3421 if (group) 3422 src = 0; 3423 else if (!src) 3424 if (!src) 3424 3425 src = this.env.source; 3425 3426 … … 3435 3436 page = this.env.current_page = 1; 3436 3437 3437 this.select_folder((group ? 'G'+ group : src), (this.env.group ? 'G'+this.env.group : this.env.source));3438 this.select_folder((group ? 'G'+src+group : src), (this.env.group ? 'G'+this.env.source+this.env.group : this.env.source)); 3438 3439 3439 3440 this.env.source = src; … … 3520 3521 this.http_post('group-addmembers', '_cid='+urlencode(cid)+'&_source='+urlencode(this.env.source)+'&_gid='+urlencode(to.id)); 3521 3522 else if (to.id != this.env.source && cid && this.env.address_sources[to.id] && !this.env.address_sources[to.id].readonly) 3522 this.http_post('copy', '_cid='+urlencode(cid)+'&_source='+urlencode(this.env.source)+'&_to='+urlencode(to.id) );3523 this.http_post('copy', '_cid='+urlencode(cid)+'&_source='+urlencode(this.env.source)+'&_to='+urlencode(to.id)+(this.env.group ? '&_gid='+urlencode(this.env.group) : '')); 3523 3524 }; 3524 3525 … … 3626 3627 this.name_input.onkeypress = function(e){ return rcmail.add_input_keypress(e); }; 3627 3628 3628 this.gui_objects.folderlist.parentNode.appendChild(this.name_input); 3629 var li = this.get_folder_li(this.env.source) 3630 $(this.name_input).insertAfter(li); 3629 3631 } 3630 3632 … … 3641 3643 this.name_input = document.createElement('input'); 3642 3644 this.name_input.type = 'text'; 3643 this.name_input.value = this.env.contactgroups['G'+this.env. group].name;3645 this.name_input.value = this.env.contactgroups['G'+this.env.source+this.env.group].name; 3644 3646 this.name_input.onkeypress = function(e){ return rcmail.add_input_keypress(e); }; 3645 3647 this.env.group_renaming = true; 3646 3648 3647 var li nk, li = this.get_folder_li(this.env.group, 'rcmliG');3649 var li = this.get_folder_li(this.env.source+this.env.group, 'rcmliG'); 3648 3650 if (li && (link = li.firstChild)) { 3649 3651 $(link).hide(); … … 3662 3664 3663 3665 // callback from server upon group-delete command 3664 this.remove_group_item = function( id)3665 { 3666 var li, key = 'G'+ id;3666 this.remove_group_item = function(prop) 3667 { 3668 var li, key = 'G'+prop.source+prop.id; 3667 3669 if ((li = this.get_folder_li(key))) { 3668 this.triggerEvent('removegroup', { id:id, li:li });3670 this.triggerEvent('removegroup', { source:prop.source, id:prop.id, li:li }); 3669 3671 3670 3672 li.parentNode.removeChild(li); … … 3673 3675 } 3674 3676 3675 this.list_contacts( null, 0);3677 this.list_contacts(prop.source, 0); 3676 3678 }; 3677 3679 … … 3723 3725 3724 3726 prop.type = 'group'; 3725 var key = 'G'+prop. id;3727 var key = 'G'+prop.source+prop.id; 3726 3728 this.env.contactfolders[key] = this.env.contactgroups[key] = prop; 3727 3729 3728 3730 var link = $('<a>').attr('href', '#') 3729 .bind('click', function() { return rcmail.command('listgroup', prop .id, this);})3731 .bind('click', function() { return rcmail.command('listgroup', prop, this);}) 3730 3732 .html(prop.name); 3731 3733 var li = $('<li>').attr('id', 'rcmli'+key).addClass('contactgroup').append(link); 3732 $(this.gui_objects.folderlist).append(li); 3733 3734 this.triggerEvent('insertgroup', { id:prop.id, name:prop.name, li:li[0] }); 3734 var pli = this.get_folder_li(prop.source) 3735 $(li).insertAfter(pli); 3736 3737 this.triggerEvent('insertgroup', { id:prop.id, source:prop.source, name:prop.name, li:li[0] }); 3735 3738 }; 3736 3739 3737 3740 // callback for renaming a contact group 3738 this.update_contact_group = function( id, name)3741 this.update_contact_group = function(prop) 3739 3742 { 3740 3743 this.reset_add_input(); 3741 3744 3742 var key = 'G'+ id, link, li = this.get_folder_li(key);3745 var key = 'G'+prop.source+prop.id, link, li = this.get_folder_li(key); 3743 3746 3744 3747 if (li && (link = li.firstChild) && link.tagName.toLowerCase() == 'a') 3745 link.innerHTML = name;3748 link.innerHTML = prop.name; 3746 3749 3747 3750 this.env.contactfolders[key].name = this.env.contactgroups[key].name = name; 3748 this.triggerEvent('updategroup', { id: id, name:name, li:li[0] });3751 this.triggerEvent('updategroup', { id:prop.id, source:prop.source, name:prop.name, li:li[0] }); 3749 3752 }; 3750 3753 … … 4874 4877 4875 4878 if (response.action == 'list' || response.action == 'search') { 4876 this.enable_command('group-create', this.env.address_sources[this.env.source].groups); 4877 this.enable_command('group-rename', 'group-delete', this.env.address_sources[this.env.source].groups && this.env.group); 4879 this.enable_command('group-create', 4880 (this.env.address_sources[this.env.source].groups && !this.env.address_sources[this.env.source].readonly)); 4881 this.enable_command('group-rename', 'group-delete', 4882 (this.env.address_sources[this.env.source].groups && this.env.group && !this.env.address_sources[this.env.source].readonly)); 4878 4883 this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount }); 4879 4884 } -
program/steps/addressbook/func.inc
ra61bbb2 rbb8012c 51 51 $OUTPUT->set_env('source', $source ? $source : '0'); 52 52 $OUTPUT->set_env('readonly', $CONTACTS->readonly, false); 53 $OUTPUT->set_env('address_sources', $js_list); 53 if(! $OUTPUT->ajax_call) 54 $OUTPUT->set_env('address_sources', $js_list); 54 55 55 56 … … 63 64 $out = ''; 64 65 $local_id = '0'; 66 $jsdata = array(); 65 67 $current = get_input_value('_source', RCUBE_INPUT_GPC); 66 68 $line_templ = html::tag('li', array('id' => 'rcmli%s', 'class' => 'addressbook %s'), … … 82 84 $out .= sprintf($line_templ, $dom_id, ($current == $id ? 'selected' : ''), 83 85 Q(rcmail_url(null, array('_source' => $id))), $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id))); 84 } 85 86 $out .= rcmail_contact_groups(array('items' => true)); 87 86 $groupdata = rcmail_contact_groups(array('out' => $out, 'jsdata' => $jsdata, 'source' => $id)); 87 $jsdata = $groupdata['jsdata']; 88 $out = $groupdata['out']; 89 } 90 91 $OUTPUT->set_env('contactgroups', $jsdata); 88 92 $OUTPUT->add_gui_object('folderlist', $attrib['id']); 89 93 … … 92 96 93 97 94 function rcmail_contact_groups($a ttrib)98 function rcmail_contact_groups($args) 95 99 { 96 global $CONTACTS, $OUTPUT; 97 98 if (!$attrib['id']) 99 $attrib['id'] = 'rcmgroupslist'; 100 101 $groups = $CONTACTS->list_groups(); 102 $line_templ = html::tag('li', array('id' => 'rcmliG%s', 'class' => 'contactgroup'), 103 html::a(array('href' => '#', 'onclick' => "return ".JS_OBJECT_NAME.".command('listgroup','%s',this)"), '%s')); 104 105 $jsdata = array(); 106 foreach ($groups as $group) { 107 $out .= sprintf($line_templ, $group['ID'], $group['ID'], Q($group['name'])); 108 $jsdata['G'.$group['ID']] = array('id' => $group['ID'], 'name' => $group['name'], 'type' => 'group'); 109 } 110 111 $OUTPUT->set_env('contactgroups', $jsdata); 112 //$OUTPUT->add_gui_object('groupslist', $attrib['id']); 113 114 return $attrib['items'] ? $out : html::tag('ul', $attrib, $out, html::$common_attrib); 100 global $RCMAIL; 101 102 $groups = $RCMAIL->get_address_book($args['source'])->list_groups(); 103 104 if (!empty($groups)) { 105 $line_templ = html::tag('li', array('id' => 'rcmliG%s%s', 'class' => 'contactgroup'), 106 html::a(array('href' => '#', 'onclick' => "return ".JS_OBJECT_NAME.".command('listgroup',{'source':'%s','id':'%s'},this)"), '%s')); 107 108 $jsdata = array(); 109 foreach ($groups as $group) { 110 $args['out'] .= sprintf($line_templ, $args['source'], $group['ID'], $args['source'], $group['ID'], Q($group['name'])); 111 $args['jsdata']['G'.$args['source'].$group['ID']] = array( 112 'source' => $args['source'], 'id' => $group['ID'], 'name' => $group['name'], 'type' => 'group'); 113 } 114 } 115 116 return $args; 115 117 } 116 118 -
program/steps/addressbook/groups.inc
rd1851ba rbb8012c 19 19 20 20 */ 21 22 21 23 22 if ($CONTACTS->readonly || !$CONTACTS->groups) { … … 63 62 64 63 if ($created && $OUTPUT->ajax_call) { 64 $created['source'] = $source; 65 65 $OUTPUT->command('insert_contact_group', $created); 66 66 } … … 78 78 79 79 if ($newname && $OUTPUT->ajax_call) 80 $OUTPUT->command('update_contact_group', $gid, $newname);80 $OUTPUT->command('update_contact_group', array('source' => $source, 'id' => $gid, 'name' => $newname)); 81 81 else if (!$newname) 82 82 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error'); … … 91 91 92 92 if ($deleted) 93 $OUTPUT->command('remove_group_item', $gid);93 $OUTPUT->command('remove_group_item', array('source' => $source, 'id' => $gid)); 94 94 else 95 95 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error'); -
skins/default/addressbook.css
ra61bbb2 rbb8012c 118 118 left: 0; 119 119 right: 0; 120 overflow: auto; 120 overflow-y: auto; 121 overflow-x: hidden; 121 122 } 122 123 … … 238 239 #directorylist li.contactgroup 239 240 { 240 background-position: 5px -144px; 241 padding-left: 15px; 242 background-position: 20px -144px; 241 243 } 242 244
Note: See TracChangeset
for help on using the changeset viewer.
