Class finesse.utilities.Utilities
Extends
finesse.restservices.RestBase.
A PhoneBook is a list of Contacts available to a User for quick dial.
Defined in: finesse.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
finesse.utilities.Utilities.ampRegEx
Regular expressions used in translating HTML and XML entities
|
Method Attributes | Method Name and Description |
---|---|
<static> |
finesse.utilities.Utilities.b64Decode(input)
Decodes the given base64 string.
|
<static> |
finesse.utilities.Utilities.b64Encode(input)
Encodes the given string into base64.
|
<static> |
finesse.utilities.Utilities.convertNullToEmptyString(str)
Checks if the string is null.
|
<static> |
finesse.utilities.Utilities.convertTsToDuration(timestamp, now)
Utility method to render a timestamp string (of format
YYYY-MM-DDTHH:MM:SSZ) into a duration of HH:MM:SS format.
|
<static> |
finesse.utilities.Utilities.convertTsToDurationWithFormat(timestamp, forFormat, now)
Utility method to render a timestamp string (of format
YYYY-MM-DDTHH:MM:SSZ) into a duration of HH:MM:SS format,
with optional -1 for null or negative times.
|
<static> |
finesse.utilities.Utilities.currentServerTimeMillis()
Utility method for getting the current time,
adjusted by the calculated "drift" to closely
approximate the server time.
|
<static> |
finesse.utilities.Utilities.currentTimeMillis()
Utility method for getting the current time in milliseconds.
|
<static> |
finesse.utilities.Utilities.detectIEBrowserVersion()
Utility to detect the browser version of IE, whether it is IE9 or IE8 or in compatibility mode.
|
<static> |
finesse.utilities.Utilities.escapeSpaces(text)
Escapes spaces as encoded " " characters so they can
be safely rendered by jQuery.text(string) in all browsers.
|
<static> |
finesse.utilities.Utilities.getDisplayTime(time)
Utility method to render a timestamp value (in seconds) into HH:MM:SS format.
|
<static> |
finesse.utilities.Utilities.getEquals(obj1, obj2)
Compares two objects for equality.
|
<static> |
finesse.utilities.Utilities.isArray(obj)
Takes an Object and determines whether it is an Array or not.
|
<static> |
finesse.utilities.Utilities.removeSpaces(string)
Takes a string and removes any spaces within the string.
|
<static> |
finesse.utilities.Utilities.trim(str)
Trims leading and trailing whitespace from a string.
|
<static> |
finesse.utilities.Utilities.validateHandler(handler)
Returns the passed in handler, if it is a function.
|
- Methods borrowed from class finesse.restservices.RestBase:
- addHandler, getData, getId, getProperty, hasProperty, isLoaded, refresh, removeHandler
Field Detail
<static>
finesse.utilities.Utilities.ampRegEx
Regular expressions used in translating HTML and XML entities
Method Detail
<static>
{String}
finesse.utilities.Utilities.b64Decode(input)
Decodes the given base64 string.
NOTE: output is assumed to be UTF-8; only the first 8 bits of each output element are significant.
NOTE: output is assumed to be UTF-8; only the first 8 bits of each output element are significant.
- Parameters:
- {String} input
- The base64 encoded string
- Returns:
- {String} Decoded string
<static>
{String}
finesse.utilities.Utilities.b64Encode(input)
Encodes the given string into base64.
NOTE: {input} is assumed to be UTF-8; only the first 8 bits of each input element are significant.
NOTE: {input} is assumed to be UTF-8; only the first 8 bits of each input element are significant.
- Parameters:
- {String} input
- The string to convert to base64.
- Returns:
- {String} The converted string.
<static>
{String}
finesse.utilities.Utilities.convertNullToEmptyString(str)
Checks if the string is null. If it is, return empty string; else return
the string itself.
- Parameters:
- {String} str
- The string to check
- Returns:
- {String} Empty string or string itself
<static>
{String}
finesse.utilities.Utilities.convertTsToDuration(timestamp, now)
Utility method to render a timestamp string (of format
YYYY-MM-DDTHH:MM:SSZ) into a duration of HH:MM:SS format.
- Parameters:
- {String} timestamp
- The timestamp to render
- {Date} now Optional
- Optional argument to provide the time from which to calculate the duration instead of using the current time
- Returns:
- {String} Duration string in HH:MM:SS format.
<static>
{String}
finesse.utilities.Utilities.convertTsToDurationWithFormat(timestamp, forFormat, now)
Utility method to render a timestamp string (of format
YYYY-MM-DDTHH:MM:SSZ) into a duration of HH:MM:SS format,
with optional -1 for null or negative times.
- Parameters:
- {String} timestamp
- The timestamp to render
- {Boolean} forFormat
- If True, if duration is null or negative, return -1 so that the duration can be formated as needed in the Gadget.
- {Date} now Optional
- Optional argument to provide the time from which to calculate the duration instead of using the current time
- Returns:
- {String} Duration string in HH:MM:SS format.
<static>
{String}
finesse.utilities.Utilities.currentServerTimeMillis()
Utility method for getting the current time,
adjusted by the calculated "drift" to closely
approximate the server time. This is used
when calculating durations based on a server
timestamp, which otherwise can produce unexpected
results if the times on client and server are
off.
- Returns:
- {String} The current server time in milliseconds
<static>
{String}
finesse.utilities.Utilities.currentTimeMillis()
Utility method for getting the current time in milliseconds.
- Returns:
- {String} The current time in milliseconds
<static>
{Object}
finesse.utilities.Utilities.detectIEBrowserVersion()
Utility to detect the browser version of IE, whether it is IE9 or IE8 or in compatibility mode.
If IE is earlier than IE8, version returns undefined.
- Returns:
- {Object} browser object has the following form: { isIE: {Boolean}, version: {String}, // 8 for IE8, 9 or IE9 isCompatibilityMode: {Boolean} }
<static>
finesse.utilities.Utilities.escapeSpaces(text)
Escapes spaces as encoded " " characters so they can
be safely rendered by jQuery.text(string) in all browsers.
(Although IE behaves as expected, Firefox collapses spaces if this function is not used.)
- Parameters:
- text
- The string whose spaces should be escaped
- Returns:
- The string with spaces escaped
<static>
{String}
finesse.utilities.Utilities.getDisplayTime(time)
Utility method to render a timestamp value (in seconds) into HH:MM:SS format.
- Parameters:
- {Number} time
- The timestamp in ms to render
- Returns:
- {String} Time string in HH:MM:SS format.
<static>
finesse.utilities.Utilities.getEquals(obj1, obj2)
Compares two objects for equality.
- Parameters:
- {Object} obj1
- First of two objects to compare.
- {Object} obj2
- Second of two objects to compare.
<static>
{Boolean}
finesse.utilities.Utilities.isArray(obj)
Takes an Object and determines whether it is an Array or not.
- Parameters:
- {Object} obj
- The Object in question
- Returns:
- {Boolean} true if the object is an Array, else false.
<static>
{String}
finesse.utilities.Utilities.removeSpaces(string)
Takes a string and removes any spaces within the string.
- Parameters:
- {String} string
- The string to remove spaces from
- Returns:
- {String} The string without spaces
<static>
{String}
finesse.utilities.Utilities.trim(str)
Trims leading and trailing whitespace from a string.
- Parameters:
- {String} str
- The string to trim
- Returns:
- {String} The trimmed string
<static>
{Function}
finesse.utilities.Utilities.validateHandler(handler)
Returns the passed in handler, if it is a function.
- Parameters:
- {Function} handler
- The handler to validate
- Throws:
- Error If the handler provided is invalid
- Returns:
- {Function} The provided handler if it is valid