Conditional fields

Conditional fields are a convenient way to handle empty values. It is often desireable to drop leading or trailing texts in signatures if a field is not defined or empty in Active Directory. Adolsign supports eight directives in field definitions:

 

--prefix text Adds text in front of the field if it is not empty
--postfix text Adds text at the end of the field if it is not empty
--ignoreline Drops the whole line if the field is empty. NB! option ignoreline has limited support for html signatures (removes br / tag only) and rtf signatures (remove \par tag only).
--default text Use text as default if the field is empty
--case directive ... Use directive for case manipulation. Allowed directives are lowercase, uppercase, lowerfirst, upperfirst. Multiple directives are allowed and they will be processed in the specified order.
--anchor type Generate HTML code for dynamic links. As an example --anchor http creates an http link (no support for rtf-signatures!)
--format format Formats the value according to the format. As an example, --format "%s%s *** %s%s" produces 12 *** 34 for the value 1234.
--lookup lookup-table Checks if there is a section in the configuration file named lookup-table. If it exists, checks further if the field value (case-insensitive) does exist as a parameter in this section, replaces the field value by the parameter value.

Conditional directives can be defined by using the following syntax:

scancode( one or more conditional directives )scancode 

Examples:

 

field_telephone( --prefix "Tel: " )field_telephone
Produces Tel: +11111111 if the telephone number is +11111111. Produces nothing if it is empty.

 

 

field_department( --prefix "Department: " --ignoreline )field_department
Produces Department: Sales if the department is Sales. Produces nothing and removes the whole line if it is empty.

 

 

field_homepage( --default "home.page.address" --case lowercase )field_homepage
Converts the homepage to lowercase. Produces home.page.address if the homepage is not defined.

 

 

field_title( --lookup Norwegian_titles )field_title

in the configuration file:


Manager=Sjef
Consultant=Konsulent

 Produces Sjef or Konsulent if title values in AD are manager or consultant respectively (case insensitive). Otherwise, the value itself is used.