This file contains the General Functions javascript namespace.
It contains functions that apply both on the front and back
end of the application.
- Source:
Members
(static) EXCEPTIONS_TITLE
General Functions Constants
- Source:
Methods
(static) centerElementOnPage(elementHandle)
This method centers a DOM element vertically and horizontally
on the page.
Parameters:
Name | Type | Description |
---|---|---|
elementHandle |
object | The object that is going to be centered. |
- Source:
(static) clone(originalObject) → {object}
This method creates and returns an exact copy of the provided object.
It is very usefull whenever changes need to be made to an object without
modyfing the original data.
Parameters:
Name | Type | Description |
---|---|---|
originalObject |
object | Object to be copied. |
- Source:
Returns:
Returns an exact copy of the provided element.
- Type
- object
(static) displayMessageBox(title, message, messageButtons)
This functions displays a message box in
the admin array. It is usefull when user
decisions or verifications are needed.
Parameters:
Name | Type | Description |
---|---|---|
title |
string | The title of the message box. |
message |
string | The message of the dialog. |
messageButtons |
array | Contains the dialog buttons along with their functions. |
- Source:
(static) enableLanguageSelection($element)
Enables the language selection functionality. Must be called on every page has a
language selection button. This method requires the global variable 'availableLanguages'
to be initialized before the execution.
Parameters:
Name | Type | Description |
---|---|---|
$element |
object | Selected element button for the language selection. |
- Source:
(static) exceptionsToHtml(exceptions) → {string}
This method returns the exception html display for javascript ajax calls.
It uses the Bootstrap collapse module to show exception messages when the
user opens the "Details" collapse component.
Parameters:
Name | Type | Description |
---|---|---|
exceptions |
array | Contains the exceptions to be displayed. |
- Source:
Returns:
Returns the html markup for the exceptions.
- Type
- string
(static) getUrlParameter(url, name) → {String}
This function retrieves a parameter from a "GET" formed url.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The selected url. |
name |
string | The parameter name. |
- Source:
Returns:
Returns the parameter value.
- Type
- String
(static) handleAjaxExceptions(response) → {bool}
All backend js code has the same way of dislaying exceptions that are raised on the
server during an ajax call.
Parameters:
Name | Type | Description |
---|---|---|
response |
object | Contains the server response. If exceptions or warnings are found, user friendly messages are going to be displayed to the user. |
- Source:
Returns:
Returns whether the the ajax callback should continue the execution or
stop, due to critical server exceptions.
- Type
- bool
(static) ISODateString(dt) → {String}
This function creates a RFC 3339 date string. This string is needed
by the Google Calendar API in order to pass dates as parameters.
Parameters:
Name | Type | Description |
---|---|---|
dt |
date | The given date that will be transformed |
- Source:
Returns:
Returns the transformed string.
- Type
- String
(static) parseExceptions(exceptions) → {array}
This method parse the json encoded strings that are fetched by ajax calls.
Parameters:
Name | Type | Description |
---|---|---|
exceptions |
array | Exception array returned by an ajax call. |
- Source:
Returns:
Returns the parsed js objects.
- Type
- array
(static) ucaseFirstLetter(str) → {string}
Makes the first letter of the string upper case.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The string to be converted. |
- Source:
Returns:
Returns the capitalized string.
- Type
- string
(static) validateEmail(email) → {bool}
This method validates an email address. If the address is not on the proper
form then the result is FALSE.
Parameters:
Name | Type | Description |
---|---|---|
email |
string | The email address to be checked. |
- Source:
Returns:
Returns the validation result.
- Type
- bool