Embed an NST Shell run command console using a multi-line format.
The following parameters are recognized:
The javascript command array which includes linux commands to run.
This optional setting is a file name prefix typically used with the Font Control NST File Viewer PDF title name or download file name.
This optional setting is intended for functions which generated run command output at run time (as opposed to compilation time). If you include this parameter - make sure it is a unique ID).
This optional setting specifies set of configuration parameters to pass to the FontControl(node, param) contstructor. This needs to be in the form of a JavaScript structure (JSON Object). ***Note: If this parameter is specified then the FILENAMEPREFIX parameter will not be honored. Include it in the PARAMS JSON object.
This optional setting specifies set of configuration parameters to pass to the NstShell.Console(id, coParams) contstructor. This needs to be in the form of a JavaScript structure (JSON Object).
This macro is used to Embed an NST Shell run command console into an NST WUI page. The commands are encapsulated in a javascript array using a multi-line format.
Example of using the macro:
@javascriptBegin() // // Multi-line NstShell command example... var cmd_multiline="[@javaEscape(" d() { local d=$(/bin/date 2>&1;); echo \"${d}\"; } echo \"The current date/time is:\\\"$(d;)\\\"\"; ")"]; @javascriptEnd() @nstShellRunCommandMulti("cmd_multiline","date")
Assuming the com.ccg.macros.at.All
class is within your CLASSPATH
and the
config/html.at
macros file has been
generated (Hint: run make atmacros in the
wui
directory), a developer should be able to
run the above example by copy/pasting from below:
[root@probe root]#
java com.ccg.macros.at.All <<EOF
@include("config/html.at",,"d")
@javascriptBegin() // // Multi-line NstShell command example... var cmd_multiline="[@javaEscape(" d() { local d=$(/bin/date 2>&1;); echo \"${d}\"; } echo \"The current date/time is:\\\"$(d;)\\\"\"; ")"]; @javascriptEnd() @nstShellRunCommandMulti("cmd_multiline","date")
EOF
This macro is defined as:
@define("nst_shell_cnt","0","ifnew")@increment("nst_shell_cnt") <pre@htmlAttr("id","@ifEqual("@param(2)",,"nst_shell_run_cmd_id_@nst_shell_cnt()","@param(2)")")@htmlAttr("class","screen")></pre> @javascriptBegin() NstShell.runCommand("@ifEqual("@param(2)",,"nst_shell_run_cmd_id_@nst_shell_cnt()","@param(2)")", @param(0)@ifEqual("@param(3)",,", { fileNamePrefix: \"@fnb("@param(1)","nst-console")\" }",", @param(3)")@ifEqual("@param(4)",,,", @param(4)")); @javascriptEnd()