\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{Configuring Turba to use the same fields as Outlook 2003}
This document is intended to help Horde administrators create a more Outlook-like experience for their users by giving them the address book fields they are accustomed to.  An export of an Outlook 2003 address book contains a number of fields not included in the Outlook UI.  This document only covers the fields available in the Outlook UI.

\section{Modifying attributes.php}
\textit{turba/config/attributes.php} is the file that defines which fields are available to turba, and what type of data they can hold.  Make the following changes and additions to the default \textit{attributes.php}.  (\textbf{Note:} the \textit{addresslink} type is only available in the CVS version of Horde/Turba.  If you want to use this howto for the current stable Horde/Turba, use \textit{address} instead.  It's not as pretty, but it will do the job)

Modify the \textit{name} field to look like:

<pre><code>
\$attributes['name'] = array(
    'label' => '',
    'type' => 'html',
    'required' => true
);
</code></pre>
Modify the \textit{lastname} field to look like:

<pre><code>
\$attributes['lastname'] = array(
    'label' => \_("Last Name"),
    'type' => 'text',
    'required' => false
);
</code></pre>
Modify the \textit{homeAddress} field to look like:

<pre><code>
 \$attributes['homeAddress'] = array(
    'label' => '',
    'type' => 'addresslink',
    'required' => false,
);
</code></pre>
Modify the \textit{workAddress} field to look like:

<pre><code>
\$attributes['workAddress'] = array(
    'label' => '',
    'type' => 'addresslink',
    'required' => false,
);
</code></pre>
Modify the \textit{cellPhone} field to look like:

<pre><code>
\$attributes['cellPhone'] = array(
    'label' => \_("Mobile Phone"),
    'type' => 'text',
    'required' => false
);
</code></pre>
And, add the following to the end of the file:

<pre><code>
\$attributes['homeStreet2'] = array(
    'label' => \_("Home Street 2"),
    'type' => 'text',
    'required' => false,
);
\$attributes['homeStreet3'] = array(
    'label' => \_("Home Street 3"),
    'type' => 'text',
    'required' => false,
);
\$attributes['workStreet2'] = array(
    'label' => \_("Work Street 2"),
    'type' => 'text',
    'required' => false,
);
\$attributes['workStreet3'] = array(
    'label' => \_("Work Street 3"),
    'type' => 'text',
    'required' => false,
);
\$attributes['employeeType'] = array(
    'label' => \_("Employee Type"),
    'type' => 'text',
    'required' => false
);
require\_once 'Horde/Prefs/CategoryManager.php';
\$cManager = \&new Prefs\_CategoryManager();
\$categories = array\_merge(array(\_("Unfiled")), \$cManager->get());
\$attributes['category'] = array(
    'label' => \_("Category"),
    'type' => 'enum',
    'params' => array(\$categories),
    'required' => false
);

\$attributes['jobtitle'] = array(
    'label' => \_("Job Title"),
    'type' => 'text',
    'required' => false,
    );

\$attributes['profession'] = array(
    'label' => \_("Profession"),
    'type' => 'text',
    'required' => false,
    );

\$attributes['manager'] = array(
    'label' => \_("Manager's Name"),
    'type' => 'text',
    'required' => false,
    );

\$attributes['assistant'] = array(
    'label' => \_("Assistant's Name"),
    'type' => 'text',
    'required' => false,
    );

\$attributes['suffix'] = array(
    'label' => \_("Suffix"),
    'type' => 'text',
    'required' => false,
    );

\$attributes['spouse'] = array(
    'label' => \_("Spouse's Name"),
    'type' => 'text',
    'required' => false,
    );

\$attributes['anniversary'] = array(
    'label' => \_("Anniversary"),
    'type' => 'monthdayyear',
    'params' => array(1900, null, true, 1),
    'required' => false,
);

\$attributes['pager'] = array(
    'label' => \_("Pager"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['callbackPhone'] = array(
    'label' => \_("Callback Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['email2'] = array(
    'label' => \_("Email") . ' 2',
    'type' => 'email',
    'required' => false,
    'params' => array('', 40, 255)
);

\$attributes['email3'] = array(
    'label' => \_("Email") . ' 3',
    'type' => 'email',
    'required' => false,
    'params' => array('', 40, 255)
);

\$attributes['assistantPhone'] = array(
    'label' => \_("Assistant's Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['workPhone2'] = array(
    'label' => \_("Work Phone") . ' 2',
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['Phone'] = array(
    'label' => \_("Home Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['workFax'] = array(
    'label' => \_("Work Fax"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['callback'] = array(
    'label' => \_("Callback"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['carPhone'] = array(
    'label' => \_("Car Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['companyPhone'] = array(
    'label' => \_("Company Main Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['homePhone2'] = array(
    'label' => \_("Home Phone") . ' 2',
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['homeFax'] = array(
    'label' => \_("Home Fax") . ' 2',
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['isdn'] = array(
    'label' => \_("ISDN"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['otherPhone'] = array(
    'label' => \_("Other Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['otherFax'] = array(
    'label' => \_("Other Fax"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['primaryPhone'] = array(
    'label' => \_("Primary Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['radio'] = array(
    'label' => \_("Radio Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['telex'] = array(
    'label' => \_("Telex"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['tty/tdd'] = array(
    'label' => \_("TTY/TDD Phone"),
    'type' => 'text',
    'required' => false,
    'params' => array('', 40, 25)
);

\$attributes['otherAddress'] = array(
    'label' => '',
    'type' => 'addresslink',
    'required' => false,
);
\$attributes['otherStreet'] = array(
    'label' => \_("Other Street Address"),
    'type' => 'text',
    'required' => false,
);
\$attributes['otherStreet2'] = array(
    'label' => \_("Other Street 2"),
    'type' => 'text',
    'required' => false,
);
\$attributes['otherStreet3'] = array(
    'label' => \_("Other Street 3"),
    'type' => 'text',
    'required' => false,
);
\$attributes['otherCity'] = array(
    'label' => \_("Other City"),
    'type' => 'text',
    'required' => false
);
\$attributes['otherProvince'] = array(
    'label' => \_("Other State/Province"),
    'type' => 'text',
    'required' => false
);
\$attributes['otherPostalCode'] = array(
    'label' => \_("Other Postal Code"),
    'type' => 'text',
    'required' => false
);
\$attributes['otherCountry'] = array(
    'label' => \_("Other Country"),
    'type' => 'text',
    'required' => false
);

\$attributes['middlename'] = array(
    'label' => \_("Middle Name"),
    'type' => 'text',
    'required' => false
);
</code></pre>
\section{Modifying sources.php}
\textit{turba/config/sources.php} is the file that tells Turba which sources to use, and gives it all of the parameters for that source, such as what fields from \textit{attributes.php} are used.

Use the following for your sql source's \textit{'map'} parameter:

<pre><code>
    'map' => array(
        '\_\_key' => 'object\_id',
        '\_\_owner' => 'owner\_id',
        '\_\_type' => 'object\_type',
        '\_\_members' => 'object\_members',
        '\_\_uid' => 'object\_uid',

        'name' => array('fields' => array('firstname', 'lastname'),
                        'format' => '\%s \%s'),
        'title' => 'object\_title',
        'firstname' => 'object\_firstname',
        'middlename' => 'object\_middlename',
        'lastname' => 'object\_lastname',
        'suffix' => 'object\_suffix',
        'company' => 'object\_company',
        'department' => 'object\_department',
        'jobtitle' => 'object\_jobtitle',
        'workStreet' => 'object\_workstreet',
        'workStreet2' => 'object\_workstreet2',
        'workStreet3' => 'object\_workstreet3',
        'workCity' => 'object\_workcity',
        'workProvince' => 'object\_workprovince',
        'workPostalCode' => 'object\_workpostalcode',
        'workCountry' => 'object\_workcountry',
        'workAddress' => array('fields' => array('workStreet', 'workStreet2', 'workStreet3', 'workCity', 'workProvince',
                                                 'workPostalCode'),
                               'format' => "\%s\textbackslash\{\}n\%s\textbackslash\{\}n\%s\textbackslash\{\}n\%s, \%s \%s"),
        'homeStreet' => 'object\_homestreet',
        'homeStreet2' => 'object\_homestreet2',
        'homeStreet3' => 'object\_homestreet3',
        'homeCity' => 'object\_homecity',
        'homeProvince' => 'object\_homeprovince',
        'homePostalCode' => 'object\_homepostalcode',
        'homeCountry' => 'object\_homecountry',
        'homeAddress' => array('fields' => array('homeStreet', 'homeStreet2', 'homeStreet3', 'homeCity', 'homeProvince',
                                                 'homePostalCode'),
                               'format' => "\%s\textbackslash\{\}n\%s\textbackslash\{\}n\%s\textbackslash\{\}n\%s, \%s \%s"),
        'otherStreet' => 'object\_otherstreet',
        'otherStreet2' => 'object\_otherstreet2',
        'otherStreet3' => 'object\_otherstreet3',
        'otherCity' => 'object\_othercity',
        'otherProvince' => 'object\_otherprovince',
        'otherPostalCode' => 'object\_otherpostalcode',
        'otherCountry' => 'object\_othercountry',
        'otherAddress' => array('fields' => array('otherStreet', 'otherStreet2', 'otherStreet3', 'otherCity', 'otherProvince',
                                                  'otherPostalCode'),
                               'format' => "\%s\textbackslash\{\}n\%s\textbackslash\{\}n\%s\textbackslash\{\}n\%s, \%s \%s"),
        'assistantPhone' => 'object\_assistantphone',
        'workFax' => 'object\_workfax',
        'workPhone' => 'object\_workphone',
        'workPhone2' => 'object\_workphone2',
        'callback' => 'object\_callback',
        'carPhone' => 'object\_carphone',
        'companyPhone' => 'object\_companyphone',
        'homeFax' => 'object\_homefax',
        'homePhone' => 'object\_homephone',
        'homePhone2' => 'object\_homephone2',
        'isdn' => 'object\_isdn',
        'cellPhone' => 'object\_cellphone',
        'otherFax' => 'object\_otherfax',
        'otherPhone' => 'object\_otherphone',
        'pager' => 'object\_pager',
        'primaryPhone' => 'object\_primaryphone',
        'radio' => 'object\_radio',
        'tty/tdd' => 'object\_ttytdd',
        'telex' => 'object\_telex',
        'anniversary' => 'object\_anniversary',
        'assistant' => 'object\_assistant',
        'birthday' => 'object\_birthday',
        'category' => 'object\_category',
        'email' => 'object\_email',
        'email2' => 'object\_email2',
        'email3' => 'object\_email3',
        'freebusyUrl' => 'object\_freebusyurl',
        'manager' => 'object\_manager',
        'notes' => 'object\_notes',
        'office' => 'object\_office',
        'profession' => 'object\_profession',
        'spouse' => 'object\_spouse',
        'website' => 'object\_website',
        'alias' => 'object\_alias',
        'nickname' => 'object\_nickname',
        'pgpPublicKey' => 'object\_pgppublickey',
        'smimePublicKey' => 'object\_smimepublickey',
    ),
</code></pre>
And, use the following for your sql source's \textit{'tabs'} parameter.  This is not included in the default \textit{sources.php}, so you will have to add it.

<pre><code>
    'tabs' => array(
        'General' => array('name', 'firstname', 'middlename', 'lastname', 'jobtitle', 'company', 'email', 'email2',
                           'email3', 'alias', 'website', 'category'),
        'Phone Numbers' => array('primaryPhone', 'homePhone', 'homePhone2', 'homeFax', 'workPhone', 'workPhone2',
                                 'workFax', 'cellPhone', 'pager', 'assistantPhone', 'callback', 'carPhone',
                                 'companyPhone', 'isdn', 'otherPhone', 'otherFax', 'radio', 'telex', 'tty/tdd'),
        'Home Address' => array('homeStreet', 'homeStreet2', 'homeStreet3', 'homeCity', 'homeProvince', 'homePostalCode',
                                'homeCountry', 'homeAddress'),
        'Work Address' => array('workStreet', 'workStreet2', 'workStreet3', 'workCity', 'workProvince', 'workPostalCode',
                                'workCountry', 'workAddress'),
        'Other Address' => array('otherStreet', 'otherStreet2', 'otherStreet3', 'otherCity', 'otherProvince', 'otherPostalCode',
                                 'otherCountry', 'otherAddress'),
        'Details' => array('department', 'office', 'profession', 'manager', 'assistant', 'nickname', 'title',
                           'suffix', 'spouse', 'birthday', 'anniversary', 'freebusyUrl', 'notes'),
        'Certificates' => array('pgpPublicKey', 'smimePublicKey'),
    ),
</code></pre>
\section{Preparing the database}
The following SQL script will create a turba database table to hold all of the new fields.

<pre><code class="language-SQL">
CREATE TABLE turba\_objects (
    object\_id VARCHAR(32) NOT NULL,
    owner\_id VARCHAR(255) NOT NULL,
    object\_type VARCHAR(255) DEFAULT 'Object' NOT NULL,
    object\_uid VARCHAR(255),
    object\_members BLOB,
    object\_lastname VARCHAR(255),
    object\_alias VARCHAR(32),
    object\_email VARCHAR(255),
    object\_homestreet VARCHAR(255),
    object\_homestreet3 VARCHAR(255),
    object\_workstreet VARCHAR(255),
    object\_workstreet3 VARCHAR(255),
    object\_homephone VARCHAR(25),
    object\_workphone VARCHAR(25),
    object\_cellphone VARCHAR(25),
    object\_workfax VARCHAR(25),
    object\_title VARCHAR(255),
    object\_company VARCHAR(255),
    object\_notes TEXT,
    object\_pgppublickey TEXT,
    object\_smimepublickey TEXT,
    object\_freebusyurl VARCHAR(255),
    object\_firstname VARCHAR(255),
    object\_homecity VARCHAR(255),
    object\_homeprovince VARCHAR(255),
    object\_homepostalcode VARCHAR(255),
    object\_homecountry VARCHAR(255),
    object\_homestreet2 VARCHAR(255),
    object\_workstreet2 VARCHAR(255),
    object\_workcity VARCHAR(255),
    object\_workprovince VARCHAR(255),
    object\_workpostalcode VARCHAR(255),
    object\_workcountry VARCHAR(255),
    object\_website VARCHAR(255),
    object\_birthday VARCHAR(255),
    object\_nickname VARCHAR(255),
    object\_office VARCHAR(255),
    object\_jobtitle VARCHAR(255),
    object\_profession VARCHAR(255),
    object\_manager VARCHAR(255),
    object\_assistant VARCHAR(255),
    object\_suffix VARCHAR(255),
    object\_spouse VARCHAR(255),
    object\_anniversary VARCHAR(255),
    object\_email2 VARCHAR(255),
    object\_email3 VARCHAR(255),
    object\_category VARCHAR(255),
    object\_assistantphone VARCHAR(25),
    object\_workphone2 VARCHAR(25),
    object\_callback VARCHAR(255),
    object\_carphone VARCHAR(25),
    object\_companyphone VARCHAR(25),
    object\_homephone2 VARCHAR(25),
    object\_homefax VARCHAR(25),
    object\_isdn VARCHAR(255),
    object\_otherphone VARCHAR(25),
    object\_otherfax VARCHAR(25),
    object\_pager VARCHAR(25),
    object\_primaryphone VARCHAR(25),
    object\_radio VARCHAR(255),
    object\_telex VARCHAR(255),
    object\_ttytdd VARCHAR(255),
    object\_otherstreet VARCHAR(255),
    object\_otherstreet2 VARCHAR(255),
    object\_otherstreet3 VARCHAR(255),
    object\_othercity VARCHAR(255),
    object\_otherprovince VARCHAR(255),
    object\_otherpostalcode VARCHAR(255),
    object\_othercountry VARCHAR(255),
    object\_middlename VARCHAR(255),
    object\_department VARCHAR(255),
--
    PRIMARY KEY(object\_id)
);

CREATE INDEX turba\_owner\_idx ON turba\_objects (owner\_id);

GRANT SELECT, INSERT, UPDATE, DELETE ON turba\_objects TO horde;
</code></pre>
\end{document}
