[turba] Photos

Josh Kelley josh at jbc.edu
Tue May 31 14:27:26 PDT 2005


I'm trying to add photos to the search results for Turba's searches of 
our LDAP directory and am having some problems.

Our photos aren't actually in the LDAP directory; they're kept on a web 
server accessible to anyone on campus.  So I thought that I'd use a 
composite field to create HTML fragments referencing them.  First, I 
added this to attributes.php:
$attributes['photo'] = array(
    'label' => _("Photo"),
    'type' => 'html',
    'required' => false
);

Then I added this to the map section of our LDAP source in sources.php:
        'photo' => array('fields' => array('employeenumber'),
                         'format' => '<img 
href="http://www.jbc.edu/directory/%s.jpg">'),

At that point I ran into my first problem: the employeeNumber LDAP 
attribute wasn't being returned by the LDAP search query.  From looking 
very briefly at the source, it looks like the search function does not 
request attributes that are only referenced in composite attributes.  If 
so, is that a bug in Turba?

So I added another attribute to reference the employeenumber attribute 
specifically:
$attributes['id'] = array(
    'label' => _("ID"),
    'type' => 'number',
    'required' => false
);

And I added a reference to it in the map section of sources.php:
        'id' => 'employeenumber',

However, things still aren't working.  "ID" (employeeNumber) shows up 
with the proper value in search results, and the "Photo" line is listed, 
and <img href="http://www.jbc.edu/directory/.jpg"> shows up in the HTML 
source, but the employeeNumber isn't getting substituted in.

What am I missing?

Thanks.

Josh Kelley


More information about the turba mailing list