diff --git a/lam/docs/modules-specification.htm b/lam/docs/modules-specification.htm
index 5141a39e..f46e351a 100644
--- a/lam/docs/modules-specification.htm
+++ b/lam/docs/modules-specification.htm
@@ -24,7 +24,7 @@ All module classes should extend the baseModule class.
-
2.1.1. can_manage
+
2.1.1. can_manage*
@@ -43,7 +43,7 @@ can manage accounts of the current type
otherwise false.
-
2.1.2. get_alias
+
2.1.2. get_alias*
@@ -63,6 +63,8 @@ module selection of the configuration wizard.
Please take care that your alias name is not too long. It may contain
any character but should not include parts that may be interpreted by
the browser (e.g. '<' or '>').
+If you use different aliases dependent on the account type please make
+sure that there is a general alias for unknown types.
2.1.3. is_base_module*
@@ -118,7 +120,7 @@ The resulting LDAP filter will look like this:
is only used for base modules. Standard modules do not need to
implement it.
-
2.1.5. get_dependencies
+
2.1.5. get_dependencies*
@@ -168,7 +170,92 @@ Returns an hash array including meta data for the baseModule. Example: return array("is_base" =>
true);
-
2.1.7. get_scope()
+
2.1.7. get_configOptions()*
+
+
+
+
+
function get_configOptions($scopes)
+
+
+
+
+
+Returns a list of configuration options.
+$scopes is a list of account types (user, group, host)
+which are used.
+
+The return value is an array
+that contains meta HTML code.
+
+The type "fieldset" is not allowed here.
+The name attributes are used
+as keywords to load and save settings. We recommend to use the module
+name as prefix for them (e.g. posixAccount_homeDirectory) to avoid
+naming confilcts.
+
+
2.1.8. get_configDescriptions()*
+
+
+
+
+
function get_configDescriptions()
+
+
+
+
+
+Returns the description of every configuration option and the legend of
+the module fieldset on the configuration page.
+
+The return value is a hash
+array with this format:
+
+ array( 'legend'
+=> 'Some general description for fieldset',
+
+ 'descriptions' => array('option1'
+=> 'description1', ...))
+
+
2.1.9. check_configOptions*
+
+
+
+
+
function check_configOptions($scopes,
+$options)
+
+
+
+
+
+This function checks the input for module configuration settings.
+
+$scopes is a list of used
+account types (user, group, host).
+$options
+is an hash array
+(option name => value) that contains the input. The option values
+are all arrays containing one or more elements.
+If the input data is invalid the return value is an array that contains
+arrays to build StatusMessages (0 => message type, 1 => message
+head, 2 => message text, 3 => additional variables).
+If no errors occured the function returns an empty array.
+
+
+
2.1.10. get_scope()
@@ -187,6 +274,8 @@ Returns the account type (user/group/host) of this module object. This function is provided by the
baseModule and should not be overwritten.
+ "config_options" => array('user' => array,
+'host' => array, 'all' => array)
+
+ The values from 'all'
+are always returned, the other values only if they are inside the $scopes array.
+
+Syntax for sub arrays is the same as for
+the
+return value of get_configOptions().
+
+
+
6.8 get_configDescriptions()
+
+ "config_descriptions" => array
+
+Syntax for array is the same as for the
+return value of get_configDescriptions().
+
+
+
6.9 check_configOptions()
+
+ "config_checks" => array('user' => array,
+'host' => 'array', 'all' => array)
+
+ The values from 'all' are always used for checking,
+the other values only if they are inside the $scopes array.
+
+Syntax for sub arrays is the same as for
+check_profileOptions().
+
+
+
+
meta['config_options'][$scopes[$i]])) $return = array_merge($return, $this->meta['config_options'][$scopes[$i]]);
+ }
+ if (isset($this->meta['config_options']['all'])) $return = array_merge($return, $this->meta['config_options']['all']);
+ return $return;
+ }
+
+ /**
+ * Returns an array containing descriptions shown on configuration pages.
+ *
+ * The returned array has the format array('legend' => '...', descriptions => array('option1' => '...', ...)).
+ * The "legend" value is used as text for the fieldset, the descriptions are used when the configuration is printed.
+ *
+ * @return array configuration elements
+ */
+ function get_configDescriptions() {
+ $return = array('legend' => 'no description', 'descriptions' => array());
+ if (isset($this->meta['config_descriptions'])) $return = $this->meta['config_descriptions'];
+ return $return;
+ }
+
+ /**
+ * Checks input values of module settings.
+ *
+ * @param array $scopes list of account types which are used
+ * @param array $options hash array containing the settings (array('option' => array('value')))
+ * @return array profile elements
+ */
+ function check_configOptions($scopes, $options) {
+ $messages = array();
+ $scopes[] = 'all'; // add checks that are independent of scope
+ for ($s = 0; $s < sizeof($scopes); $s++) {
+ if (is_array($this->meta['config_checks'][$scopes[$s]])) {
+ $identifiers = array_keys($this->meta['config_checks'][$scopes[$s]]);
+ for ($i = 0; $i < sizeof($identifiers); $i++) {
+ // check if option is required
+ if ($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['required'] && ($options[$identifiers[$i]][0] == '')) {
+ $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['required_message'];
+ }
+ // check by regular expression (case insensitive)
+ if ($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['type'] == 'regex_i') {
+ // ignore empty fileds
+ if ($options[$identifiers[$i]][0] == '') continue;
+ if (! eregi($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'], $options[$identifiers[$i]][0])) {
+ $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
+ }
+ }
+ // check by regular expression (case sensitive)
+ elseif ($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['type'] == 'regex') {
+ // ignore empty fileds
+ if ($options[$identifiers[$i]][0] == '') continue;
+ if (! ereg($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'], $options[$identifiers[$i]][0])) {
+ $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
+ }
+ }
+ // check by integer comparison (greater)
+ elseif ($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['type'] == 'int_greater') {
+ // ignore if both fields are empty
+ if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) continue;
+ // print error message if only one field is empty
+ if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) {
+ $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
+ continue;
+ }
+ // compare
+ if (!(intval($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0]) > intval($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0]))) {
+ $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
+ }
+ }
+ // check by integer comparison (greater or equal)
+ elseif ($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['type'] == 'int_greaterOrEqual') {
+ // ignore if both fields are empty
+ if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') && ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) continue;
+ // print error message if only one field is empty
+ if (($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0] == '') || ($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0] == '')) {
+ $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
+ continue;
+ }
+ // compare
+ if (!(intval($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name1']][0]) >= intval($options[$this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['cmp_name2']][0]))) {
+ $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
+ }
+ }
+ else {
+ StatusMessage("ERROR", "Unsupported type!", $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['type']);
+ }
+ }
+ }
+ }
+ return $messages;
+ }
+
// TODO implement missing interface
}
diff --git a/lam/lib/config.inc b/lam/lib/config.inc
index ce02ac42..c65bd87e 100644
--- a/lam/lib/config.inc
+++ b/lam/lib/config.inc
@@ -365,7 +365,15 @@ class Config {
echo "" . _("Module settings") . ": \n";
echo "