<AddressBook_config>
  <fields>
    <field name="fullname" order="1" type="text" 
	   calculate = "do {
                          my ($i,@name); 
                          if (defined $givenname &amp;&amp; @{$givenname}) {
                            for ($i=0;$i&lt;=$#{$givenname};$i++) { 
                              if ($givenname->[$i]) {
                                $name[$i] = $givenname->[$i] . ' ';
                                $name[$i] .= $lastname->[$i]||( ($samelastname->[0] =~ /yes/i) ? $lastname->[0] : '') || '';
                                $name[$i] =~ s/^ | $//g ;
                              } else {
                                $name[$i] = '';
                              }
                            } 
                          } else {
                            foreach (@{$lastname}) {
                              $name[$i] = $_;
                            } 
                          }
                          \@name;
                        }"
           calc_order ="1"
    >
      <db type="abookentry" name="Full Name" read_only="yes"/>
      <db type="phonelist" name="fullname" />
      <db type="Text" name="Full Name" />
      <db type="LDAP" name="cn" />
      <db type="LDIF" name="cn" />
    </field>
    <field name="givenname" order="2" type="text" 
    >
      <db type="abookentry" name="First Name" />
      <db type="Text" name="First Name" />
      <db type="LDAP" name="givenName" />
      <db type="LDIF" name="givenName" />
      <db type="abooknew" name="First Name" />
      <db type="PDB" name="First name" />
    </field>
    <field name="lastname" order="3" type="text" 
    >
      <db type="abookentry" name="Last Name" />
      <db type="Text" name="Last Name" />
      <db type="LDAP" name="sn" />
      <db type="LDIF" name="sn" />
      <db type="abooksearch" name="Name" />
      <db type="abooknew" name="Last Name" />
      <db type="PDB" name="Name" />
    </field>
    <field name="description" order="3.5" type="text">
      <db type="Text" name="Description" />
      <db type="abookentry" name="Description" />
      <db type="LDAP" name="description" />
      <db type="HTML" name="description" />
      <db type="phonelist" name="description" />
      <db type="LDIF" name="description" />
      <db type="PDB" name="Company" />
    </field>
    <field name="title" order="3.6" type="text">
      <db type="Text" name="Title" />
      <db type="abookentry" name="Title" />
      <db type="LDAP" name="title" />
      <db type="HTML" name="Title" />
      <db type="LDIF" name="title" />
      <db type="PDB" name="Title" />
    </field>
    <field name="email" order="4" type="text">
      <db type="abookentry" name="Email" />
      <db type="Text" name="Email" />
      <db type="LDAP" name="mail" />
      <db type="LDIF" name="mail" />
      <db type="PDB" name="E-mail" />
    </field>
    <field name="homePhone" order="5" type="phone">
      <db type="abookentry" name="Home Phone" />
      <db type="phonelist" name="Home" />
      <db type="Text" name="Home Phone" />
      <db type="LDAP" name="homePhone" />
      <db type="LDIF" name="homePhone" />
      <db type="PDB" name="Home" />
    </field>
    <field name="workPhone" order="6" type="phone">
      <db type="abookentry" name="Work Phone" />
      <db type="phonelist" name="Work" />
      <db type="Text" name="Work Phone" />
      <db type="LDAP" name="telephoneNumber" />
      <db type="LDIF" name="telephoneNumber" />
      <db type="PDB" name="Work" />
    </field>
    <field name="pagerPhone" order="7" type="phone">
      <db type="abookentry" name="Pager Phone" />
      <db type="phonelist" name="Pager" />
      <db type="Text" name="Pager Phone" />
      <db type="LDAP" name="pagerPhone" />
      <db type="LDIF" name="pagerPhone" />
      <db type="PDB" name="Pager" />
    </field>
    <field name="cellPhone" order="8" type="phone">
      <db type="abookentry" name="Cell Phone" />
      <db type="phonelist" name="Mobile" />
      <db type="Text" name="Cell Phone" />
      <db type="LDAP" name="cellPhone" />
      <db type="LDIF" name="cellPhone" />
      <db type="PDB" name="Mobile" />
    </field>
    <field name="fax" order="9" type="phone">
      <db type="Text" name="Fax Number" />
      <db type="abookentry" name="Fax Number" />
      <db type="LDAP" name="fax" />
      <db type="LDIF" name="fax" />
      <db type="PDB" name="Fax" />
    </field>
    <field name="address" order="10" type="textbox">
      <db type="abookentry" name="Street Address" />
      <db type="Text" name="Street Address" />
      <db type="LDAP" name="street" />
      <db type="LDIF" name="street" />
      <db type="PDB" name="Address" /> 
    </field>
    <field name="city" order="11" type="text">
      <db type="abookentry" name="City" />
      <db type="Text" name="City" />
      <db type="LDAP" name="locality" />
      <db type="LDIF" name="locality" />
      <db type="PDB" name="City" />
    </field>
    <field name="state" order="12" type="text">
      <db type="abookentry" name="State" />
      <db type="Text" name="State" />
      <db type="LDAP" name="st" />
      <db type="LDIF" name="st" />
      <db type="PDB" name="State" />
    </field>
    <field name="postalCode" order="13" type="text">
      <db type="Text" name="Zip Code" />
      <db type="abookentry" name="Zip Code" />
      <db type="LDAP" name="postalCode" />
      <db type="LDIF" name="postalCode" />
      <db type="PDB" name="Zip Code" />
    </field>
    <field name="country" order="14" type="text">
      <db type="Text" name="Country" />
      <db type="abookentry" name="Country" />
      <db type="LDAP" name="country" />
      <db type="LDIF" name="country" />
      <db type="PDB" name="Country" />
    </field>
    <field name="birthdate" order="16" type="date">
      <db type="Text" name="Birth Date" />
      <db type="abookentry" name="Birth Date" />
      <db type="LDAP" name="birthDate" />
      <db type="LDIF" name="birthDate" />
      <db type="PDB" name="Birthdate" />
    </field>
    <field name="phonelist" order="17" non_multiple="yes" type="boolean" >
      <db type="Text" name="On Phone List" />
      <db type="abookentry" name="On Phone List" default="No" />
      <db type="LDAP" name="phonelist" />
      <db type="LDIF" name="phonelist" />
    </field>
    <field name="samelastname" order="18" type="boolean" non_multiple="yes" >
      <db type="Text" name="Same Last Name" />
      <db type="abookentry" name="Same Last Name" default="Yes" />
      <db type="LDAP" name="samelastname" />
      <db type="LDIF" name="samelastname" />
    </field>
    <field name="category" order="19" type="select" non_multiple="yes" values="personal,contacts">
      <db type="Text" name="category"/>
      <db type="abookentry" name="category" size="2"/>
      <db type="LDAP" name="category" />
      <db type="LDIF" name="category" />
      <db type="abooksearch" name="Category" />
      <db type="PDB" name="category" />
    </field>
  </fields>
  <databases>
    <abooksearch
            driver="HTML"
    />
    <abookentry
            driver="HTML"
    />
    <abooknew
            driver="HTML"
    />
    <phonelist
            driver="HTML"
            write_format="Tr(td([$fullname . ($description ? &quot; ($description)&quot; : ''),
	                     table(Tr([map{($attributes{$_}) ? td([$_,$attributes{$_}]) : '' } ('Home','Work','Pager','Mobile') ]))]))"
  	    intra_attr_sep="&lt;br&gt;" 
    />
    <LDAP 
            objectclass="abookPerson" 
	    hostname="localhost"
            base="o=abook" 
	    dn_calculate="'cn='.$cn"
	    username="cn=Manager,o=abook"
	    password="secret"
            key_fields = "cn"
    />
    <PDB
            phone_display = "($category eq 'personal') ? 'Home,Work,E-mail' : 'Work,Home,E-mail'"
            key_fields = "Name,First name"
	    port="/dev/pilot"
  />
  </databases>
</AddressBook_config>
