Template Interpreter

From Legion
Jump to: navigation, search
Language: English  • Español


Contents

Legion Web Interface - Template Interpreter

Legion Web Interface has a default template interpreter (you could replace it with your own) for generating the 'config.xml' file required by Legion Web Services. The latter is a Task Creation Descriptor, and thus must contain information which is present only in the task submission form each time a task is created. That is why at project creation stage we must specify a template for this file which is to be completed by the template interpreter before calling the LWS layer.

Form values replacement

If your textbox, select, radio, or other HTML component is named for example: 'txtSomething' you will just need to use the tag {Form:txtSomething} to get the value of the component to replace the tag.

Math evaluation

If you need to calculate a value before replacement just add a Math tag. You could use the basic operators (+, -, /, *) and form values. Remember that a Form tag inside the Math tag has surrounding '{' and '}' (just a pair, not two of them).

 {Math:({Form:txtLast}-{Form:txtFirst})/{Form:txtStep}}
 {Math:{Form:txtWus}+1}

Split operator

Sometimes you will need to split the values of a HTML component. For instance if you've got a cmd to execute at each line of a textarea named for instance txtCommands, you could try the following.

 <cmd>{Split:txtCommands:\n}</cmd>

This will get you the following replacement (The whole line is repeated)

 ...
 <cmd>line 1</cmd>
 <cmd>line 2</cmd>
 <cmd>line 3</cmd>
 <cmd>line n</cmd>
 ... 

We also got the SplitCount tag. It works as follows:

 {SplitCount:txtCommands:\n}

This will be replaced by the number of not empty lines in the txtCommands textarea.

Personal tools
Namespaces

Variants
Views
Actions
Navigation
Legion Web Interface
Legion Web Service
Installation guide
Centralized BOINC Server Management
navigation end