Chapter 2. Reference For bash.xml

Table of Contents

@bashCgiBegin(SRCRELPATH, DATE, TITLE, [CONTENT_TYPE], [HEAD], [BODYATTR])
@bashCgiEnd([TOOLTIPWIDTH], [FILE], [ImgScale], [ANCHOR])
@bashCgiOut(TEXT)
@bashCgiOutBegin()
@bashCgiOutEnd()
@digHostLookupLink(IP, [LABEL], [TITLE])
@hereButton([URL], [LABEL], [TITLE], [ATTRS])
@parseUpTime()
@releaseISO()
@runCommandNoFontCtrl(CMD, [SHOW])
@runCommand(CMD, [SHOW], [PARAMS], [INITFONTSIZE], [TOOLTIPATTRINCID], [TOOLTIPATTRDECID], [TOOLTIPATTRRESID], [TOOLTIPATTRFITID], [ID], [FILENAMETITLE])
@runCommandFit(CMD, [SHOW], [FILENAMETITLE])
@forceBrowserRender([CODE])
@tailButton(FILE, [LINES], [LABEL], [RETURN], [RETURN_LABEL], [TEXT_MODE], [DISPLAY_WIDTH], [LINE_NUMBER], [TITLE], [SYNCKEY], [BUTTONATTRS], [IEFORCEJUMP], [FORMATTRS], [PDFTITLE])
@tailButtonAutoRefresh(FILE, [LINES], [AUTO], [LABEL], [RETURN], [RETURN_LABEL], [TEXT_MODE], [DISPLAY_WIDTH], [LINE_NUMBER], [TITLE], [SYNCKEY], [BUTTONATTRS], [IEFORCEJUMP], [FORMATTRS])
@tailLinkEval(FILE, [LINES], [LABEL], [RETURN], [RETURN_LABEL], [TEXT_MODE], [DISPLAY_WIDTH], [LINE_NUMBER], [SYNCKEY], [IEFORCEJUMP])
@wuiBrowseButton(DIR, [LABEL], [RETURN], [TITLE], [RETURN_FROM], [DIRFILTER], [FILEFILTER], [ATTR], [RETURNLABEL], [SYNCKEY], [FORMATTRS])
@wuiBrowseLink(DIR, [LABEL], [RETURN], [RETURN_FROM], [SYNCKEY], [DIRFILTER], [FILEFILTER], [RETURNLABEL])
@jumpLinkSectionTT(SECTIONNAME, URL, LABEL, [WIDTH], [BOLD])
@jumpLinkPageTT(PAGENAME, URL, LABEL, [WIDTH])
@wuiExitButton([LABEL], [HIDDEN], [TITLE], [ATTRS])
@wuiInputFileEdit(NAME, FILE, [ROWS], [COLS], [TITLE], [CLASS], [ATTRIBUTES])
@wuiInputFileEditButton(FILE, LABEL, [SAVERETURL], [SYNCKEY], [ATTRS], [NOSAVERETURL], [IEFORCEJUMP], [RETURN_FROM], [RETURN_LABEL], [RETURN_BACK], [RETURN_LABEL_BACK], [RETURN_FROM_BACK])
@wuiInputFileSave(NAME, FILE, OWNER, GROUP, PERMS)
@domTTAttr([TITLE], [WIDTH])
@ttNSTFileViewer(FILE, [WIDTH], [TITLE], [KEYTITLE])
@ttNSTDirBrowser(DIRECTORY, [WIDTH], [TITLE], [DIRTITLE], [DIRFILTERTITLE], [DIRFILTER], [FILEFILTERTITLE], [FILEFILTER])
@ttDownloadContent(URL, [WIDTH], [TITLE], [KEYTITLE])
@manPageBash(PROGRAM, [LABEL], [SECTION])

@bashCgiBegin(SRCRELPATH, DATE, TITLE, [CONTENT_TYPE], [HEAD], [BODYATTR])

The first line of any bash CGI script in the NST WUI.

The following parameters are recognized:

SRCRELPATH

Relative path from the source top level checkout.

DATE

The date the script was originally created (YYYY-MM-DD).

TITLE

The title for the CGI script.

[CONTENT_TYPE]

The content-type which script produces (defaults to "text/html; charset=ISO-8859-1" if omitted).

[HEAD]

Arbitrary block of HTML/JavaScript code to include at the end of the <head> section.

[BODYATTR]

Any extra attributes for the <body> entity.

Example of using the macro:

@bashCgiBegin("wui/cgi-bin/networking/route.cgi","2009-09-30","Route Utility")

@bashCgiOutBegin()

@p("The following shows the currently routing table.")

@runCommand("/sbin/route")

@bashCgiOutEnd()

@bashCgiEnd()

Assuming the com.ccg.macros.at.All class is within your CLASSPATH and the config/bash.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/bash.at",,"d")

@bashCgiBegin("wui/cgi-bin/networking/route.cgi","2009-09-30","Route Utility")

@bashCgiOutBegin()

@p("The following shows the currently routing table.")

@runCommand("/sbin/route")

@bashCgiOutEnd()

@bashCgiEnd()


EOF

This macro is defined as:

#!/usr/bin/bash
if [ \"${__FORM_SH}\" != "true" ]; then
  . '@topDir()/cgi-bin/include/form.sh';
fi

#
# Make sure static info files are present (create if necessary) and
# then load in the static information variables
static_info check "@topDir()";

if [ \"${__CONFIG_SH}\" != "true" ]; then
  . '@topDir()/cgi-bin/include/config.sh';
fi

if [ \"${__REQUIRE_BASH}\" != "true" ]; then
  . '@topDir()/cgi-bin/include/require.bash';
fi

if [ \"${__WUI_REQUIRE_SH}\" != "true" ]; then
  . '@topDir()/cgi-bin/include/wui_require.sh';
fi

if [ \"${__IP_BASH}\" != "true" ]; then
  . '@topDir()/cgi-bin/include/ip.bash';
fi

@define("exitAnchor","")

#
# Set IP_LABEL to "IP (HOST)" or "IP" if unable to lookup host. NOTE:
# apache provides us with a HOSTNAME variable as well - maybe we should
# just use that?
#
IP_LABEL=\"${SERVER_ADDR}\";
NST_FQDN=\"\";
if IP_HOST=\"$(get_host_for_ip "${SERVER_ADDR}")\"; then
  IP_LABEL=\"${IP_LABEL} (${IP_HOST})\";
  NST_FQDN=\"${IP_HOST}\";
else
  # Use server IP address as host name
  IP_HOST=\"${SERVER_ADDR}\";
fi

#
# Get NST time stamps from system...
#
# Determine time format...
if [ \"${SYSINFO_FORMAT_TIME_24}\" == \"true\" ]; then
  NST_TIME_FMT=\"%T %Z\";
else
  NST_TIME_FMT=\"%r %Z\";
fi

eval $(/bin/date "+NST_DATE='%a %b %d, %Y'; NST_TIME='${NST_TIME_FMT}'; NST_TIME_SECS='%s'; NST_TIME_NANOS=\$((1%N - 1000000000));");
RFC_2822_DATE=\"$(TZ=GMT /bin/date --rfc-2822)\";

#
# Get values reported by: "uptime"...
@parseUpTime()

@bashCgiOutBegin()
@httpdContentType("@param(3)","${RFC_2822_DATE}")

@docBegin("@param(0)","@param(1)","@param(2)","@param(4)","@param(5)","@param(3)")
@bashCgiOutEnd()