[turba] Adding and changing fields in the turba "Contacts" records

Michael Rubinsky mike at theupstairsroom.com
Mon Nov 6 08:09:59 PST 2006


Quoting Eric <spamsink at scoot.netis.com>:

>
> First of all, please remember that you're reading the ravings of  
> someone who knows virtually nothing that's worth knowing about  
> either SQL or PHP.  :-)

No prob, but you obviously know enough to choose the *best* open  
source solution for your contacts database ;)

> The presence and order of things that show up on a "Contact" screen  
> are controlled by the presence and order in the "map" block  
> sources.php, e.g.:
>
>     'map' => array(
>         '__key' => 'object_id',
>         '__owner' => 'owner_id',
>         '__type' => 'object_type',
>         '__members' => 'object_members',
>         '__uid' => 'object_uid',
>         'name' => 'object_name',
>         'email' => 'object_email',
>         'title' => 'object_title',
>         'company' => 'object_company',
>         'workAddress' => 'object_workaddress',
>         'workPhone' => 'object_workphone',
>         'fax' => 'object_fax',
>         'cellPhone' => 'object_cellphone',
>         'homeAddress' => 'object_homeaddress',
>         'homePhone' => 'object_homephone',
>         'notes' => 'object_notes',
>     ),
>
> (I've already modified this somewhat, from the file that came with  
> the distribution.)
>
> So if I want to delete certain items or change the order in which  
> they appear, all I have to do is delete or move them in the "map"   
> block above, right?  I tried that and it worked, I just wanted to  
> make sure there isn't some other hidden thing I have to do that I  
> didn't do and will come back to bite me later..

This is correct.  Your users can also choose which fields are  
displayed in the 'browse' view by using the options.

>
> Next, sources.php says:
>
>     'search' => array(
>         'name',
>         'email'
>     ),
>
> So, that means that ONLY name and email can be searched, right?  If  
> I want it to be able to search on other attribute names (e.g.  
> 'company' or 'title'), all I have to do is add those attribute names  
> to this block, right?  For example...

This is also correct.

> I can do this anytime, right?  So that if, later, after we've added  
> a bunch of records, we decide we want to add to the things on which  
> we can search, all I need to do is add it to the list, right?

Yep.

> I notice that all of the rvalues (or whatever they're called in PHP)  
> like object_name and object_workaddress are all represented in the  
> list above, so I assume that means if it ain't in the list above,  
> Turba can't use it.

Correct.  Since your using mySQL as backend, you need the fields to  
store the data.

> Now I want to add the contact's city, which isn't in the above list  
> (I assume the intent is for people to put the city and state in with  
> the address).  I see that in the "attributes.php" file there is  
> already a "workCity" attribute specified; however there is no  
> corresponding field in the turba_objects table.  So if I want to add  
> a "workCity" to the contacts record, I think I need to do the  
> following:

> 1.  add 'workCity' = 'object_workcity' to the map block in sources.php

This is correct, although you would need to use '=>' and not '=' for  
the assignment.

> 2.  say the following from within mysql:
>
> mysql> alter table turba_objects add column object_workcity varchar (20);
>
> (... if I want the city to be a max of 20 characters long).
>
> Right?

> Anything else I need to do?


Nope.

> Can I do that any time, e.g. after we have added a bunch of records  
> and then decide we need some new fields?

Yep.

> Finally, this contacts database needs to be accessible by all of us.  
>  Is there anywhere in particular that I need to put the use_shares  
> statement?  For example, will the following work?
>
> $cfgSources['localsql'] = array(
>     'title' => _("My Address Book"),
>     'type' => 'sql',
>     'use_shares' => true,
>
> That's enough for now... :-)

For this one, you have two options.  You can leave use_shares set to  
false, and use the permissions interface (Administration->Permissions)  
to give your groups/users the desired perms.

Setting use_shares to true, activates Turba's support for the  
Horde_Share system.  What this does is allows individual users to  
create their own address books in addition to their 'default' book and  
also allows your users to assign permissions on their own. (Without  
share support, only an admin can set/update permissions and there is  
no way to create additional address books without adding new database  
tables).

To do what you are asking about, you can set shares to true, then,  
create a new address book (under the 'My Address Books' page) named  
'Clients' or whatever. Then using the 'Edit Permissions' button on the  
My Address Book page, you can assign whatever perms you want...


Probably more info that you wanted, but I hope this helps...

Thanks,
mike

--
The Horde Project (www.horde.org)
mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 2013 bytes
Desc: PGP Public Key
Url : http://lists.horde.org/archives/turba/attachments/20061106/82f41541/attachment.bin


More information about the turba mailing list