declare

Variable declaration

Description

All the variables have a scope corresponding to an XML node. All the sub-nodes of this node are part of the scope. The scope of a variable is the containing element of its declaration.

When used in a prototype, this is an argument declaration.

Attributes

  • ac-multi
  • ac-xpath
  • allow-xml
  • cols
  • date-end-of-day
  • date-start-of-day
  • deprecated
  • do-not-delete
  • enum-separator
  • enum-sources
  • hide
  • hide-default
  • hierarchical
  • label
  • min
  • no-label
  • other-size
  • other-value
  • read-only
  • rows
  • section
  • show-time
  • silently-required
  • toggle-boring
  • toggle-default
  • two-rows
  • type-separator
  • units
  • user-set-permission
  • values-node
  • wrap
  • name (NMToken) - Name of the variable.
  • project (NMToken) - Project in which this variable was first declared.
  • tag (NMToken default: var) - Usage: Internal
  • hidden (May only be: hidden) - Do not allow the user to enter a value.
  • cookie (May only be: cookie) - This is a cookie variable, i.e., it can be set by a cookie and we'll be sent back to the user as a cookie upon change. Usage: Internal
  • modified (May only be: modified) - Has this variable been modified? Usage: Internal
  • allow-variable (May only be: allow-variable) - Usage: Internal
  • permitted-by - Specify permissions for viewing and modifying this variable in the Admin Tool.
  • read-permitted-by - Specify permissions for viewing this variable in the Admin Tool.
  • write-permitted-by - Specify permissions for modifying this variable in the Admin Tool.
  • no-comment - Don't allow editing of comment for this variable in Admin Tool.
  • restrict-to-ports - Only allow positive integers that are within the range of valid port numbers.
  • restrict-ephemeral - Do not allow integers that are in the ephemeral range. Port number must also be greater than 1024.
  • type (Any of: int, boolean, number, password, string, nodeset, enum, flag, positive-int, separated-set, string-area, url, xml-escaped, xpath, date, email, image, nmtoken, separated-enum-set, user-set, re, replacement-pair-list default: string) - Expected type for this variable.
  • user-mode (Any of: global, identity) - Decides if and when the user will be prompted to set the value of this variable.
    • global: User can set this variable under each source.
    • identity: User can set this variable in their identity.
  • overview-flag (Text) - Usage: Internal
  • registration (Text) - This flag, when used in conjunction with the attribute user-mode, indicates that the user should be prompted to enter this variable when registering for a user account.
  • registration-required (Text) - This flag, when used in conjunction with the attribute user-mode, indicates that this variable is a required variable when registering for a user account.
  • enum-values (Text) - Usage: Internal
  • initial-value (Text) - The initial value to which this variable is set.
  • initial-select (Text) - An XPath that will be evaluated to set the initial value of the variable.
  • dont-display-type (May only be: dont-display-type) - Usage: Internal
  • required (Any of: required, optional default: optional) - Usage: Internal
  • offer-random (May only be: offer-random) - Usage: Internal
  • random-password - Usage: Internal

Children

  • Choose any number of these in any order.
    • attribute: (Zero or more) - Set an attribute of the first parent element
    • description: (Zero or more) - A (possibly long) description associated with a prototype or a declare in the admin interface.
    • label: (Zero or more) - A short description associated with a variable declaration in the admin interface
    • enum-values: (Zero or more)
    • initial-value: (Zero or more) - Overwrite the initial value of a variable when loaded from a certain project/source
    • example: (Zero or more) - An example value associated with a variable declaration in the admin interface

Examples

Input Example:

  <declare name="v"/>
  <set-var name="v" value="v1"/>
  <set-var name="v">v2</set-var>

Output Example:

  <declare name="v" initial-value="v2" modified="modified"/>
Variables have scopes corresponding to the tag containing their declaration (very similar to C++ programming)

Input Example:

  <declare name="v1"/>
  <declare name="v2"/>
  <declare name="v3"/>
  <scope>
  <set-var name="v1">1</set-var>
  </scope>
  <scope>
  <declare name="v1"/>
  <set-var name="v1">2</set-var>
  <set-var name="v2">
  <value-of-var name="v1"/>
  </set-var>
  </scope>
  <set-var name="v3">
  <value-of-var name="v1"/>
  </set-var>

Output Example:

  <declare name="v1" initial-value="1" modified="modified"/>
  <declare name="v3" initial-value="1" modified="modified"/>
  <declare name="v2" initial-value="2" modified="modified"/>
Simple function expansion. Note that as in most of the programming languages, only global variables and variables declared in the scope of the function (but not those declared in the scope of the function call) can be used in the scope of the function.

Input Example:

  <function name="f">
  <prototype>
  <declare name="v" type="string"/>
  </prototype>
  <_xml_/>
  <value-of-var name="v"/>
  </function>
  <call-function name="f">
  <with name="v" value="ok"/>
  </call-function>

Output Example:

  <function name="f">
  <prototype>
  <declare name="v" type="string"/>
  </prototype>
  <_xml_/>
  <value-of-var name="v"/>
  </function>
  <_xml_/>ok