AddressBook
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
$objectclass = prompt("What is a valid LDAP objectclass that I can search for?",
"organizationalUnit");
print "The LDAP test script will attempt to bind anonymously to \"$hostname\"
and search for \"objectclass=$objectclass\"
using the base: $base\n";
open F, ">t/t.ldap.conf";
print F << "EDQ";
<AddressBook_config>
<fields>
<field name="objectclass">
<db type="LDAP" name="objectclass" />
</field>
</fields>
<databases>
<LDAP
hostname = "$hostname"
base = "$base"
anonymous = "1"
objectclass = "$objectclass"
/>
</databases>
</AddressBook_config>
EDQ
close F;
}
WriteMakefile(
'NAME' => 'AddressBook',
'VERSION_FROM' => 'lib/AddressBook.pm',
);
examples/ldap-abook.conf view on Meta::CPAN
}
} 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 ? " ($description)" : ''),
table(Tr([map{($attributes{$_}) ? td([$_,$attributes{$_}]) : '' } ('Home','Work','Pager','Mobile') ]))]))"
intra_attr_sep="<br>"
/>
<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>
html/index.html view on Meta::CPAN
</ul>
<p>See also the man pages for the <a href=#backend_doc>different backend databases</a>.
<hr>
<h3>Examples</h3>
<p>The following sample files are provided in the examples directory.
<font color=red>Note: It is highly recommended that you back up your addressbook database
before running one of these scripts.</font>
<table>
<tr><td>ldap-abook.conf<td>A sample configuration file which is used by all of the sample scripts
<tr><td>abook.palm<td>A PalmOS conduit which synchronizes a palm pilot with an LDAP database.
<tr><td>SyncAbook<td>Same as abook.palm, but written as a <a href=http://www.moshpit.org/>PilotManager</a>
conduit.
<tr><td>phonelist.cgi<td>A cgi script which will generate a list of names and phone numbers from
an LDAP database.
</table>
<hr>
<h3>See Also</h3>
<p>The <a href=http://ldap-abook.sourceforge.net>LDAP-Abook Project</a> is a full-featured
CGI interface, designed to work with an LDAP backend addressbook database. LDAP-Abook is based
on the perl-abook library.
<hr>
lib/AddressBook/Config.pm view on Meta::CPAN
<!ATTLIST HTML key_fields CDATA #IMPLIED
filename CDATA #IMPLIED
phone_display CDATA #IMPLIED>
]>
For example,
<AddressBook_config>
<fields>
<field name="firstname" type="text" order="1">
<db type="LDAP" name="givenname" />
<db type="HTML" name="First Name" order="2" />
</field>
<field name="lastname" type="text" order="2">
<db type="LDAP" name="sn" />
<db type="HTML" name="Last Name" order="1" />
</field>
<field name="fullname" type="text" order="3"
calculate="$firstname . ' ' . $lastname">
<db type="LDAP" name="cn" />
<db type="HTML" name="Full Name" />
</field>
</fields>
<databases>
<LDAP objectclass="inetOrgPerson"
base="o=abook"
dn_calculate="'cn='.$cn"
username="cn=Manager,o=abook"
password="secret"
key_fields="cn"
/>
</databases>
</AddressBook_config>
This defines three attributes with cannonical names "firstname", "lastname", and
"fullname". These are accessed in the LDAP backend context as "givenname", "sn" and
"cn", and in the HTML backend context as "First Name", "Last Name" and "Full Name"
respectively.
The default attribute ordering is "firstname", "lastname", "fullname", however
the HTML backend overrides this and in that context attributes are ordered: "lastname",
lib/AddressBook/Config.pm view on Meta::CPAN
"fullname" is a calculated attribute. Calculation strings may reference the
names of other attributes by "$<attr_name>".
Backend databases may also be named and then tied to a source type by using the 'driver'
attribute. This technique is useful for defining multiple backends of the same type.
For example,
<AddressBook_config>
<fields>
<field name="firstname" >
<db type="ldap_server_1" name="givenname" />
<db type="ldap_server_2" name="givenname" />
</field>
<field name="lastname" >
<db type="ldap_server_1" name="sn" />
<db type="ldap_server_2" name="sn" />
</field>
</fields>
<databases>
<ldap_server_1 driver="LDAP"
hostname="server_1"
objectclass="inetOrgPerson"
base="o=abook"
dn_calculate="'cn='.$cn"
username="cn=Manager,o=abook"
password="secret"
key_fields="cn"
/>
<ldap_server_2 driver="LDAP"
hostname="server_2"
objectclass="inetOrgPerson"
base="o=abook"
dn_calculate="'cn='.$cn"
username="cn=Manager,o=abook"
password="secret"
key_fields="cn"
/>
</databases>
</AddressBook_config>
See the various backend man pages for information on the <database> configuration
attributes. See also the sample configuration files in the 'examples' directory.
=cut
use AddressBook;
use strict;
<AddressBook_config>
<fields>
<field name="fullname" order="1" type="text">
<db type="LDAP" name="cn"/>
<db type="LDIF" name="cn"/>
<db type="Text" name="Full Name"/>
<db type="HTML" name="Full Name"/>
<db type="DBI" name="fullname"/>
</field>
<field name="lastname" order="2" type="text" calculate="do {$fullname->[0]=~/(\S*)$/}">
<db type="LDAP" name="sn"/>
<db type="LDIF" name="sn"/>
<db type="Text" name="Last Name"/>
<db type="HTML" name="Full Name"/>
<db type="DBI" name="lastname"/>
</field>
<field name="email" order="3" type="text">
<db type="LDAP" name="mail"/>
<db type="LDIF" name="mail"/>
<db type="Text" name="Email Address"/>
<db type="HTML" name="Full Name"/>
<db type="DBI" name="mail"/>
</field>
<field name="objectclass" order="4">
<db type="LDAP" name="objectclass"/>
<db type="LDIF" name="objectclass"/>
</field>
</fields>
<databases>
<DBI
table="t_csv"
key_fields="fullname"
/>
<LDIF
dn_calculate="'cn='.$cn,'mail='.$mail"
objectclass="abookPerson"
base="o=test"
filename="t/t.ldif"
key_fields="cn"
/>
</databases>
</AddressBook_config>
( run in 1.040 second using v1.01-cache-2.11-cpan-df04353d9ac )