mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-14 09:58:16 +01:00
"new account template subwidget for the contact widget: allows to select a templated based on some contact data, eg. a form-header based on the organisation unit"
This commit is contained in:
parent
f35db30ef4
commit
0fbb7ef5f4
@ -32,7 +32,8 @@ class contact_widget
|
|||||||
*/
|
*/
|
||||||
var $human_name = array(
|
var $human_name = array(
|
||||||
'contact-value' => 'Contact',
|
'contact-value' => 'Contact',
|
||||||
'contact-account'=> 'Account contactdata',
|
'contact-account' => 'Account contactdata',
|
||||||
|
'contact-template' => 'Account template',
|
||||||
'contact-fields' => 'Contact fields',
|
'contact-fields' => 'Contact fields',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -78,6 +79,7 @@ class contact_widget
|
|||||||
*/
|
*/
|
||||||
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
||||||
{
|
{
|
||||||
|
//echo "<p>contact_widget::pre_process('$name','$value',".print_r($cell,true).",...)</p>\n";
|
||||||
switch($cell['type'])
|
switch($cell['type'])
|
||||||
{
|
{
|
||||||
case 'contact-fields':
|
case 'contact-fields':
|
||||||
@ -94,7 +96,11 @@ class contact_widget
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'contact-account':
|
case 'contact-account':
|
||||||
$value = 'account:'.$value;
|
case 'contact-template':
|
||||||
|
if (substr($value,0,8) != 'account:')
|
||||||
|
{
|
||||||
|
$value = 'account:'.($cell['name'] != 'account:' ? $value : $GLOBALS['egw_info']['user']['account_id']);
|
||||||
|
}
|
||||||
// fall-throught
|
// fall-throught
|
||||||
case 'contact-value':
|
case 'contact-value':
|
||||||
default:
|
default:
|
||||||
@ -108,8 +114,17 @@ class contact_widget
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$type = $cell['size'];
|
$type = $cell['size'];
|
||||||
$value = $this->contact[$type];
|
|
||||||
$cell['size'] = '';
|
$cell['size'] = '';
|
||||||
|
|
||||||
|
if ($cell['type'] == 'contact-template')
|
||||||
|
{
|
||||||
|
$name = $this->contact[$type];
|
||||||
|
$cell['type'] = 'template';
|
||||||
|
if (($prefix = $cell['label'])) $name = strpos($prefix,'%s') !== false ? str_replace('%s',$name,$prefix) : $prefix.$name;
|
||||||
|
$cell['obj'] = new etemplate($name,$tmpl->as_array());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$value = $this->contact[$type];
|
||||||
$cell['no_lang'] = 1;
|
$cell['no_lang'] = 1;
|
||||||
$cell['readonly'] = true;
|
$cell['readonly'] = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user