mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
* 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'];
|
||||
}
|
||||
$contact_obj = new Contacts();
|
||||
foreach($list as $type => &$accounts)
|
||||
{
|
||||
$options = array('account_type' => $type) + $accounts;
|
||||
@ -1486,7 +1487,12 @@ abstract class Framework extends Framework\Extra
|
||||
$accounts = array();
|
||||
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(
|
||||
function($account_id, $account_name) {
|
||||
$contact_obj = new Api\Contacts();
|
||||
$contact = $contact_obj->read('account:'.$account_id, true);
|
||||
return array(
|
||||
'value' => ''.$account_id,
|
||||
'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
|
||||
@ -80,7 +87,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
||||
// calendar app is not yet loaded.
|
||||
$value = !empty($sel_options) ? array(): explode(',', $value);
|
||||
}
|
||||
|
||||
|
||||
// Add external owners that a select account widget will not find
|
||||
foreach($value as &$owner)
|
||||
{
|
||||
@ -161,6 +168,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
||||
$remove_contacts = array();
|
||||
|
||||
$resources = array_merge(array('' => $bo->resources['']),$bo->resources);
|
||||
$contacts_obj = new Api\Contacts();
|
||||
foreach($resources as $type => $data)
|
||||
{
|
||||
$mapped = array();
|
||||
@ -193,7 +201,6 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
||||
{
|
||||
case 'l':
|
||||
// Include mailing lists
|
||||
$contacts_obj = new Api\Contacts();
|
||||
$lists = array_filter(
|
||||
$contacts_obj->get_lists(Api\Acl::READ),
|
||||
function($element) use($query) {
|
||||
@ -229,6 +236,23 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,16 @@ var et2_calendar_owner = (function(){ "use strict"; return et2_taglist_email.ext
|
||||
if (item.class) label.addClass(item.class);
|
||||
if (typeof item.title != 'undefined') label.attr('title', item.title);
|
||||
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;
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user