Module: alfresco/core/UrlUtilsMixin

alfresco/core/UrlUtilsMixin

This is a mixin that provides URL related utility functions. The majority of the functions were ported from the original YUI2 based Share code defined in alfresco.js - they are therefore somewhat Share specific.
Author:
  • Dave Draper
License:
Source:

Members

sitePageTemplate :string

It's possible to explicitly set a specific URI template to use for generating links. If this is not set then a default of "sitepage" is used which is known to be configured in in both Alfresco Share and in applications generated from the Aikau Maven archetype.
Type:
  • string
Default Value:
  • null
Source:

useAikauPages :boolean

This indicates whether or not the linked pages are "Aikau-style" page. An Aikau style page is where the a combination of "page-id" and "ws" URL tokens are used to construct a page. This defaults to false for use in Alfresco Share where pages for located items are typically standard "Surf-style" pages.
Type:
  • boolean
Default Value:
  • false
Source:

Methods

buildUrl(page, site, template) → {url}

This function can be used to build a page taking into account that the page can either be a Surf Page (as used by Alfresco Share) or an Aikau page (as used by custom page in Share or a standalone Aikau client).
Parameters:
Name Type Description
page string This is the pageid (for Share) or WebScript URL (for Aikau) for the URL
site string This is the site (if available) to use
template string A custom template to use in place of "sitepage" (which will be used otherwise)
Source:
Returns:
The URL built from the supplied arguments.
Type
url

generatePageUrl(page, args)

Alias to siteURL
Parameters:
Name Type Description
page String
args Object[]
Source:
Generate User Profile link
Parameters:
Name Type Description
oUser object Object literal container user data
Source:
Returns:
HTML mark-up for user profile link
Type
String

getActionUrls(record, siteId)

This function is required to support "legacy" action handling within Share.
Parameters:
Name Type Argument Description
record Object The current node to generate actions URLs for.
siteId String <optional>
The id of the current site, will be generated if missing from record.
Source:

renderUriTemplate(template, obj, absolute) → {string}

This function renders a URI based on a supplied template ensuring that token substitution is performed (using tokens supplied in the "obj" argument). This function does have some specific code to handle site templates that are provided where no site data is supplied in the object. However, unlike the version of the code that this function was ported from (in alfresco.js in Share) there is no support for retrieving the current site or context from the URL.
Parameters:
Name Type Description
template string The template to render a URI from
obj object An object that provides subtitution tokens for the URI template
absolute boolean Indicates that the URI rendered should include protocol, host/port and application context
Source:
Returns:
The rendered URI
Type
string

siteURL(pageURI, obj) → {string}

Returns a URL to a site page. If no Site ID is supplied, generates a link to the non-site page.
Parameters:
Name Type Description
pageURI string Page ID and and QueryString parameters the page might need, e.g.
   "folder-details?nodeRef=" + nodeRef
obj object The object literal containing the token values to substitute within the template
Source:
Returns:
The populated URL
Type
string

uriTemplate(templateId, obj, absolute)

This function attempts to find a URI template that has been configured for the Surf application. If a template that matches the supplied "templateId" argument is found then the renderUriTemplate function will be called to perform the actual rendering.
Parameters:
Name Type Description
templateId string The id of the template to render a URI for
obj object An object that provides subtitution tokens for the URI template
absolute boolean
Source:
Parameters:
Name Type Description
userName string User Name
fullName string Full display name. "userName" used if this param is empty or not supplied
linkAttr string Optional attributes to add to the tag, e.g. "class"
disableLink boolean Optional attribute instructing the link to be disabled (ie returning a span element rather than an a href element)
Source:
Returns:
The populated HTML Link
Type
string

viewInSourceRepositoryURL(record, actionUrls)

View in source Repository URL helper
Parameters:
Name Type Description
record Object Object literal representing the file or folder to be actioned
actionUrls Object Action urls for this record
Source: