[turba] Newline in ldap mapping

Jens-Malte Gottfried jmgottfried at web.de
Thu May 27 14:28:38 UTC 2010


Am 27.05.2010 13:57, schrieb Jan Schneider:
> \n works fine.
>
> Zitat von Jens-Malte Gottfried <jmgottfried at web.de>:
>
>> Dear Madam, dear Sir.
>>
>> I am trying to map the ldap attributes "street", "postalcode" and "l" to
>> the workAddress field in Turba.
>> Is there any possibility to add a newline in the format string?
>> "<br />" or "\n" are escaped properly, showing up literally in the
>> address entry instead of causing a newline there. Adding a "$" as it is
>> parsed in ldap-entries does also not work.
>>
>> My (non-working) mapping looks as follows:
>> $uid = Auth::getBareAuth();
>> $basedn = 'xxx';
>> $cfgSources['public_ldap'] = array(
>>     'title' => _("Addressbuch"),
>>     'type' => 'ldap',
>>     'params' => array(
>>         'server' => 'localhost',
>>         'tls' => false,
>>         'root' => 'ou=public,ou=addressbook,...',
>>         'bind_dn' => 'uid=' . $uid . ',ou=users,' . $basedn,
>>         'bind_password' => Auth::getCredential('password'),
>>         'dn' => array('cn'),
>>         'objectclass' => array('inetOrgPerson'),
>>         'scope' => 'one',
>>         'charset' => 'utf-8',
>>         'version' => 3
>>     ),
>>     'map' => array(
>>         '__key' => 'dn',
>>         '__uid' => 'uid',
>>         'name' => 'cn',
>>         'email' => 'mail',
>>         'lastname' => 'sn',
>>         'title' => 'title',
>>         'company' => 'organizationname',
>>         'businessCategory' => 'businesscategory',
>>         //'workAddress' => 'postaladdress',
>>         'workAddress' => array(
>>                 'fields' => array('workStreet', 'workPostalCode',
>> 'workCity'),
>>                 'format' => '%s<br />%s %s',
>>         ),
>>         'workStreet' => 'street',
>>         'workPostalCode' => 'postalcode',
>>         'workCity' => 'l',
>>         'workPhone' => 'telephonenumber',
>>         'fax' => 'facsimiletelephonenumber',
>>         'homeAddress' => 'homepostaladdress',
>>         'homePhone' => 'homephone',
>>     ...
>>
>> Version-Information (working on Debian Etch):
>> apache2: 2.2.3-4+etch11
>> php5: 5.2.0+dfsg-8+etch16
>> slapd: 2.3.30-5+etch3
>> php5-ldap: 5.2.0+dfsg-8+etch16
>> horde3: 3.1.3-4etch7
>> turba2: 2.1.3-1etch1
>>
>> Regards,
>>
>> Jens-Malte Gottfried
>>
>
> Jan.
>

Aha,

it does work, but only if using "" around the format string:

'workAddress' => array(
    'fields' => array('workStreet', 'workPostalCode', 'workCity'),
    'format' => "%s\n%s %s", // works
),

'workAddress' => array(
    'fields' => array('workStreet', 'workPostalCode', 'workCity'),
    'format' => '%s\n%s %s', // does not work
),

Thanks for your help!

Regards,

Jens-Malte



More information about the turba mailing list