LSattribute: add default LDAP & HTML type (ascii / text)

This commit is contained in:
Benjamin Renard 2021-01-29 15:59:13 +01:00
parent 40a17c3524
commit ac7e042c2a
4 changed files with 17 additions and 10 deletions

View file

@ -105,7 +105,7 @@
<varlistentry> <varlistentry>
<term>ldap_type</term> <term>ldap_type</term>
<listitem> <listitem>
<simpara>Le type LDAP de l'attribut. <simpara>Le type LDAP de l'attribut (facultatif, par défaut: &LSattr_ldap_ascii;).
<link linkend='config-LSattr_ldap'>Voir la section concernée.</link></simpara> <link linkend='config-LSattr_ldap'>Voir la section concernée.</link></simpara>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -122,7 +122,7 @@
<varlistentry> <varlistentry>
<term>html_type</term> <term>html_type</term>
<listitem> <listitem>
<simpara>Le type HTML de l'attribut. <simpara>Le type HTML de l'attribut (facultatif, par défaut: &LSattr_html_text;).
<link linkend='config-LSattr_html'>Voir la section concernée.</link></simpara> <link linkend='config-LSattr_html'>Voir la section concernée.</link></simpara>
</listitem> </listitem>
</varlistentry> </varlistentry>

View file

@ -28,4 +28,5 @@
<!ENTITY LSattr_html_jsonCompositeAttribute "<link linkend='config-LSattr_html_jsonCompositeAttribute'>LSattr_html_jsonCompositeAttribute</link>"> <!ENTITY LSattr_html_jsonCompositeAttribute "<link linkend='config-LSattr_html_jsonCompositeAttribute'>LSattr_html_jsonCompositeAttribute</link>">
<!ENTITY LSattr_html_sambaAcctFlags "<link linkend='config-LSattr_html_sambaAcctFlags'>LSattr_html_sambaAcctFlags</link>"> <!ENTITY LSattr_html_sambaAcctFlags "<link linkend='config-LSattr_html_sambaAcctFlags'>LSattr_html_sambaAcctFlags</link>">
<!ENTITY LSattr_html_select_list "<link linkend='config-LSattr_html_select_list'>LSattr_html_select_list</link>"> <!ENTITY LSattr_html_select_list "<link linkend='config-LSattr_html_select_list'>LSattr_html_select_list</link>">
<!ENTITY LSattr_html_text "<link linkend='config-LSattr_html_text'>LSattr_html_text</link>">
<!ENTITY LSattr_html_textarea "<link linkend='config-LSattr_html_textarea'>LSattr_html_textarea</link>"> <!ENTITY LSattr_html_textarea "<link linkend='config-LSattr_html_textarea'>LSattr_html_textarea</link>">

View file

@ -12,5 +12,6 @@
<!ENTITY conf-LSattr_ldap_sambaAcctFlags SYSTEM "LSattr_ldap_sambaAcctFlags.docbook"> <!ENTITY conf-LSattr_ldap_sambaAcctFlags SYSTEM "LSattr_ldap_sambaAcctFlags.docbook">
<!ENTITY conf-LSattr_ldap_shadowExpire SYSTEM "LSattr_ldap_shadowExpire.docbook"> <!ENTITY conf-LSattr_ldap_shadowExpire SYSTEM "LSattr_ldap_shadowExpire.docbook">
<!ENTITY LSattr_ldap_ascii "<link linkend='config-LSattr_ldap_ascii'>LSattr_ldap_ascii</link>">
<!ENTITY LSattr_ldap_date "<link linkend='config-LSattr_ldap_date'>LSattr_ldap_date</link>"> <!ENTITY LSattr_ldap_date "<link linkend='config-LSattr_ldap_date'>LSattr_ldap_date</link>">
<!ENTITY LSattr_ldap_sambaAcctFlags "<link linkend='config-LSattr_ldap_sambaAcctFlags'>LSattr_ldap_sambaAcctFlags</link>"> <!ENTITY LSattr_ldap_sambaAcctFlags "<link linkend='config-LSattr_ldap_sambaAcctFlags'>LSattr_ldap_sambaAcctFlags</link>">

View file

@ -65,16 +65,21 @@ class LSattribute extends LSlog_staticLoggerClass {
$this -> name = $name; $this -> name = $name;
$this -> config = $config; $this -> config = $config;
$this -> ldapObject =& $ldapObject; $this -> ldapObject =& $ldapObject;
$html_type = "LSattr_html_".$config['html_type']; $html_type = $this -> getConfig('html_type', 'text', 'string');
$ldap_type = "LSattr_ldap_".$config['ldap_type']; $html_class = "LSattr_html_".$html_type;
LSsession :: loadLSclass($html_type); $ldap_type = $this -> getConfig('ldap_type', 'ascii', 'string');
LSsession :: loadLSclass($ldap_type); $ldap_class = "LSattr_ldap_".$ldap_type;
if((class_exists($html_type))&&(class_exists($ldap_type))) { LSsession :: loadLSclass($html_class);
$this -> html = new $html_type($name,$config,$this); LSsession :: loadLSclass($ldap_class);
$this -> ldap = new $ldap_type($name,$config,$this); if (class_exists($html_class) && class_exists($ldap_class)) {
$this -> html = new $html_class($name, $config, $this);
$this -> ldap = new $ldap_class($name, $config, $this);
} }
else { else {
LSerror :: addErrorCode('LSattribute_01',array('attr' => $name,'html'=>$config['html_type'],'ldap'=>$config['ldap_type'])); LSerror :: addErrorCode(
'LSattribute_01',
array('attr' => $name, 'html'=> $html_type, 'ldap' => $ldap_type)
);
return; return;
} }
return true; return true;