- syntax of link-entry widget (addressbook:id instead of just id)

- fixed loading of field translations
This commit is contained in:
Ralf Becker 2006-10-05 08:05:25 +00:00
parent 3e44e466c5
commit d2ad639d3e

View File

@ -55,10 +55,8 @@ class contact_widget
function contact_widget($ui) function contact_widget($ui)
{ {
$this->ui = $ui; $this->ui = $ui;
if (!is_object($GLOBALS['egw']->contacts)) if (!is_object($GLOBALS['egw']->contacts))
{ {
$GLOBALS['egw']->translation->add_app('addressbook');
$GLOBALS['egw']->contacts =& CreateObject('phpgwapi.contacts'); $GLOBALS['egw']->contacts =& CreateObject('phpgwapi.contacts');
} }
$this->contacts =& $GLOBALS['egw']->contacts; $this->contacts =& $GLOBALS['egw']->contacts;
@ -82,6 +80,8 @@ class contact_widget
switch($cell['type']) switch($cell['type'])
{ {
case 'contact-fields': case 'contact-fields':
$GLOBALS['egw']->translation->add_app('addressbook');
$this->contacts->contacts();
$cell['sel_options'] = $this->contacts->contact_fields; $cell['sel_options'] = $this->contacts->contact_fields;
$cell['type'] = 'select'; $cell['type'] = 'select';
$cell['no_lang'] = 1; $cell['no_lang'] = 1;
@ -89,6 +89,7 @@ class contact_widget
case 'contact-value': case 'contact-value':
default: default:
if (substr($value,0,12) == 'addressbook:') $value = substr($value,12); // link-entry syntax
if (!$value || !$cell['size'] || (!is_array($this->contact) || $this->contact['id'] != $value) && if (!$value || !$cell['size'] || (!is_array($this->contact) || $this->contact['id'] != $value) &&
!($this->contact = $this->contacts->read($value))) !($this->contact = $this->contacts->read($value)))
{ {