Inserts a 'button' form which runs a arbitrary CMD.
The following parameters are recognized:
The command to be run.
The file name to return to the client browser.
The label to appear on the button.
The MIME type of the results (default: text/text).
The tool tip to associate with the button.
This macro allows one to run any command they want on the system and return the generated results as any MIME type. NOTE: We make no assumptions about the command to be run (if you need to run as root, it is your job to include the necessary sudo). Also, it is your responsibility to redirect any output and do any necessary HTML escaping on the arguments which are assigned to HTML attributes.
Example of using the macro:
@wuiGenerateButton("(/bin/cat /etc/hosts | grep 192 ) 2>/dev/null","192hosts.txt","192 Hosts","text/text","Lists all host entries having 192 in them") @wuiGenerateButton("$(echo "${MY_CMD}" | html_doublequote_escape) 2>/dev/null","myresults.txt","My XML","text/xml")
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")
@wuiGenerateButton("(/bin/cat /etc/hosts | grep 192 ) 2>/dev/null","192hosts.txt","192 Hosts","text/text","Lists all host entries having 192 in them") @wuiGenerateButton("$(echo "${MY_CMD}" | html_doublequote_escape) 2>/dev/null","myresults.txt","My XML","text/xml")
EOF
This macro is defined as:
@htmlEntity("form"," @wuiInputHidden("cmd","@param(0)") @wuiInputHidden("path","@param(1)") @wuiInputHidden("mime","@fnb("@param(3)","text/text")") @htmlEntity("input","","@wuiInputButtonAttr("generate","@param(2)") @ifEqual("@param(4)",,,"@toolTipAttr("@param(4)")") ") ","@htmlAttr("action","@topDir()/cgi-bin/system/generate.cgi")")