Page Utility Velocity Tools

The Page Utility Velocity tool contains a set of useful methods that can be used in Widget Templates. 

MethodDescription
 $rx.page.productVersion() Returns the products major and minor version.
 $rx.page.productVersionDetail() Returns the detailed product version string.
 $rx.page.licenseStatus() 

 Returns a PSLicenseStatus object.

 $rx.page.findItemFieldValues(String, String, String)

Find an item and return specified field values.

Parameters:

type: The content type name of the item.
fields: A comma delimited list of fields to return
contentId: The content id of the item to find

Returns: A map of the specified field names and their values as strings, values are escaped for html.
 

 $rx.page.getManagedLinkDependentId(String)

 Gets the dependent content id of the specified link.

Parameters


linkId: The id of the link

Returns:

The dependent item content id, or an empty string if the supplied linkId is not valid

 $rx.page.itemLink(PSRenderLinkContext, IPSLinkableItem)

Renders a Link to an item using the default resource definition for that items type.

Parameters:

linkContext: The link context. Use $perc.linkContext
linkableItem: An asset or page.

Returns:

PSRenderLink

$rx.page.itemLink(PSRenderLinkContext, IPSLinkableItem, String)

Renders a Link to an item.

Parameters:

linkContext: The link context. Use $perc.linkContext.
linkableItem: An asset or page.
resourceDefinitionId: The fully qualified resourceDefinitionId.

Returns:


PSRenderLink

 $rx.page.javascriptLinks(PSRenderLinkContext, IPSAssemblyItem)

Renders a list of javascript links

Parameters:

linkContext: The link context. Use $perc.linkContext
item: The parent (page/template) assembly item

Returns:
List of PSRenderLink

 $rx.page.cssLinks(PSRenderLinkContext, IPSAssemblyItem)

Renders a list of css links.

Parameters:

linkContext: The link context. Use $perc.linkContext
item: The parent (page/template) assembly item

Returns:
List of PSRenderLink

$rx.page.getSiteLoginPage(String)

Renders a relative path to the login page.

Parameters:

sitename: The name of the site to load the login page property.

Returns:

String

$rx.page.getSiteRegistrationPage(String)

Renders a relative path to the registration page.

Parameters:

sitename: The name of the site to load the registration page property.

Returns:

String

$rx.page.getSiteRegistrationConfirmationPage(String)

Renders a relative path to the registration confirmation page.

Parameters:

sitename: The name of the site to load the registration confirmation page property.

Returns:

String

$rx.page.getSiteResetPage(String)

Renders a relative path to the reset page.

Parameters:

sitename: The name of the site to load the reset page property.

Returns:

String

getSiteResetRequestPasswordPage(String)

Renders a relative path to the reset request password page.

Parameters:

sitename: The name of the site to load the reset request password page property.

Returns:

String

$rx.page.createCloneAssemblyItem(IPSAssemblyItem, Object)

Create a clone of the current assemblyItem if an id is passed the clone will be modified to that id.

Parameters:

item: e.g $sys.assemblyItem
idObj: A content id or guid to change the clone to.

Returns:
IPSAssemblyItem

$rx.page.parseGuid(Object)

Tries to generate an IPSGuid object from different object types.

Parameters:

id: The id to convert to a guid.

Returns:

IPSGuid

$rx.page.getRegionTree(IPSAssemblyItem)

Returns region information about a page.

Parameters:

item: The parent (page/template) assembly item.

Returns:

PSAbstractMergedRegionTree

$rx.page.findWidgetInstances(IPSAssemblyItem, String, String)

Find a list of WidgetInstances for an assemblyItem, will filter by regionName and/or widgetName if not null.

Parameters:

item: The parent (page/template) assembly item.
regionName: The name of the region to filter by.
widgetName: The name of the widget to filter by.

Returns:


List<PSWidgetInstance>

$rx.page.findWidgetInstances(PSAbstractMergedRegionTree, String, String)

Find a list of WidgetInstances for an assemblyItem, will filter by regionName and/or widgetName if not null.

Parameters:

regionTree: The PSAbstractMergedRegionTree to find from.
regionName: The name of the region to filter by.
widgetName: The name of the widget to filter by.

Returns:

List<PSWidgetInstance>

$rx.page.stripJavascripts(String)

Strip javascript

Parameters:

source: The source that may contain javascript.

Returns:

The text without javascript.

$rx.page.navLink(PSRenderLinkContext, Node)

Renders a Link of a landing page for the given navigation node.

Parameters:

linkContext: The link context. Use $perc.linkContext.
navNode: A navigation node.

Returns:

PSRenderLink

$rx.page.folderLink(PSRenderLinkContext, String)

Renders a Link to a folder.

Parameters:

linkContext: The link context. Use $perc.linkContext.
resourceDefinitionId: The fully qualified resourceDefinitionId.

Returns:

PSRenderLink

$rx.page.fileLink(PSRenderLinkContext, String)

Renders a Link to a file.

Parameters:

linkContext: The link context. Use $perc.linkContext.
resourceDefinitionId: The fully qualified resourceDefinitionId.

Returns:

PSRenderLink

$rx.page.themeLink(PSRenderLinkContext, String)

Renders a Link to a theme CSS file.

Parameters:

linkContext: The link context. Use $perc.linkContext.
theme: Theme name.

Returns:

PSRenderLink

$rx.page.themeRegionCssLink(PSRenderLinkContext, String, Boolean, EditType)

Renders a Link to the region's CSS file of a theme.

Parameters:

linkContext: The link context. Use $perc.linkContext.
theme: Theme name.
isEdit: is edit mode.
editType: edit type.

Returns:

PSRenderLink

$rx.page.firstAncestorWidgetContents(IPSAssemblyItem, Object, String, Map<String, Object>, String)

Gets the items of a widget that are relate to the specified page and/or template.  If not found it will look for same widget on landing page and then ancestor landing pages.

Parameters:

item: The parent (page/template) assembly item.
widget: The widget or the widget ID.
finder: The fully qualified name of the content finder.
params: Extra parameters to the process.
regionName: Optional regionName to find widget.

Returns:

list of assembly items

$rx.page.widgetContents(IPSAssemblyItem, Object, String,
Map<String, Object>)

Gets the items of a widget that are relate to the specified page and/or template.

Parameters:

item: The parent (page/template) assembly item.
widget: The widget or the widget ID.
finder: The fully qualified name of the content finder.
params: Extra parameters to the process

Returns:


list of assembly items

$rx.page.widgetContents(IPSAssemblyItem, Object, String,
Map<String, Object>, boolean)

Gets the items of a widget that are relate to the specified page and/or template.

Parameters:

item: The parent (page/template) assembly item.
widget: The widget or the widget ID.
finder: The fully qualified name of the content finder.
params: Extra parameters to the process.
processPageAssetOnly: If true, then lookup lookup items relate to page only.

Returns:

list of assembly items.

$rx.page.parseDateFormat(String, String)

Verify if the entered date format is correct or not for the SimpleDateFormat. If not system returns the defulat error format.

Parameters:

format: Date Format entered by user.
defaultFormat: System Default format.

Returns:

dateformat

$rx.page.parseSoProMetadata(String)

Parse the metadata string into key/value pairs.

Parameters:

metadata: Metadata string.

Returns:

Map of key/value pairs.

$rx.page.updateManagedLinks(PSRenderLinkContext, String)

Updates the managed links in the given source.

Parameters:

linkContext: The link context. Use $perc.linkContext.
source: The source html in which the managed links needs to be updated.

Returns:

managed links updated source

$rx.page.updateManagedLinks(PSRenderLinkContext, String, Long)

Updates the managed links in the given source.

Parameters:

linkContext: The link context. Use $perc.linkContext.
source: The source html in which the managed links needs to be updated.
serverId: The serverId to determine whether it is a staging publishing or not.

Returns:

managed links updated source

$rx.page.renderManagedItemPath(PSRenderLinkContext, String)

Renders the item path for the given link id.

Parameters:

linkContext: The link context. Use $perc.linkContext.
linkId: The id of the link that needs to be updated.

Returns:

The rendered path, or \"#\" if not rendered

$rx.page.renderManagedItemPath(PSRenderLinkContext, String, Long)

Renders the item path for the given link id.

Parameters:

linkContext: The link context. Use $perc.linkContext.
linkId: The id of the link that needs to be updated.
serverId: The serverId to determine whether it is a staging publishing or not.

Returns:

The rendered path, or \"#\" if not rendered

$rx.page.getWidgetTooltip(PSAbstractAssemblyContext, PSWidgetInstance, String)

Gets the tooltip of the specified widget.

Parameters:

context: The assembly (page/template) context.
widget: The widget instance.
defaultTooltip: The default tooltip.

Returns:

tooltip.

$rx.page.getProcessedCategories(List<PSRenderAsset>)

Gets the processed list of categories.

Parameters:

categories: String of comma separated categories.

Returns:

List of PSCategoryTree.

$rx.page.getCategoryLabel(String)

Returns the category label path for the given category id path.

Parameters:

catPath: The category id path, if not found returns the idpath

Returns:

String

$rx.page.getCategoryDropDownValues(String, String, String)

Get item's category json string value and preapre the information in a map and return.

Parameters:

fieldValue: the category drop down value that is to be displayed.
fieldName: the name of the category drop down field.
siteName: the name of the site (currently, this value is not being used as categories are not site based. This might be used in future.)

Returns:

A map of the category drop down values, where is key is the drop down fieldname appended with a count and value is a list of PSCategoryNode. This list has PSCategoryNode that belong to the specific dropdown. The selected categories are marked as selected true in their object.

$rx.page.getCategoryByPath(String)

Find a category node by the category path.

Parameters:

categoryPath: The category path.

Returns:

A PSCategoryNode object.

$rx.page.getProcessedBlogs(List<PSRenderAsset>)

Gets the processed list of blogs per month organized by year.

Parameters:

assemblyPages: assembly pages.

Returns:

List of PSBlogArchive.

$rx.page.getPagesForCalendar(String)

Gets the processed list of pages that have set supplied calendar.

Parameters:

calendarName: The name of the calendar.

Returns:

JSONArray object

$rx.page.getProcessedTags(List<PSRenderAsset>, String)

Gets the processed list of tags.

Parameters:

tags: String of comma separated tags.
sortOption: either alpha and count, defaults to alpha and any value other than count is treated as alpha.

Returns:

List of PSPair of String and Integers.

$rx.page.templateNames(String)

Gets list of template names.

Parameters:

templateIds: String of comma separated template ids.

Returns:

List of template names.

$rx.page.findWorkflow(Integer)

Find a workflow from ID.

Parameters:

workflowId: The ID of the workflow.

Returns:

The workflow. It may be null if not exist.

$rx.page.getBlogPostTemplateId(String)

Gets the blog post template id for the specified blog.

Parameters:

path: The folder path of the blog.

Returns:

id of the blog post template.

$rx.page.getRootAssemblyItem(IPSAssemblyItem)

Get the Root Assembly Item,  e.g. the page being rendered.

Parameters:

asmItem: The current assemblyItem usually $sys.assemblyItem.

Returns:

The top level IPSAssemblyItem.

$rx.page.getMetadataMap(Object)

Get the page metadata map that a widget can add to.

Parameters:

asmItem: The current assemblyItem usually $sys.assemblyItem.

Returns:

A Map.  The key is a String of the metada key.  The value is an Object but should only be populated with a String or List of Strings.