The following information is automatically extracted from the JS code files. Methods and variables that begin with the double underscore ("__") are considered to be part of the private API of the library.
const U = {
November 2024: moving forward, general Widget Utility code will go in the U namespace.
function genericDeleteItem(tablename, itemid)
Delete Item from given table.
Error if the item with the given ID does not exist.
Redisplays on success, if you don't want this behavior, do not use this method.
function genericToggleActive(tablename, itemid)
Toggles the is_active field of the given item in the given table.
Item must exist and have an is_active field.
Syncs and redisplays on success, if you don't want this behavior, do not use this method.
function genericToggleField(tablename, fieldname, itemid)
Toggles the given field name for the given item
Item must have the given field, and the value must be 0/1
Syncs and redisplays on success, if you don't want this behavior, do not use this method.
function genericEditTextField(tablename, fieldname, itemid)
Prompts user to enter a new value for the given text field.
The previous value will be used as a prompt default.
Syncs and redisplays on success, if you don't want this behavior, do not use this method.
function genericEditFloatField(tablename, fieldname, itemid)
Same as genericEditIntField, but can be a float/real, instead of just an int
function genericEditIntField(tablename, fieldname, itemid)
Prompts user to enter a new value for the given INT field.
The previous value will be used as a prompt default.
If user enters a non-int, displays an error message and rejects the change.
Syncs and redisplays on success, if you don't want this behavior, do not use this method.
function minWithProxy(items, minfunc)
returns the item in the collection that has the minimum
value according to the given function.
function proxySort(proxyfun)
This is a higher order function: the input and return values are both functions.
It converts a function of one variable into a binary function that can be used to compare the variables.
Call with mylist.sort(proxyFun(x => [x.getId(), x.getName()]))
function populateSpanData(spanmap)
Given map of span ID :: HTML data,
Lookup all the spans, and populate them.
function okayInt(intstr)
Checks if the given input is an allowable Integer.
Return true if yes.
function okayFloat(floatstr)
Return true if the given string is an allowable float.
function massert(condition, message)
Assert that the given condition is true.
If not, alert prompt is shown with the provided error message, as well as some info about the number of errors.
CAUTION - want to avoid showing the user an infinite number of prompts, that's why we keep track of
the __ERRORS_ON_PAGE info.
function getDocFormValue(docformname)
Get the VALUE of the form element with the given NAME.
Error if there is no element with the given name, or multiple elements.
function getDocFormValueDefault(docformname, defaultval)
Get the value of the document form with the given name,
or return the default value if there are no elements with that name.
Error if there are multiple elements with name.
function getUniqElementByName(elname)
Get the element with the given name.
Error if there is no element with the given name, or multiple elements.
function getUrlParamHash()
Get Query String / URL Params as a hash.
Example MyWidget.jsp?name=1&id=5 will return
{ "name" : 1, "id" : 5}
function decodeQString2Hash(qstring)
Simple transform of a query string, without the leading ?, into a key=value pair
Should be a pure inverse of encodeHash2QString below.
function encodeHash2QString(submitpack)
Create a query string of the form ?key1=value1&key2=value2 from the given hash.
This string is suitable for being used to compose a new URL
by appending it to a prefix such as "https://webwidgets.io/u/dburfoot/mywidget/widget.jsp" + qstring
function submit2Current(submitpack)
TODO: this should be fixed, submitpack must overwrite the previously selected params
function setCookieNoExpiration(name, value) {
Set a cookie with the given name=value pair
function getDocumentCookieInfo()
Returns full set of document cookies.
function getWidgetUserName()
Return username of logged-in user
This is pulled from the full cookie package
function basicWidgetLogout()
This implements a basic logout operation by clearing the user's WWIO-relevant cookies
If the application has set additional cookies, it must implement clearing logic on its own
function logoutAndReturn()
Log out of Widgets and bounce-back to current url
function toggleHidden(theitem)
Toggle Hidden value for given element.
function toggleHidden4Id(itemid)
Toggle Hidden value for element with given ID.
function toggleHidden4Class(classname)
Toggle Hidden value for all elements with given class.
function spreadConvert(it)
Convert iterator to an array.
This is not used in main WWIO code, it is a compatibility trick
for testing with Nashorn Java JS engine, which does not have the spread operator [... ]