[turba] Localsql not listed

Francine.Bolduc at ti.csaffluents.qc.ca Francine.Bolduc at ti.csaffluents.qc.ca
Wed Apr 11 13:01:14 UTC 2012


> Hi !
>
> I have 3 actives address book in /turba/config/backends.php.
>
> In Horde, I see "ldapEmpl" and "ldapEle" but not "localsql". Why ?
>
> /turba/config/backend.local.php :
>
> $cfgSources['localsql'] = array(
>     'disabled' => false,
>     'title' => "Mon carnet personnel",
>     'type' => 'sql',
>     'params' => array(
>         'sql' => array(
>         'phptype' => 'pgsql',
>         'hostspec' => 'localhost',
>         'username' => 'horde',
>         'password' => '<my_password>',
>         'database' => 'horde',
>         'charset' => 'utf-8'
>         ),
>         'table' => 'turba_objects'
>     ),
>         'map' => array(
>         '__key' => 'object_id',
>         '__owner' => 'owner_id',
>         '__type' => 'object_type',
>         '__members' => 'object_members',
>         '__uid' => 'object_uid',
>         'name' => 'object_name',
>         'email' => 'object_email',
>         'homeAddress' => 'object_homeaddress',
>         'workAddress' => 'object_workaddress',
>         'homePhone' => 'object_homephone',
>         'workPhone' => 'object_workphone',
>         'cellPhone' => 'object_cellphone',
>         'fax' => 'object_fax',
>         'title' => 'object_title',
>         'company' => 'object_company',
>         'notes' => 'object_notes',
>         'pgpPublicKey' => 'object_pgppublickey',
>         'smimePublicKey' => 'object_smimepublickey',
>         'freebusyUrl' => 'object_freebusyurl'
>
>     ),
>     'search' => array(
>         'name',
>         'email'
>     ),
>     'strict' => array(
>         'object_id',
>         'owner_id',
>         'object_type',
>     ),
>     'use_shares' => false,
>     'browse' => true,
>     'export' => true
>
>> );
>
> /turba/config/prefs.local.php
> 
> $_prefs['addressbooks'] = array(
>     'value' => json_encode(array('localsql','ldapEmpl','ldapEle'))
> );
>
> $_prefs['sync_books'] = array(
>     'value' => 'a:0:{}',
>     'type' => 'multienum',
>     'desc' => _("Select the address books that should be used for 
synchronization with external devices:"),
> );
>
> $_prefs['columnselect'] = array(
>     'locked' => true,
>     'type' => 'special'
> );
>
> $_prefs['columns'] = array(
>     'value' => "localsql\temail\nEmploye\temail\nEleve\temail"
> );
>
> Can you find what's wrong ?

Did you check the user preference like I suggested?

-- 
mike



Hi,

I add the /imp/config/hooks.local.php file :

Only two functions are enabled :

public function postauthenticate($userId, $credentials)
     {
        $ldapServer = 'XXX';
        $ldapPort = '389';
        $binddn = 'XX';
        $bindpw = 'XXX';
        $searchBase = 'XXX';

        $userAttr = 'uid';
        $groupAttr = 'employeetype';

        $ret = false;

        $ds = @ldap_connect($ldapServer, $ldapPort);

        if (@ldap_bind($ds, $binddn, $bindpw)) {
            $searchResult = @ldap_search($ds, $searchBase, $userAttr . '=' 
. $userId, array($groupAttr), 0, 1, 5);
              if ($information = @ldap_get_entries($ds, $searchResult)) {
                  if($information[0][$groupAttr][0] =='pad' || 
$information[0][$groupAttr][0] =='ens') {
                      $_SESSION['departmentnumber'] = 
$information[0]['departmentnumber'][0];
                      $ret = true;
                  }
              }
        }
        ldap_close($ds);
        return $ret;
     }

public function prefs_init($pref, $value, $username, $scope_ob)
      {
          switch ($pref) {
          case 'add_source':
              return is_null($username)
                  ? $value
                  : 
$GLOBALS['registry']->call('contacts/getDefaultShare');
          case 'search_fields':
          case 'search_sources':
              if (!is_null($username) &&
                  $GLOBALS['registry']->hasMethod('contacts/sources')) {
                  $sources = 
$GLOBALS['registry']->call('contacts/sources');

                  if ($pref == 'search_fields') {
                      $out = array();
                      foreach (array_keys($sources) as $source) {
                          $out[$source] = array();
                          foreach 
($GLOBALS['registry']->call('contacts/fields', array($source)) as $key => 
$val){
                              if ($val['search']) {
                                  $out[$source][] = $key;
                              }
                          }
                      }
                  } else {
                      $out = array_keys($sources);
                  }

                  return json_encode($out);
              }

              return $value;
          }
        }





... and I add the /imp/config/prefs.local.php file :

// *** Addressbook Preferences ***

$prefGroups['addressbooks'] = array(
    'column' => _("Other"),
    'label' => _("Address Books"),
    'desc' => _("Select address book sources for adding and searching for 
addresses."),
   'members' => array(
        'save_recipients', 'display_contact', 'sourceselect', 'add_source'
    )
);

$_prefs['save_recipients'] = array(
    'value' => 0,
    'type' => 'checkbox',
    'desc' => _("Save recipients automatically to the default address 
book?")
);

$_prefs['display_contact'] = array(
    'value' => 1,
    'type' => 'checkbox',
    'desc' => _("List all contacts when loading the contacts screen? (if 
disabled, you will only see contacts that you search for explicitly)")
);

$_prefs['sourceselect'] = array(
    'type' => 'special'
);

$_prefs['search_sources'] = array(
    'value' => json_encode(array('localsql','ldapEmpl','ldapEle'))
);

$_prefs['search_fields'] = array(
    'locked' => false,
    'value' => json_encode(array('localsql' => 
array('name','email'),'ldapEmpl' => array('name','email'),'ldapEle' => 
array('name','email')))
);

$_prefs['add_source'] = array(
    'value' => 'localsql',
    'type' => 'enum',
    'enum' => array(),
    'desc' => _("Choose the address book to use when adding addresses.")
);

Is there something strange ?

Thanks 

Francine


More information about the turba mailing list