Viewpoint can make a remote procedure call (RPC) that executes a script on the Web server to determine a component's response. In such a case, when the component rule is evaluated to true, the script specified in the XML configuration executes. Upon completion, that script returns XML describing another type of component response, which then runs on the client. This makes it possible to perform more complex operations to change the user interface state dynamically.
To get a component rule's response dynamically
Attribute | Description |
---|---|
"file" | Viewpoint reads the contents of the file and attempts to parse it to any other component response. The file's contents should be in XML format, as defined in all other component response options. |
"exec" | Viewpoint executes the file on the Web server and parses the STDOUT of the file into one of the component response options. |
<component-rule> <requirement> <component id="enable-firewall-checkbox" /> </requirement> <response source="exec"> <url value="file:///home/user/tools/getFirewallOptions.py" /> <input> <component id="ip-address" /> </input> </response> </component-rule>
The getFirewallOptions.py script requires the value of the "ip address" component. When the user clicks the appropriate checkbox, the script is called in the following manner (assuming the ip address is 192.168.99.120):
/home/user/tools/getFirewallOptions.py xml='<components> <component id="ip-address"> <value>192.168.99.120"</value> </component> </components>
The script returns XML respresenting a component response like the following:
<response> <component id="LAN-options"> <display>true</display> </component> <component id="WAN-options"> <display>false</display> </component> </response>
Related topics