diff --git a/extension/Documentation/Manual.rst b/extension/Documentation/Manual.rst index a7007351776a228bca9e57c6fd0bdabee63e10f1..87881c3d22d50bb1b987f370fe4e560cbf627f2a 100644 --- a/extension/Documentation/Manual.rst +++ b/extension/Documentation/Manual.rst @@ -810,7 +810,7 @@ of the *Form*. If LDAP access is: +--------------------------+----------------------------------+------------------------------------------------------------+------+-------------+----------+ | typeAheadLdap | - | Enable LDAP as 'Typeahead' data source | | x | TA | +--------------------------+----------------------------------+------------------------------------------------------------+------+-------------+----------+ -| typeAheadldapSearch | (|(cn=*?*)(mail=*?*)) | Regular LDAP search expresssion | x | x | TA | +| typeAheadLdapSearch | `(|(cn=*?*)(mail=*?*))` | Regular LDAP search expresssion | x | x | TA | +--------------------------+----------------------------------+------------------------------------------------------------+------+-------------+----------+ | typeAheadLdapValuePrintf | `'%s / %s', cn, email` | Custom format to disply attributes, as value | x | x | TA | +--------------------------+----------------------------------+------------------------------------------------------------+------+-------------+----------+ @@ -841,7 +841,7 @@ The *FormElement.parameter*=*typeAheadLdap* will trigger LDAP searches on every * *ldapServer* = `directory.example.com` * *ldapBaseDn* = `ou=Addressbook,dc=example,dc=com` - * *typeAheadldapSearch* = `(|(cn=*?*)(mail=*?*))` + * *typeAheadLdapSearch* = `(|(cn=*?*)(mail=*?*))` * *typeAheadLdapValuePrintf* = `'%s / %s', cn, email` * *typeAheadLdapKeyPrintf* = `'%s', email` @@ -866,7 +866,9 @@ Fill STORE LDAP (FSL) --------------------- Before processing a *FormElement*, an optional configured FLS-action loads **one** record from a LDAP directory and stores -the named attributes in STORE_LDAP. FLS is triggered on *Form* +the named attributes in STORE_LDAP. If the LDAP search query selects more than one record, only the first record is processed. +The attributes names always becomes lowercase (PHP implentation detail on get_ldap_entries()) in the store. To make +accessing STORE_LDAP easily, the keys are implemented case insensitive for this specific store. FLS is triggered during *Form*-... * load, * dynamic update, * save. @@ -876,17 +878,17 @@ are available via `{{<attributename>:L:allbut:s}}` during the regular *FormEleme a sanatize class and optional escaping on further processing of those data. Important: LDAP access might slow down the *Form* processing on load, update or save! The timeout (default: 3 seconds) have - to be multiplied by number of access. E.g. a broken LDAP connection and 3 *FormELements* with *FSL* + to be multiplied by the number of accesses. E.g. a broken LDAP connection and 3 *FormELements* with *FSL* results to 9 seconds delay on save. Also be prepared not to receive the expected data. * *FormElement.parameter.fillStoreLdap* - activate the mode *Fill S* - no value is needed, the existence is suffucient. * *Form.parameter* or *FormElement.parameter*: - * *ldapServer* = directory.example.com - * *ldapBaseDn* = ou=Addressbook,dc=example,dc=com - * *typeAheadldapSearch* = (|(cn=*?*)(mail=*?*)) - * *ldapAttributes* = givenName, sn, telephoneNumber, email - * *ldapSearch* = (mail={{email::l}}) + * *ldapServer* = `directory.example.com` + * *ldapBaseDn* = `ou=Addressbook,dc=example,dc=com` + * *typeAheadLdapSearch* = `(|(cn=*?*)(mail=*?*))` + * *ldapAttributes* = `givenName, sn, telephoneNumber, email` + * *ldapSearch* = `(mail={{email::l}})` After filling the store, access the content via `{{<attributename>:allbut:L:s}}`. @@ -1026,7 +1028,7 @@ parameter +--------------------------+--------+----------------------------------------------------------------------------------------------------------+ | typeAheadLdap | - | Enable LDAP as 'Typeahead' data source | +--------------------------+--------+----------------------------------------------------------------------------------------------------------+ -| typeAheadldapSearch | string | Regular LDAP search expresssion. E.g.: `(|(cn=*?*)(mail=*?*))` | +| typeAheadLdapSearch | string | Regular LDAP search expresssion. E.g.: `(|(cn=*?*)(mail=*?*))` | +--------------------------+--------+----------------------------------------------------------------------------------------------------------+ | typeAheadLdapValuePrintf | string | Value formatting of LDAP result, per entry. E.g.: `'%s / %s / %s', mail, roomnumber, telephonenumber` | +--------------------------+--------+----------------------------------------------------------------------------------------------------------+ @@ -2594,6 +2596,94 @@ Table: Note sqlDelete={{DELETE FROM Note WHERE id={{slaveId}} LIMIT 1}} sqlAfter={{UPDATE Person SET noteIdAvatar={{slaveId}} WHERE id={{id:R0}} LIMIT 1 +Typeahead: SQL +^^^^^^^^^^^^^^ + +Table: Person + + +---------------------+--------------+ + | Name | Type | + +=====================+==============+ + | id | int | + +---------------------+--------------+ + | name | varchar(255) | + +---------------------+--------------+ + +* Form: + + * Name: PersonNameTypeahead + * Table: Person + +* FormElements + + * Name: name + + * Type: text + * Label: Name + * Parameter:: + + typeAheadSql = SELECT name WHERE name LIKE ? OR firstName LIKE ? LIMIT 100 + +Typeahead: LDAP with additional values +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Table: Person + + +---------------------+--------------+ + | Name | Type | + +=====================+==============+ + | id | int | + +---------------------+--------------+ + | name | varchar(255) | + +---------------------+--------------+ + | firstname | varchar(255) | + +---------------------+--------------+ + | email | varchar(255) | + +---------------------+--------------+ + +* Form: + + * Name: PersonNameTypeaheadSetNames + * Table: Person + * Parameter:: + + ldapServer = directory.example.com + ldapBaseDn = ou=Addressbook,dc=example,dc=com + +* FormElements + + * Name: email + + * Class: native + * Type: text + * Label: Email + * Note: Name: {{cn:LE}}<br>Email: {{mail:LE}} + * dynamicUpdate: checked + * Parameter:: + + # Typeahead + typeAheadLdapSearch = (|(cn=*?*)(mail=*?*)) + typeAheadLdapValuePrintf ‘%s / %s’, cn, email + typeAheadLdapKeyPrintf ‘%s’, email + + # dynamicUpdate: show note + fillStoreLdap + ldapSearch = (mail={{email::alnumx}}) + ldapAttributes = cn, email + + * Name: fillLdapValues + + * Class: action + * Type: afterSave + * Parameter:: + + fillStoreLdap + ldapSearch = (mail={{email::alnumx}}) + ldapAttributes = cn, email + + slaveId={{id:R0}} + sqlUpdate={{ UPDATE Person AS p SET p.name='{{cn:L:alnumx:s}}' WHERE p.id={{slaveId}} LIMIT 1 }} + FAQ ---