Class Index | File Index

Classes


Class Alfresco.util

Alfresco top-level util namespace.
Defined in: alfresco.js
Field Summary
Field Attributes Field Name and Description
<static>  
Alfresco.util.blog
This file defines functions used across different blog related components
<static>  
Alfresco.util.BYTES_KB
Constants for conversion between bytes, kilobytes, megabytes and gigabytes
<static>  
Alfresco.util.discussions
Copyright (C) 2005-2010 Alfresco Software Limited.
<static>  
Alfresco.util.links
This file defines functions used across different links related components
<static>  
Alfresco.util.people
Person related utility functions
<static>  
Alfresco.util.RENDERLOOPSIZE
YUI DataTable rendering loop size constant
<static>  
Alfresco.util.RichEditorManager
Manager object for managing adapters for HTML editors.
<static>  
Alfresco.util.tags
Tags related funtions
Method Summary
Method Attributes Method Name and Description
<static>  
Alfresco.util.activateLinks(text)
Scans a text string for links and injects HTML mark-up to activate them.
<static>  
Alfresco.util.addMessages(p_obj, p_messageScope)
Add a component's messages to the central message store.
<static>  
Alfresco.util.appendArrayToObject(obj, arr, p_value)
Appends an array onto an object
<static>  
Alfresco.util.arrayContains(arr, el)
Check if an array contains an object
<static>  
Alfresco.util.arrayIndex(arr, value, attr)
Finds the index of an object in an array
<static>  
Alfresco.util.arrayRemove(arr, el)
Removes element el from array arr
<static>  
Alfresco.util.arrayToObject(arr, p_value)
Convert an array into an object
<static>  
Alfresco.util.assertNotEmpty(param, message)
Asserts param contains a proper value
<static>  
Alfresco.util.bind(fn, context, arguments)
Bind a function to a specific context.
<static>  
Alfresco.util.calI18nParams(oCal)
Helper method to set the required i18n properties on a YUI Calendar Widget
<static>  
Alfresco.util.caretFix(p_formElement)
Fixes the hidden caret problem in Firefox 2.x.
<static>  
Alfresco.util.cleanBubblingObject(callbackObj)
The YUI Bubbling Library augments callback objects with its own built-in fields.
<static>  
Alfresco.util.combinePaths(path1, path2, pathN)
Append multiple parts of a path, ensuring duplicate path separators are removed.
<static>  
Alfresco.util.contentURL(nodeRef, name, attach)
Returns a URL to the content represented by the passed-in nodeRef
<static>  
Alfresco.util.copyMessages(p_source, p_destination)
Copy one namespace's messages to another's.
<static>  
Alfresco.util.createBalloon(p_context, p_params)
Creates a "balloon tooltip" UI control attached to a passed-in element.
<static>  
Alfresco.util.createImageEditor(id, options)
<static>  
Alfresco.util.createInsituEditor(p_context, p_params, p_callback)
Create Insitu Editor
<static>  
Alfresco.util.createTwister(p_controller, p_filterName, p_config)
Creates a "disclosure twister" UI control from existing mark-up.
<static>  
Alfresco.util.createYUIButton(p_scope, p_name, p_onclick, p_obj, p_oElement)
Wrapper to create a YUI Button with common attributes.
<static>  
Alfresco.util.createYUIPanel(p_el, p_params, p_custom)
Wrapper to create a YUI Panel with common attributes, as follows:
<static>  
Alfresco.util.decodeHTML(html)
Decodes an HTML-encoded string
<static>  
Alfresco.util.deepCopy(p_obj, p_oInstructions)
Copies the values in an object into a new instance.
<static>  
Alfresco.util.disableYUIButton(p_button)
Wrapper to disable a YUI Button, including link buttons.
<static>  
Alfresco.util.dotNotationToObject(str, value)
Create empty JavaScript object literal from dotted notation string
<static>  
Alfresco.util.enableYUIButton(p_button)
Wrapper to (re)enable a YUI Button, including link buttons.
<static>  
Alfresco.util.encodeHTML(text, justified)
Encodes a potentially unsafe string with HTML entities
<static>  
Alfresco.util.encodeURIPath(text)
Encodes a folder path string for use in a REST URI.
<static>  
Alfresco.util.findEventClass(p_eventTarget, p_tagName)
Find an event target's class name, ignoring YUI classes.
<static>  
Alfresco.util.findInArray(arr, el, attr)
Check if an array contains an object
<static>  
Alfresco.util.findValueByDotNotation(obj, propertyPath, defaultValue)
Returns an object literal's property value given a dotted notation string representing the property path
<static>  
Alfresco.util.formatDate(date, mask)
Formats a Freemarker datetime into more UI-friendly format
<static>  
Alfresco.util.formatFileSize(fileSize)
Converts a file size in bytes to human readable form
<static>  
Alfresco.util.friendlyDate(date, format)
Converts a date to a more user friendly date
<static>  
Alfresco.util.fromExplodedJSONDate(date)
Convert an JSON date exploded into an object literal into a JavaScript native Date object.
<static>  
Alfresco.util.fromISO8601(date)
Convert an ISO8601 date string into a JavaScript native Date object
<static>  
Alfresco.util.generateDomId(p_el, p_prefix)
Returns a unique DOM ID for dynamically-created content. Optionally applies the new ID to an element.
<static>  
Alfresco.util.getFileExtension(filePath)
Returns the extension from file url or path
<static>  
Alfresco.util.getFileIcon(p_fileName, p_fileType, p_iconSize)
Given a filename, returns either a filetype icon or generic icon file stem
<static>  
Alfresco.util.getQueryStringParameter(paramName, queryString)
Returns the value of the specified query string parameter.
<static>  
Alfresco.util.getQueryStringParameters(queryString)
Returns the query string parameters as an object literal.
<static>  
Alfresco.util.getScrollPosition()
Returns the windows scroll position that later can be used for i.e. window.scrollTo.
<static>  
Alfresco.util.getTags(str)
Takes a string and splits it up to valid tags by using whitespace as separators.
<static>  
Alfresco.util.getVar(name, default)
Retrieves a JavaScript session variable.
<static>  
Alfresco.util.hasCssProperty(property)
Checks whether the current browser supports a given CSS property.
<static>  
Alfresco.util.hasEventInterest(p_instance, p_args)
Determines whether a Bubbling event should be ignored or not
<static>  
Alfresco.util.hasRequiredFlashPlayer(reqMajorVer, reqMinorVer, reqRevision)
Check if flash is installed.
<static>  
Alfresco.util.insertAtCursor(el, txt)
Inserts the given string into the supplied text element at the current cursor position.
<static>  
Alfresco.util.isAutocompleteIgnoreKey(nKeycode)
Autocomplete key filter
<static>  
Alfresco.util.isBrowserPluginInstalled(mimeType)
Checks whether particular plugin for associated mimetype is installed
<static>  
Alfresco.util.isDate(o)
Tests if o is of type date
<static>  
Checks whether Mac browser plugin for SharePoint is installed
<static>  
Alfresco.util.isValueSet(value, allowEmptyString)
Check a value is neither undefined nor null (returns false).
<static>  
Alfresco.util.isVisible(el)
Checks if the element and all its parents are visible and displayed in the ui.
<static>  
Alfresco.util.message(p_messageId, p_messageScope, multiple-values)
Resolve a messageId into a message.
<static>  
Alfresco.util.navigateTo(uri, method, parameters)
Navigates to a url
<static>  
Alfresco.util.objectMatchesPattern(obj, pattern)
Returns true if obj matches all attributes and their values in pattern.
<static>  
Alfresco.util.pad(value, value)
Pad a value with leading zeros to the specified length.
<static>  
Alfresco.util.parseJSON(jsonStr, displayError)
Parses a string to a json object and returns it.
<static>  
Alfresco.util.parseURL(URL)
Parses a URL string into an object
<static>  
Alfresco.util.populateHTML(p_label,)
Sets single or multiple DOM element innerHTML values.
<static>  
Alfresco.util.relativeTime(from, to)
Generate a relative time between two Date objects.
<static>  
Alfresco.util.relToTarget(rootNode)
Converts "rel" attributes on tags to "target" attributes.
<static>  
Alfresco.util.renderUriTemplate(template, obj, absolute)
Returns a populated URI template, given the URI template and an object literal
<static>  
Alfresco.util.RichEditor(editorName, id, config)
<static>  
Alfresco.util.selectText(elTextbox, nStart, nEnd)
Selects text in the input field.
<static>  
Alfresco.util.setDomId(p_el, p_domId)
Sets the domId as the html dom id on el
<static>  
Alfresco.util.setSelectedClass(parentEl, selectEl, selectClass)
Removes selectClass from all of selectEl's parent's child elements but adds it to selectEl.
<static>  
Alfresco.util.setSelectedIndex(value, selectEl)
Tests a select element's options against "value" and
<static>  
Alfresco.util.setVar(name, value)
Sets a JavaScript session variable.
<static>  
Alfresco.util.siteDashboardLink(siteId, siteTitle, linkAttr, disableLink)
Generates a link to a site dashboard page
<static>  
Alfresco.util.siteURL(pageURI, obj, absolute)
Returns a URL to a site page.
<static>  
Alfresco.util.submitForm(form)
Submits a form programatically, handling the
<static>  
Alfresco.util.substituteDotNotation(str, obj)
Substitutes placeholder dotted notation values in strings given an object containing those properties
<static>  
Alfresco.util.toExplodedJSONDate(date)
Convert an object literal into a JavaScript native Date object into an JSON date exploded.
<static>  
Alfresco.util.toggleClass(element, className)
Adds a class if it doesn't exist, and removes it if it does
<static>  
Alfresco.util.toggleHelpText(helpTextId)
Helper function to toggle the state of the help text element
<static>  
Alfresco.util.toISO8601(date)
Convert a JavaScript native Date object into an ISO8601 date string
<static>  
Alfresco.util.toQueryString(params)
Turns an object literal into a valid queryString.
<static>  
Alfresco.util.tweetToHTML(text)
Convert a plaintext Tweet into HTML with detected links parsed and "activated"
<static>  
Alfresco.util.undoCaretFix(p_formElement)
Remove the fixes for the hidden caret problem in Firefox 2.x.
<static>  
Alfresco.util.updateMultiSelectListValue(list, hiddenField, signalChange)
Helper function to add the current state of the given multi-select list to
<static>  
Alfresco.util.uriTemplate(templateId, obj, absolute)
Returns a populated URI template, given a TemplateId and an object literal
<static>  
Alfresco.util.useAsButton(el, callbackFn, callbackObj, callbackScope)
Helper function to listen for mouse click and keyboard enter events on an element.
<static>  
Alfresco.util.userProfileLink(userName, fullName, linkAttr, disableLink)
Generates a link to the user profile page unless the "userprofilepage" uritemplate has
Field Detail
<static> Alfresco.util.blog
This file defines functions used across different blog related components
Defined in blog-common.js.

<static> Alfresco.util.BYTES_KB
Constants for conversion between bytes, kilobytes, megabytes and gigabytes

<static> Alfresco.util.discussions
Copyright (C) 2005-2010 Alfresco Software Limited.

This file is part of Alfresco

Alfresco is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Alfresco is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with Alfresco. If not, see .
Defined in discussions-common.js.

<static> Alfresco.util.links
This file defines functions used across different links related components
Defined in links-common.js.

<static> Alfresco.util.people
Person related utility functions
A person object consists of the following data:
{
username : "",
firstName : "",
lastName : "",
avatarRef : ""
}
Only the username is mandatory
Defined in blogdiscussions-common.js.

<static> Alfresco.util.RENDERLOOPSIZE
YUI DataTable rendering loop size constant

<static> Alfresco.util.RichEditorManager
Manager object for managing adapters for HTML editors.

<static> Alfresco.util.tags
Tags related funtions
Defined in blogdiscussions-common.js.
Method Detail
<static> {string} Alfresco.util.activateLinks(text)
Scans a text string for links and injects HTML mark-up to activate them.
NOTE: If used in conjunction with encodeHTML, this function must be called last.
Parameters:
{string} text
The string potentially containing links
Returns:
{string} String with links marked-up to make them active

<static> {boolean} Alfresco.util.addMessages(p_obj, p_messageScope)
Add a component's messages to the central message store.
Parameters:
{object} p_obj
Object literal containing messages in the correct locale
{string} p_messageScope
Message scope to add these to, e.g. componentId
Throws:
{Error}
Returns:
{boolean} true if messages added

<static> {object} Alfresco.util.appendArrayToObject(obj, arr, p_value)
Appends an array onto an object
Parameters:
{object} obj
Object to be appended to
{array} arr
Array to append/merge onto object
{object} p_value
Optional: default value for property.
Returns:
{object} The appended object

<static> {boolean} Alfresco.util.arrayContains(arr, el)
Check if an array contains an object
Parameters:
{array} arr
Array to convert to object
{object} el
The element to be searched for in the array
Returns:
{boolean} True if arr contains el

<static> {integer} Alfresco.util.arrayIndex(arr, value, attr)
Finds the index of an object in an array
Parameters:
{array} arr
Array to search in
{object} value
The element to find the index for in the array
{string} attr
(Optional) If provided, valu ewill be compared to an attribute inside the object, instead of compared to the object itself.
Returns:
{integer} -1 if not found, other wise the index

<static> {boolean} Alfresco.util.arrayRemove(arr, el)
Removes element el from array arr
Parameters:
{array} arr
Array to remove el from
{object} el
The element to be removed
Returns:
{boolean} The array now without the element

<static> {object} Alfresco.util.arrayToObject(arr, p_value)
Convert an array into an object
Parameters:
{array} arr
Array to convert to object
{object} p_value
Optional: default value for property.
Returns:
{object} Object conversion of array

<static> Alfresco.util.assertNotEmpty(param, message)
Asserts param contains a proper value
Parameters:
{object} param
Parameter to assert valid
{string} message
Error message to throw on assertion failure
Throws:
{Error}

<static> {function} Alfresco.util.bind(fn, context, arguments)
Bind a function to a specific context.
Parameters:
{function} fn
Function to be bound.
{object} context
Context to bind function to.
{object} arguments
Optional arguments to prepend to arguments passed-in when function is actually called
Returns:
{function} Function wrapper.

<static> Alfresco.util.calI18nParams(oCal)
Helper method to set the required i18n properties on a YUI Calendar Widget
see: http://developer.yahoo.com/yui/docs/YAHOO.widget.Calendar.html#config_MY_LABEL_MONTH_POSITION
for what each property does
Parameters:
{object} oCal
a YAHOO.widget.Calendar object

<static> Alfresco.util.caretFix(p_formElement)
Fixes the hidden caret problem in Firefox 2.x.
Assumes <input> or <textarea> elements are wrapped in a <div class="yui-u"></div>
Parameters:
p_formElement
{element|string} Form element to fix input boxes within

<static> {object} Alfresco.util.cleanBubblingObject(callbackObj)
The YUI Bubbling Library augments callback objects with its own built-in fields.
This function strips those out, so the remainder of the object is "clean"
Parameters:
{object} callbackObj
Object literal as passed to the event handler
Returns:
{object} Object stripped of Bubbling Library fields

<static> {string} Alfresco.util.combinePaths(path1, path2, pathN)
Append multiple parts of a path, ensuring duplicate path separators are removed.
Leaves "://" patterns intact so URIs and nodeRefs are safe to pass through.
Parameters:
{string} path1
First path
{string} path2
Second path
...
{string} pathN
Nth path
Returns:
{string} A string containing the combined paths

<static> {string} Alfresco.util.contentURL(nodeRef, name, attach)
Returns a URL to the content represented by the passed-in nodeRef
Parameters:
{string} nodeRef
Standard Alfresco nodeRef
{string} name
Filename to download
{boolean} attach
If true, browser should prompt the user to "Open or Save?", rather than display inline
Returns:
{string} The URL to the content

<static> Alfresco.util.copyMessages(p_source, p_destination)
Copy one namespace's messages to another's.
Parameters:
{string} p_source
Source namespace
{string} p_destination
Destination namespace. Will be overwritten with source's messages
Throws:
{Error}

<static> {object|null} Alfresco.util.createBalloon(p_context, p_params)
Creates a "balloon tooltip" UI control attached to a passed-in element.
Parameters:
p_context
{Element|string} Element (or DOM ID) to align the balloon to
{object} p_params
Optional additional configuration to override the defaults

width {string} CSS width of the tooltip. Defaults to 30em
Returns:
{object|null} Balloon instance

<static> Alfresco.util.createImageEditor(id, options)
Defined in simple-editor.js
Parameters:
id
options

<static> {Object|null} Alfresco.util.createInsituEditor(p_context, p_params, p_callback)
Create Insitu Editor
Parameters:
{HTMLElement} p_context
DOM node controlling editor visibility
{Object} p_params
Instance configuration parameters
{Object} p_callback
Callback function after successful edit operation
Returns:
{Object|null} New instance of an insitu editor

<static> {boolean} Alfresco.util.createTwister(p_controller, p_filterName, p_config)
Creates a "disclosure twister" UI control from existing mark-up.
Parameters:
p_controller
{Element|string} Element (or DOM ID) of controller node
The code will search for the next sibling which will be used as the hideable panel, unless overridden below
{string} p_filterName
Filter's name under which to save it's collapsed state via preferences
{object} p_config
Optional additional configuration to override the defaults

panel {Element|string} Use this panel as the hideable element instead of the controller's first sibling
Returns:
{boolean} true = success

<static> {YAHOO.widget.Button} Alfresco.util.createYUIButton(p_scope, p_name, p_onclick, p_obj, p_oElement)
Wrapper to create a YUI Button with common attributes.
All supplied object parameters are passed to the button constructor
e.g. Alfresco.util.createYUIButton(this, "OK", this.onOK, {type: "submit"});
Parameters:
{object} p_scope
Component containing button; must have "id" parameter
{string} p_name
Dom element ID of markup that button is created from {p_scope.id}-{name}
{function} p_onclick
If supplied, registered with the button's click event
{object} p_obj
Optional extra object parameters to pass to button constructor
p_oElement
{string|HTMLElement} Optional and accepts a string to use as an ID for getting a DOM reference or an actual DOM reference
Returns:
{YAHOO.widget.Button} New Button instance

<static> {YAHOO.widget.Dialog|flags.type} Alfresco.util.createYUIPanel(p_el, p_params, p_custom)
Wrapper to create a YUI Panel with common attributes, as follows:
<pre>
modal: true,
constraintoviewport: true,
draggable: true,
fixedcenter: true,
close: true,
visible: false
</pre>
All supplied object parameters are passed to the panel constructor
e.g. Alfresco.util.createYUIPanel("myId", { draggable: false });
Parameters:
p_el
{string|HTMLElement} The element ID representing the Panel or the element representing the Panel
{object} p_params
Optional extra/overridden object parameters to pass to Panel constructor
{object} p_custom
Optional parameters to customise Panel creation:

render {boolean} By default the new Panel will be rendered to document.body. Set to false to prevent this.
type {object} Use to override YAHOO.widget.Panel default type, e.g. YAHOO.widget.Dialog
Returns:
{YAHOO.widget.Dialog|flags.type} New Panel instance

<static> {string} Alfresco.util.decodeHTML(html)
Decodes an HTML-encoded string
Replaces < > and & entities with their character equivalents
Parameters:
{string} html
The string containing HTML entities
Returns:
{string} Decoded string

<static> {object|array|date|string|number|boolean} Alfresco.util.deepCopy(p_obj, p_oInstructions)
Copies the values in an object into a new instance.

Note 1. This method ONLY copy values of type object, array, date, boolean, string or number.
Note 2. Functions are not copied.
Note 3. Objects with a constructor other than of type Object are still in the result but aren't copied.
This means that objects of HTMLElements or window will be in the result but will not be copied and hence
shared between p_obj and the returned copy og p_obj.
Parameters:
p_obj
{object|array|date|string|number|boolean} The object to copy
{object} p_oInstructions
(Optional) Contains special non default copy instructions
p_oInstructions.copyFunctions
{boolean} (Optional) false by default
Returns:
{object|array|date|string|number|boolean} A new instance of the same type as o with the same values

<static> Alfresco.util.disableYUIButton(p_button)
Wrapper to disable a YUI Button, including link buttons.
Link buttons aren't disabled by YUI; see http://developer.yahoo.com/yui/button/#apiref
Parameters:
p_button
{YAHOO.widget.Button} Button instance

<static> {object} Alfresco.util.dotNotationToObject(str, value)
Create empty JavaScript object literal from dotted notation string
<pre>e.g. Alfresco.util.dotNotationToObject("org.alfresco.site") returns {"org":{"alfresco":{"site":{}}}}</pre>
Parameters:
{string} str
an dotted notation string
value
{object|string|number} an optional object to set the "deepest" object to
Returns:
{object} An empty object literal, build from the dotted notation

<static> Alfresco.util.enableYUIButton(p_button)
Wrapper to (re)enable a YUI Button, including link buttons.
Link buttons aren't disabled by YUI; see http://developer.yahoo.com/yui/button/#apiref
Parameters:
p_button
{YAHOO.widget.Button} Button instance

<static> {string} Alfresco.util.encodeHTML(text, justified)
Encodes a potentially unsafe string with HTML entities
Replaces <pre><, >, &</pre> characters with their entity equivalents.
Based on the equivalent encodeHTML and unencodeHTML functions in Prototype.
Parameters:
{string} text
The string to be encoded
{boolean} justified
If true, don't render lines 2..n with an indent
Returns:
{string} Safe HTML string

<static> {string} Alfresco.util.encodeURIPath(text)
Encodes a folder path string for use in a REST URI.
First performs a encodeURI() pass so that the '/' character is maintained
as the path must be intact as URI elements. Then encodes further characters
on the path that would cause problems in URLs, such as '&', '=' and '#'.
Parameters:
{string} text
The string to be encoded
Returns:
{string} Encoded path URI string.

<static> {string|null} Alfresco.util.findEventClass(p_eventTarget, p_tagName)
Find an event target's class name, ignoring YUI classes.
Parameters:
{object} p_eventTarget
Event target from Event class
{string} p_tagName
Optional tag if 'span' needs to be overridden
Returns:
{string|null} Class name or null

<static> {boolean} Alfresco.util.findInArray(arr, el, attr)
Check if an array contains an object
Parameters:
{array} arr
Array to convert to object
{object} el
The element to be searched for in the array
attr
Returns:
{boolean} True if arr contains el

<static> {object} Alfresco.util.findValueByDotNotation(obj, propertyPath, defaultValue)
Returns an object literal's property value given a dotted notation string representing the property path
Parameters:
{object} obj
i.e. {org:{alfresco:{site:"share"}}}
{string} propertyPath
i.e. "org.alfresco.site"
{object} defaultValue
optional The value to return if there is no value for the propertyPath
Returns:
{object} the value for the property specified by the string, in the example "share" would be returned

<static> {string} Alfresco.util.formatDate(date, mask)
Formats a Freemarker datetime into more UI-friendly format
Parameters:
{string} date
Optional: Date as returned from data webscript. Today used if missing.
{string} mask
Optional: Mask to use to override default.
Returns:
{string} Date formatted for UI

<static> {string} Alfresco.util.formatFileSize(fileSize)
Converts a file size in bytes to human readable form
Parameters:
{number} fileSize
File size in bytes
Throws:
{Error}
Returns:
{string} The file size in a readable form, i.e 1.2mb

<static> {string} Alfresco.util.friendlyDate(date, format)
Converts a date to a more user friendly date
Parameters:
{Date} date
- the date being converted
{string} format
- the date format
Returns:
{string} - the user friendly date

<static> {Date|null} Alfresco.util.fromExplodedJSONDate(date)
Convert an JSON date exploded into an object literal into a JavaScript native Date object.
NOTE: Passed-in date will have month as zero-based.
Parameters:
{object} date
object literal of the following example format (UTC):

date =
{
year: 2009
month: 4 // NOTE: zero-based
date: 22
hours: 14
minutes: 27
seconds: 42
milliseconds: 390
}
Returns:
{Date|null} JavaScript native Date object

<static> {Date|null} Alfresco.util.fromISO8601(date)
Convert an ISO8601 date string into a JavaScript native Date object
Parameters:
{string} date
ISO8601 formatted date string
Returns:
{Date|null} JavaScript native Date object

<static> {string} Alfresco.util.generateDomId(p_el, p_prefix)
Returns a unique DOM ID for dynamically-created content. Optionally applies the new ID to an element.
Parameters:
{HTMLElement} p_el
Applies new ID to element
{string} p_prefix
Optional prefix instead of "alf-id" default
Returns:
{string} Dom Id guaranteed to be unique on the current page

<static> {string|null} Alfresco.util.getFileExtension(filePath)
Returns the extension from file url or path
Parameters:
{string} filePath
File path from which to extract file extension
Returns:
{string|null} File extension or null

<static> {string} Alfresco.util.getFileIcon(p_fileName, p_fileType, p_iconSize)
Given a filename, returns either a filetype icon or generic icon file stem
Parameters:
{string} p_fileName
File to find icon for
{string} p_fileType
Optional: Filetype to offer further hinting
{int} p_iconSize
Icon size: 32
Returns:
{string} The icon name, e.g. doc-file-32.png

<static> {string} Alfresco.util.getQueryStringParameter(paramName, queryString)
Returns the value of the specified query string parameter.
Parameters:
{string} paramName
Name of the parameter we want to look up.
{string} queryString
Optional URL to look at. If not specified,
this method uses the URL in the address bar.
Returns:
{string} The value of the specified parameter, or null.

<static> {object} Alfresco.util.getQueryStringParameters(queryString)
Returns the query string parameters as an object literal.
Parameters appearing more than once are returned an an array.
This method has been extracted from the YUI Browser History Manager.
It can be used here without the overhead of the History JavaScript include.
Parameters:
{string} queryString
Optional URL to look at. If not specified,
this method uses the URL in the address bar.
Returns:
{object} Object literal containing QueryString parameters as name/value pairs

<static> {Array} Alfresco.util.getScrollPosition()
Returns the windows scroll position that later can be used for i.e. window.scrollTo.
Returns:
{Array} An array with the x & y position of the scrollbars

<static> {array} Alfresco.util.getTags(str)
Takes a string and splits it up to valid tags by using whitespace as separators.
Multi-word tags are supported by "quoting the phrase".
e.g. the string
<pre>hello*world "this is alfresco"</pre>
would result in tags: "hello*world" and "this is alfresco".
Parameters:
{string} str
a string containing tags
Returns:
{array} of valid tags

<static> {object|null} Alfresco.util.getVar(name, default)
Retrieves a JavaScript session variable.
Variables are scoped to the current "location.host"
Parameters:
{string} name
Variable name
{object} default
Default value to return if not set
Returns:
{object|null} Variable value or default if provided (null otherwise)

<static> {boolean} Alfresco.util.hasCssProperty(property)
Checks whether the current browser supports a given CSS property.
The property should be passed in canonical form and without vendor prefix
e.g. "TextShadow"
Parameters:
{string} property
CSS property to test
Returns:
{boolean} True if the browser appears to support the property

<static> {boolean} Alfresco.util.hasEventInterest(p_instance, p_args)
Determines whether a Bubbling event should be ignored or not
Parameters:
{object} p_instance
Instance checking for event interest
{object} p_args
Bubbling event args
Returns:
{boolean} false to ignore event

<static> {boolean} Alfresco.util.hasRequiredFlashPlayer(reqMajorVer, reqMinorVer, reqRevision)
Check if flash is installed.
Returns true if a flash player of the required version is installed
Parameters:
{int} reqMajorVer
{int} reqMinorVer
{int} reqRevision
Returns:
{boolean} Returns true if a flash player of the required version is installed

<static> Alfresco.util.insertAtCursor(el, txt)
Inserts the given string into the supplied text element at the current cursor position.
Parameters:
{object} el
The Dom text element to insert into
{string} txt
The string to insert at current cursor position

<static> {Boolean} Alfresco.util.isAutocompleteIgnoreKey(nKeycode)
Autocomplete key filter
Whether or not key is functional or should be ignored. Note that the right
arrow key is NOT an ignored key since it triggers queries for certain intl
charsets.
From YAHOO.widget.AutoComplete.prototype._isIgnoreKey()
Parameters:
{Number} nKeycode
Code of key pressed.
Returns:
{Boolean} True if key should be ignored, false otherwise.

<static> Alfresco.util.isBrowserPluginInstalled(mimeType)
Checks whether particular plugin for associated mimetype is installed
Parameters:
mimeType

<static> {boolean} Alfresco.util.isDate(o)
Tests if o is of type date
Parameters:
{object} o
The object to test
Returns:
{boolean} True if o is of type date

<static> Alfresco.util.isSharePointPluginInstalled()
Checks whether Mac browser plugin for SharePoint is installed

<static> {boolean} Alfresco.util.isValueSet(value, allowEmptyString)
Check a value is neither undefined nor null (returns false).
An empty string also returns false unless the allowEmptyString flag is set.
Parameters:
{object} value
Parameter to check
{boolean} allowEmptyString
Optional flag to indicate that empty strings are valid inputs.
Returns:
{boolean} Flag indicating whether the value is set or not.

<static> Alfresco.util.isVisible(el)
Checks if the element and all its parents are visible and displayed in the ui.
Parameters:
{object} el
The Dom element to check visibility for
Returns:
true if el and all its parents are displayed in ui

<static> {string} Alfresco.util.message(p_messageId, p_messageScope, multiple-values)
Resolve a messageId into a message.
If a messageScope is supplied, that container will be searched first, followed by the "global" message scope.
Note: Implementation follows single-quote quirks of server implementations whereby I18N messages containing
one or more tokens must use two single-quotes in order to display one.
See: http://download.oracle.com/javase/1.5.0/docs/api/java/text/MessageFormat.html
Parameters:
{string} p_messageId
Message id to resolve
{string} p_messageScope
Message scope, e.g. componentId
multiple-values
{string} Values to replace tokens with
Throws:
{Error}
Returns:
{string} The localized message string or the messageId if not found

<static> Alfresco.util.navigateTo(uri, method, parameters)
Navigates to a url
Parameters:
{string} uri
THe uri to navigate to
{string} method
(Optional) Default is "GET"
parameters
{string|object}

<static> {boolean} Alfresco.util.objectMatchesPattern(obj, pattern)
Returns true if obj matches all attributes and their values in pattern.
Attribute values in pattern may contain wildcards ("*").
Parameters:
{object} obj
The object to match pattern against
{object} pattern
An object with attributes to match against obj
Returns:
{boolean} true if obj matches pattern, false otherwise

<static> {string} Alfresco.util.pad(value, value)
Pad a value with leading zeros to the specified length.
Parameters:
value
{string|number} non null value to pad
{number} value
length to pad out with leading zeros
Returns:
{string} padded value as a string

<static> {object} Alfresco.util.parseJSON(jsonStr, displayError)
Parses a string to a json object and returns it.
If str contains invalid json code that is displayed using displayPrompt().
Parameters:
{string} jsonStr
The JSON string to be parsed
{boolean} displayError
Set true to display a message informing about bad JSON syntax
Returns:
{object} The object representing the JSON string

<static> Alfresco.util.parseURL(URL)
Parses a URL string into an object
Parameters:
{string} URL
The URL to convert
Returns:
urlObject {object} object literal containing the URL properties.

<static> Alfresco.util.populateHTML(p_label,)
Sets single or multiple DOM element innerHTML values.
Ensures target element exists in the DOM before attempting to set the label.
Parameters:
p_label,
p_label, ... {Array} Array with exactly two members:

[0] {String | HTMLElement} Accepts a string to use as an ID for getting a DOM reference, or an actual DOM reference.

[1] {String} HTML content to populate element if it exists in the DOM. HTML will NOT be escaped.

<static> {string} Alfresco.util.relativeTime(from, to)
Generate a relative time between two Date objects.
Parameters:
from
{Date|String} JavaScript Date object or ISO8601-formatted date string
to
{Date|string} (Optional) JavaScript Date object or ISO8601-formatted date string, defaults to now if not supplied
Returns:
{string} Relative time description

<static> Alfresco.util.relToTarget(rootNode)
Converts "rel" attributes on <a> tags to "target" attributes.
"target" isn't supported in XHTML, so we use "rel" as a placeholder and replace at runtime.
Parameters:
rootNode
{HTMLElement|String} An id or HTMLElement to start the query from

<static> {string|null} Alfresco.util.renderUriTemplate(template, obj, absolute)
Returns a populated URI template, given the URI template and an object literal
containing the tokens to be substituted.
Understands when the application is hosted in a Portal environment.
Parameters:
{string} template
URI Template to be populated
{object} obj
The object literal containing the token values to substitute
{boolean} absolute
Whether the URL should include the protocol and host
Returns:
{string|null} The populated URI or null if templateId not found

<static> Alfresco.util.RichEditor(editorName, id, config)
Parameters:
{String} editorName
Name of editor to use. Must be same as one registered with
Alfresco.util.RichEditManager.
{String} id
Optional Id of textarea to turn into rich text editor
{String} config
Optional config object literal to use to configure editor.

<static> Alfresco.util.selectText(elTextbox, nStart, nEnd)
Selects text in the input field.
Parameters:
{HTMLElement} elTextbox
Text input box element in which to select text.
{Number} nStart
Starting index of text string to select.
{Number} nEnd
Ending index of text selection.

<static> Alfresco.util.setDomId(p_el, p_domId)
Sets the domId as the html dom id on el
Parameters:
{HTMLElement} p_el
Applies new ID to element
{string} p_domId
The dom id to apply

<static> Alfresco.util.setSelectedClass(parentEl, selectEl, selectClass)
Removes selectClass from all of selectEl's parent's child elements but adds it to selectEl.
Parameters:
{HTMLElement} parentEl
The elements to deselct
{HTMLElement} selectEl
The element to select
{string} selectClass
The css class to remove from unselected and add to the selected element

<static> {string} Alfresco.util.setSelectedIndex(value, selectEl)
Tests a select element's options against "value" and
if there is a match that option is set to the selected index.
Parameters:
{HTMLSelectElement} value
The select element to change the selectedIndex for
{string} selectEl
The value to match agains the select elements option values
Returns:
{string} The label/name of the seleceted option OR null if no option was found

<static> {boolean} Alfresco.util.setVar(name, value)
Sets a JavaScript session variable.
The variables are stored in window.name, so live for as long as the browser window does.
Variables are scoped to the current "location.host"
Parameters:
{string} name
Variable name
{object} value
Value to set
Returns:
{boolean} True for successful set

<static> {string} Alfresco.util.siteDashboardLink(siteId, siteTitle, linkAttr, disableLink)
Generates a link to a site dashboard page
Parameters:
{string} siteId
Site short name
{string} siteTitle
Site display name. "siteId" used if this param is empty or not supplied
{string} linkAttr
Optional attributes to add to the tag, e.g. "class"
{boolean} disableLink
Optional attribute instructing the link to be disabled
(ie returning a span element rather than an a href element)
Returns:
{string} The populated HTML Link

<static> {string} Alfresco.util.siteURL(pageURI, obj, absolute)
Returns a URL to a site page.
If no Site ID is supplied, generates a link to the non-site page.
Parameters:
{string} pageURI
Page ID and and QueryString parameters the page might need, e.g.

"folder-details?nodeRef=" + nodeRef
{object} obj
The object literal containing the token values to substitute within the template
{boolean} absolute
Whether the URL should include the protocol and host
Returns:
{string} The populated URL

<static> Alfresco.util.submitForm(form)
Submits a form programatically, handling the
various browser nuances.
Parameters:
form
The form to submit

<static> {string} Alfresco.util.substituteDotNotation(str, obj)
Substitutes placeholder dotted notation values in strings given an object containing those properties
Parameters:
{string} str
string containing dot notated property placeholders
{object} obj
JavaScript object
Returns:
{string} String with populated placeholders

<static> {object} Alfresco.util.toExplodedJSONDate(date)
Convert an object literal into a JavaScript native Date object into an JSON date exploded.
NOTE: Passed-in date will have month as zero-based.
Parameters:
{Date} date
JavaScript Date object
Returns:
{object}
   date = 
   {
      year: 2009
      month: 4 // NOTE: zero-based
      date: 22
      hours: 14
      minutes: 27
      seconds: 42
      milliseconds: 390
   }

<static> Alfresco.util.toggleClass(element, className)
Adds a class if it doesn't exist, and removes it if it does
Parameters:
element
{HTML Element} The element to change the class of.
{String} className
Name of the class to look for and remove.

<static> Alfresco.util.toggleHelpText(helpTextId)
Helper function to toggle the state of the help text element
represented by the given id.
Defined in form.js
Parameters:
helpTextId
The id of the help text element to toggle

<static> {string} Alfresco.util.toISO8601(date)
Convert a JavaScript native Date object into an ISO8601 date string
Parameters:
{Date} date
JavaScript native Date object
Returns:
{string} ISO8601 formatted date string

<static> {string} Alfresco.util.toQueryString(params)
Turns an object literal into a valid queryString.
Format of the object is as returned from the getQueryStringParameters() function.
Parameters:
{object} params
Object literal containing QueryString parameters as name/value pairs
Returns:
{string} QueryString-formatted string

<static> {string} Alfresco.util.tweetToHTML(text)
Convert a plaintext Tweet into HTML with detected links parsed and "activated"
Parameters:
{string} text
The plaintext Tweet
Returns:
{string} HTML string

<static> Alfresco.util.undoCaretFix(p_formElement)
Remove the fixes for the hidden caret problem in Firefox 2.x.
Should be called before hiding a form for re-use.
Parameters:
p_formElement
{element|string} Form element to undo fixes within

<static> Alfresco.util.updateMultiSelectListValue(list, hiddenField, signalChange)
Helper function to add the current state of the given multi-select list to
the given hidden field.
Defined in form.js
Parameters:
{string} list
The id of the multi-select element
{string} hiddenField
The id of the hidden field to populate the value with
{boolean} signalChange
If true a bubbling event is sent to inform any
interested listeners that the hidden field value changed

<static> {string|null} Alfresco.util.uriTemplate(templateId, obj, absolute)
Returns a populated URI template, given a TemplateId and an object literal
containing the tokens to be substituted.
Understands when the application is hosted in a Portal environment.
Parameters:
{string} templateId
URI TemplateId from web-framework configuration
{object} obj
The object literal containing the token values to substitute
{boolean} absolute
Whether the URL should include the protocol and host
Returns:
{string|null} The populated URI or null if templateId not found

<static> Alfresco.util.useAsButton(el, callbackFn, callbackObj, callbackScope)
Helper function to listen for mouse click and keyboard enter events on an element.
Also makes sure that el has a tabindex so it can get focus
Parameters:
el
{String|HTMLElement} The element to listen to
{function} callbackFn
The method to invoke on click or enter will get called with (event, obj)
{Object} callbackObj
The object to pass into the callback
{Object} callbackScope
(Optional) The scope to execute the callback in (if not supplied el is used)

<static> {string} Alfresco.util.userProfileLink(userName, fullName, linkAttr, disableLink)
Generates a link to the user profile page unless the "userprofilepage" uritemplate has
been removed or emptied in share-config-custom.xml
If no fullName is supplied, the userName is displayed instead.
Parameters:
{string} userName
User Name
{string} fullName
Full display name. "userName" used if this param is empty or not supplied
{string} linkAttr
Optional attributes to add to the tag, e.g. "class"
{boolean} disableLink
Optional attribute instructing the link to be disabled
(ie returning a span element rather than an a href element)
Returns:
{string} The populated HTML Link

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Feb 16 2012 12:24:28 GMT-0000 (GMT)