--- tabea-brainstorming 2002/07/03 10:00:22 1.3
+++ tabea-brainstorming 2002/07/03 10:34:07 1.4
@@ -73,6 +73,7 @@
helptext
helpurl
activate
+ match
verify
type
value {
@@ -111,6 +112,9 @@
Elements used in items only
---------------------------
+ A match regex is used when importing a legacy file. When parts of an
+ imported file match the regex, $1 is used as the current value.
+
The verify is a regex to check if the data read or the user input is
valid. A "verify xxx" is a shortcut for "eval name =~ xxx". If used
together with eval both must match.
@@ -329,7 +333,51 @@
}
}
+ API
+ ---
+
+ - handle = create(config, type, prefix)
+
+ Reads config and initializes items with default values.
+ Currently the only supported type is HTML2 which causes only
+ tags described in RFC1866 to be used. When a menu is rendered,
+ some elements may require uniqe names in a scope wider than
+ known by this module, i.e. when two configs are presented on one
+ screen or along with other information, so every item is
+ prefixed.
+
+ - rc = load(handle, data)
+
+ Reads data and sets the value of items.
+
+ - rc = save(handle, data)
+
+ Writes items including their values.
+
+ - rc = render(handle, buffer)
+
+ Renders a menu writes it into the buffer. The contents of the
+ buffer can be merged into a larger output. Values are verified
+ and invalid data is marked (FIXME how? red, reset to default,
+ configurable behaviour, configurable error messages ...) The
+ caller must finally print out the menu and when an input comes
+ back it must identify menu activity (i.e. by checking the
+ prefix) and call render again and again or execute some action.
+
+ - rc = import(handle, legacyfile)
+
+ Reads a legacy (manually edited or previously exported) file and
+ tries to match out values.
+
+ - rc = export(handle, template, exportfile)
+
+ Applies variable substitution for a template and writes the
+ result out to exportfile.
+
+ - rc = destroy(handle)
+
Example: Generic RAID configuration
+ -----------------------------------
block {
name BEGIN
|