* Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ /** \file htdocs/admin/ldap_contacts.php \ingroup ldap \brief Page d'administration/configuration du module Ldap \version $Revision$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/authldap.lib.php"); require_once (DOL_DOCUMENT_ROOT."/contact.class.php"); $langs->load("admin"); if (!$user->admin) accessforbidden(); /* * Actions */ if ($_GET["action"] == 'setvalue' && $user->admin) { $error=0; if (! dolibarr_set_const($db, 'LDAP_CONTACT_DN',$_POST["contactdn"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_NAME',$_POST["fieldname"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_FIRSTNAME',$_POST["fieldfirstname"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_MAIL',$_POST["fieldmail"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_PHONE',$_POST["fieldphone"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',$_POST["fieldmobile"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',$_POST["fieldfax"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_ADDRESS',$_POST["fieldaddress"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_ZIP',$_POST["fieldzip"])) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_TOWN',$_POST["fieldtown"])) $error++; if ($error) { dolibarr_print_error($db->error()); } } /* * Visu */ llxHeader(); print_fiche_titre($langs->trans("LDAPSetup"),'','setup'); // Test si fonction LDAP actives if (! function_exists("ldap_connect")) { $mesg=$langs->trans("LDAPFunctionsNotAvailableOnPHP"); } if ($mesg) print '
'.$mesg.'
'; else print '
'; // Onglets $h = 0; $head[$h][0] = DOL_URL_ROOT."/admin/ldap.php"; $head[$h][1] = $langs->trans("LDAPGlobalParameters"); $h++; if ($conf->global->LDAP_SYNCHRO_ACTIVE) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_users.php"; $head[$h][1] = $langs->trans("LDAPUsersAndGroupsSynchro"); $h++; } if ($conf->global->LDAP_CONTACT_ACTIVE) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_contacts.php"; $head[$h][1] = $langs->trans("LDAPContactsSynchro"); $hselected=$h; $h++; } if ($conf->global->LDAP_MEMBERS_ACTIVE) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members.php"; $head[$h][1] = $langs->trans("LDAPMembersSynchro"); $h++; } dolibarr_fiche_head($head, $hselected, $langs->trans("LDAP")); print $langs->trans("LDAPDescContact").'
'; print '
'; print '
'; print ''; print ''; print ''; print "\n"; $var=true; $html=new Form($db); // DN Pour les contacts $var=!$var; print ''; // Name $var=!$var; print ''; // Firstname $var=!$var; print ''; // Mail $var=!$var; print ''; // Phone $var=!$var; print ''; // Mobile $var=!$var; print ''; // Fax $var=!$var; print ''; // Address $var=!$var; print ''; // CP $var=!$var; print ''; // Ville $var=!$var; print ''; $var=!$var; print ''; print '
'.$langs->trans("LDAPSynchronizeContacts").'
'.$langs->trans("LDAPContactDn").picto_required().''; print ''; print ''.$langs->trans("LDAPContactDnExample").'
'.$langs->trans("LDAPFieldName").picto_required().''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'
'.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").'
'.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").'
'.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").'
'.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").'
'.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").'
'.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").'
'.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").'
'.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").'
'; print '
'; print ''; print info_admin($langs->trans("LDAPDescValues")); /* * Test de la connexion */ if (function_exists("ldap_connect")) { if ($conf->global->LDAP_SERVER_HOST) { print '
'; print ''.$langs->trans("LDAPTestSynchroContact").''; print '

'; } if ($_GET["action"] == 'test') { // Creation contact $contact=new Contact($db); $contact->initAsSpecimen(); // Test synchro //$result1=$contact->delete_ldap($user); $result2=$contact->update_ldap($user); $result3=$contact->delete_ldap($user); if ($result2 > 0) { print img_picto('','info').' '; print ''.$langs->trans("LDAPSynchroOK").'
'; } else { print img_picto('','error').' '; print ''.$langs->trans("LDAPSynchroKO"); print ': '.$contact->error; print '
'; } } } $db->close(); llxFooter('$Date$ - $Revision$'); ?>