OpenWGA 7.10 - TMLScript reference


Object:

Nav

Description

Represents a tool object to create WebTML navigator results in TMLScript.

This is the pendant of the WebTML tag <tml:navigator> in TMLScript. It however itself does not represent a navigator but only assists in creating NavigatorResults of various navigator types from a reference context.

Many methods to create navigator results receive a LookupTable parameter "attributes" which can be used to parametrize the created result. It uses the names of <tml:navigator>-Attributes as keys and interprets them the same way. So filling it with an entry of key "role" and a value of "none" will disable the filtering for contents that are invisible to navigators. Specifying or omitting an attribute here has generally the same effect as it would have on <tml:navigator>. There are however these exceptions:

  • Attribute "type" is not permitted. The navigator type is either determined by the method you call or its type parameter.
  • Attribute "exclude" is not permitted. Instead use the method exclude() on created NavigatorResults
  • Attibute "pagesize" does not really limit the retrieved documents but only determines the fetch size of result pages from the backend. To limit your document output use skip() and/or getPage() on created NavigatorResults
  • Attributes that <tml:navigator> inherts from <tml:foreach> are not usable, as these address the iteration of the results which is not in the responsibility of the Nav object. Many functionalities however can be achieved by using the according methods on the NavigatorResult, like f.e. filter().

Each Nav object has a reference context to which the created navigator results relate, just like the documents used by a <tml:navigator> tag relate to the WebTML context of this tag.

Retrieval WGA.nav()
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Properties and methods
Name Purpose
areas([attributes]) Returns a NavigatorResult for an areas navigator, just like <tml:navigator type="areas"/>
navigate(type, [attributes]) Returns a NavigatorResult for a WebTML navigator, just like <tml:navigator>
children([attributes]) Returns a NavigatorResult for a children navigator, just like <tml:navigator type="children"/>
languages([attributes]) Returns a NavigatorResult for a languages navigator, just like <tml:navigator type="languages"/>
path([attributes]) Returns a NavigatorResult for an path navigator, just like <tml:navigator type="path"/>
relationGroupTargets(relationName)
relationGroupTargets(attributes)
Returns a NavigatorResult for a navigator of relation group targets, just like <tml:navigator type="relationGroupTargets"/>
siblings([attributes]) Returns a NavigatorResult for a siblings navigator, just like <tml:navigator type="siblings"/>
sitemap([attributes]) Returns a NavigatorResult for a sitemap navigator, just like <tml:navigator type="sitemap"/>
sourcesOfIncomingRelationGroups()
sourcesOfIncomingRelationGroups(attributes)
sourcesOfIncomingRelationGroups(relationGroup [, contentclass])
Returns a NavigatorResult for a navigator iterating over the source contents of incoming relation groups, just like <tml:navigator type="sourcesOfIncomingRelationGroups"/>
sourcesOfIncomingRelations()
sourcesOfIncomingRelations(attributes)
sourcesOfIncomingRelations(relation [, contentclass])
Returns a NavigatorResult for a navigator iterating over the source contents of incoming relations, just like <tml:navigator type="sourcesOfIncomingRelations"/>
versions([attributes]) Returns a NavigatorResult for a versions navigator, just like <tml:navigator type="versions"/>
Examples

A simple example, iterating over the contents of a children navigator using a JavaScript iterator:

for (cx in Iterator(WGA.nav().children())) {

   log.info(cx.TITLE);

}

An example of parametrization, making a sitemap navigator result, which goes down to level 2 and ignores hidden flags on content documents. Note that you can provide attribute values in their native types, like the level being a Number here:

var sitemap = WGA.nav().sitemap({role:'none', maxlevel:2});