forked from extern/egroupware
* Api: get avatar showing up for taglist accounts and calendar owner
This commit is contained in:
parent
ad913ff93d
commit
eb5652dc20
@ -1479,6 +1479,7 @@ abstract class Framework extends Framework\Extra
|
|||||||
{
|
{
|
||||||
$list['accounts']['filter']['group'] = $GLOBALS['egw_info']['user']['account_primary_group'];
|
$list['accounts']['filter']['group'] = $GLOBALS['egw_info']['user']['account_primary_group'];
|
||||||
}
|
}
|
||||||
|
$contact_obj = new Contacts();
|
||||||
foreach($list as $type => &$accounts)
|
foreach($list as $type => &$accounts)
|
||||||
{
|
{
|
||||||
$options = array('account_type' => $type) + $accounts;
|
$options = array('account_type' => $type) + $accounts;
|
||||||
@ -1486,7 +1487,12 @@ abstract class Framework extends Framework\Extra
|
|||||||
$accounts = array();
|
$accounts = array();
|
||||||
foreach($key_pair as $account_id => $name)
|
foreach($key_pair as $account_id => $name)
|
||||||
{
|
{
|
||||||
$accounts[] = array('value' => $account_id, 'label' => $name);
|
$contact = $contact_obj->read('account:'.$account_id, true);
|
||||||
|
$accounts[] = array('value' => $account_id, 'label' => $name, 'icon' => self::link('/index.php', array(
|
||||||
|
'menuaction' => 'addressbook.addressbook_ui.photo',
|
||||||
|
'contact_id' => $contact['id'],
|
||||||
|
'etag' => $contact['etag']
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,10 +64,17 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
|||||||
}
|
}
|
||||||
$sel_options += array_map(
|
$sel_options += array_map(
|
||||||
function($account_id, $account_name) {
|
function($account_id, $account_name) {
|
||||||
|
$contact_obj = new Api\Contacts();
|
||||||
|
$contact = $contact_obj->read('account:'.$account_id, true);
|
||||||
return array(
|
return array(
|
||||||
'value' => ''.$account_id,
|
'value' => ''.$account_id,
|
||||||
'label' => $account_name,
|
'label' => $account_name,
|
||||||
'app' => lang('api-accounts')
|
'app' => lang('api-accounts'),
|
||||||
|
'icon' => Api\Framework::link('/index.php', array(
|
||||||
|
'menuaction' => 'addressbook.addressbook_ui.photo',
|
||||||
|
'contact_id' => $contact['id'],
|
||||||
|
'etag' => $contact['etag'] ? $contact['etag'] : 1
|
||||||
|
))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
array_keys($accounts), $accounts
|
array_keys($accounts), $accounts
|
||||||
@ -161,6 +168,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
|||||||
$remove_contacts = array();
|
$remove_contacts = array();
|
||||||
|
|
||||||
$resources = array_merge(array('' => $bo->resources['']),$bo->resources);
|
$resources = array_merge(array('' => $bo->resources['']),$bo->resources);
|
||||||
|
$contacts_obj = new Api\Contacts();
|
||||||
foreach($resources as $type => $data)
|
foreach($resources as $type => $data)
|
||||||
{
|
{
|
||||||
$mapped = array();
|
$mapped = array();
|
||||||
@ -193,7 +201,6 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
|||||||
{
|
{
|
||||||
case 'l':
|
case 'l':
|
||||||
// Include mailing lists
|
// Include mailing lists
|
||||||
$contacts_obj = new Api\Contacts();
|
|
||||||
$lists = array_filter(
|
$lists = array_filter(
|
||||||
$contacts_obj->get_lists(Api\Acl::READ),
|
$contacts_obj->get_lists(Api\Acl::READ),
|
||||||
function($element) use($query) {
|
function($element) use($query) {
|
||||||
@ -229,6 +236,23 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
|||||||
{
|
{
|
||||||
$value = array_merge($value, $value['label']);
|
$value = array_merge($value, $value['label']);
|
||||||
}
|
}
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'r':
|
||||||
|
// TODO: fetch resources photo
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
case '':
|
||||||
|
$contact = $contacts_obj->read($type === '' ? 'account:'.$id : $id, true);
|
||||||
|
if (is_array($contact)) $value['icon'] = Api\Framework::link('/index.php', array(
|
||||||
|
'menuaction' => 'addressbook.addressbook_ui.photo',
|
||||||
|
'contact_id' => $contact['id'],
|
||||||
|
'etag' => $contact['etag'] ? $contact['etag'] : 1
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
$mapped[] = $value;
|
$mapped[] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,16 @@ var et2_calendar_owner = (function(){ "use strict"; return et2_taglist_email.ext
|
|||||||
if (item.class) label.addClass(item.class);
|
if (item.class) label.addClass(item.class);
|
||||||
if (typeof item.title != 'undefined') label.attr('title', item.title);
|
if (typeof item.title != 'undefined') label.attr('title', item.title);
|
||||||
if (typeof item.data != 'undefined') label.attr('data', item.data);
|
if (typeof item.data != 'undefined') label.attr('data', item.data);
|
||||||
|
if (typeof item.icon != 'undefined')
|
||||||
|
{
|
||||||
|
var wrapper = jQuery('<div>').addClass('et2_taglist_tags_icon_wrapper');
|
||||||
|
jQuery('<span/>')
|
||||||
|
.addClass('et2_taglist_tags_icon')
|
||||||
|
.css({"background-image": "url("+(item.icon.match(/^(http|https|\/)/) ? item.icon : egw.image(item.icon, item.app))+")"})
|
||||||
|
.appendTo(wrapper);
|
||||||
|
label.appendTo(wrapper);
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user