OpenWGA 7.9 - TMLScript reference




The Design object represents a design context in TMLScript and offers various related functionalities, for example to fetch additional design resources relative to this context.

The design context retrieved by (without parameter) points to the OpenWGA design in which the current script is defined and from which it fetches additional script resources. Calling with different parameters creates design objects that instead may point to specific designs of other applications.

Besides addressing the design of a special OpenWGA application the design context may hold additional design reference information which is called its base reference. This points to a specific resource name as a "starting point". The base reference is used by the design object to locate other resources in a relative way (manually via Design.resolve()) or to retrieve design resources at the base reference position (for example Design.getFileContainer()).

This adressation functionality is mostly used implicitly in WebTML/TMLScript. For example: The action id given to WGA.callAction() is automatically resolved using the local design context of the script without explicitly using the Design object. However in some cases you need to manually resolve design references, for example when you need another design context than the one of the current script, or if you want to use WGAPI design functionalities which are not aware of WebTML addressation.

In those cases the method Design.resolve(), maybe in combination with direct retrieval methods like Design.getFileContainer() can be used to safely address and retrieve design resources in a way which takes all possible forms of relative addressation in WebTML like local and overlay references into account (see examples).

The string representation of this object is an absolute design reference to the design addressed by the design context. So you can use this object at any place where a design reference string is expected.

Retrieval Via method
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Properties and methods
Name Purpose
addProblem(occasionKey, problemKey [, params])
addProblem(occasion, problemKey [, params])
Registers a problem
baseReference Returns the base reference where this design points to
callAction([context], actionID, [param1, .... param5]) Calls a WebTML action
createFormInfo(formId) Creates a form info specifically for the current design
createObject(modulename [, param1, ...paramN])
createObject(objectDef [, param1, ...paramN])
Creates a custom TMLScript object
fileURL(fileName) Used to retrieve the URL of a file in the designs file container
getFileContainer() Returns a WGAPI filecontainer object for a container at this designs base reference
getFileContainerNames(descend) Returns the names of all file containers whose design name starts with the baseReference of this design object
getGlobal(name) Returns a TMLScript global that is available for the current design
getLabelBundle([[container, ]file, ] language) Retrieves all labels of a label file from the design in a specific language
getScriptModule(codeType) Returns a WGAPI script module object for a module at this designs base reference
getScriptModuleNames(codeType, descend) Returns the names of all script modules of the given code type whose design name starts with the baseReference of this design object
getTMLModule(mediaKey) Returns a WGAPI WebTML module object for a module at this designs base reference
getTMLModuleNames(mediaKey, descend) Returns the names of all WebTML modules of the given media key whose design name starts with the baseReference of this design object
HDBModel Returns the HDBModel object for the current designs application
isCustomized() Shows if the current design uses a customization
label([[container,] file,] key [, params])
label(key, map)
Returns a WebTML label from the current design
layoutURL([medium]) Generates a URL that calls a WebTML module, adressed by the base reference of this design object, as outer layout without document context
loadObjectDefinition([moduleName]) Loads the definition of a custom TMLScript object from the design
db() Returns the WGAPI database object for the application of the current design
plugin() Returns the Plugin object for the OpenWGA plugin that provides the current design
plugins() Returns the plugin(s) by which the current design is retrieved
registerDbGlobal(name, ref) Defines a "TMLScript global" variable with a scope limited to the current design
registerGlobal(name, ref) Defines a "TMLScript global" variable
resolve([dbkey, ] reference) Resolves a design reference relative to the current base reference
resolveScriplets([context,] input [, objects]) Resolves WebTML scriptlets in a string
resolveSystemFileContainer(name [, fallback]) Finds a file container in the OpenWGA system resources folder of this design
resolveSystemScriptModule(name, type [, fallback]) Finds a script module in the OpenWGA system resources folder of this design
resolveSystemTMLModule(name, mediaKey [, fallback]) Finds a WebTML module in the OpenWGA system resources folder of this design
scriptURL(codeType) Generates a URL serving the code of a publishable script module resource, adressed by the base reference of this design object
startProblemOccasion(occasionKey) Start a problem occasion and returns an occasion object
tmlDefaultEncoding Returns the WebTML default encoding of the current OpenWGA design
tmlMedium Returns the current WebTML media key of the environment
unregisterGlobal(globalName) Removes a TMLScript global
versionCompliance Returns the version compliance of the current design

Using the design context to safely address a WGAPI file container:

var fc ="images").getFileContainer();

This theoretically could also be done directly via WGAPI:

var fc = db().getFileContainer("images");

But as the WGAPI does not know about WebTML addressation this might fail in some situations, for example if the script runs from an overlay design. In that case the real name of the file container to retrieve would be "overlay:images" so the WGAPI method would not find the container. The design context however knows about its location in an overlay design and is able to use the complete name.