AMI Web Framework API > Namespace > amiWebApp
amiWebApp
The AMI webapp subsystem
Methods
start(options) ->{AMIWebApp}
Starts the Web application
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| options | Object.<string, *> | dictionary of optional parameters (logo_url, background_url, sign_in_image_url, home_url, contact_email, about_url, default_theme_url, dashboard_theme_url, locker_url, endpoint_url, sso_auto_authentication, sso_authentication_allowed, password_authentication_allowed, certificate_authentication_allowed, sign_out_allowed, create_account_allowed, change_info_allowed, change_password_allowed, change_certificate_allowed, captcha_allowed, bookmarks_allowed, dashboards_allowed) | {} | ✓ |
Returns:
Type: AMIWebApp
_internal_then(deferred, doneCallback, failCallback)
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| deferred | $.Deferred | ||||
| doneCallback | function | ||||
| failCallback | function |
_internal_always(deferred, alwaysCallback)
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| deferred | $.Deferred | ||||
| alwaysCallback | function |
typeOf(x) ->{string}
Gets the type name of the given object
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| x | * | the object |
Returns:
The type name of the given object
Type: string
asArray(x) ->{Array.<*>}
Turns the given object into an array if it is not already the case
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| x | * | the object |
Returns:
The resulting array
Type: Array.<*>
isString(x) ->{boolean}
Checks whether the given object is a string
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| x | * | the object |
Returns:
Type: boolean
isArray(x) ->{boolean}
Checks whether the given object is an array
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| x | * | the object |
Returns:
Type: boolean
isObject(x) ->{boolean}
Checks whether the given object is an object
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| x | * | the object |
Returns:
Type: boolean
isSet(x) ->{boolean}
Checks whether the given object is a set
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| x | * | the object |
Returns:
Type: boolean
isMap(x) ->{boolean}
Checks whether the given object is a map
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| x | * | the object |
Returns:
Type: boolean
setup(optionNames, optionDefaults, options) ->{Array.<*>}
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| optionNames | Array.<string> | ||||
| optionDefaults | Array.<*> | ||||
| options | Object.<string, *> |
Returns:
Type: Array.<*>
lock()
Locks the Web application
unlock()
Unlocks the Web application
modalEnter()
Enter the modal window
modalLeave()
Leave the modal window
canLeave(canLeave)
Specifies whether leaving the current page must be confirmed or not
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| canLeave |
error(message, fadeOut)
Shows an 'error' message
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| message | stringArray.<string> | the message | |||
| fadeOut | boolean | if True, the message disappears after 60s | ✓ |
info(message, fadeOut)
Shows an 'info' message
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| message | stringArray.<string> | the message | |||
| fadeOut | boolean | if True, the message disappears after 60s | ✓ |
success(message, fadeOut)
Shows a 'success' message
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| message | stringArray.<string> | the message | |||
| fadeOut | boolean | if True, the message disappears after 60s | ✓ |
warning(message, fadeOut)
Shows a 'warning' message
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| message | stringArray.<string> | the message | |||
| fadeOut | boolean | if True, the message disappears after 60s | ✓ |
flush()
Flushes messages
base64Encode(s) ->{string}
Encodes the given string to base64
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the decoded string |
Returns:
The encoded string
Type: string
base64Decode(s) ->{string}
Decodes the given string from base64
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the encoded string |
Returns:
The decoded string
Type: string
textToHtml(s) ->{string}
Escapes the given string from text to HTML
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the unescaped string |
Returns:
The escaped string
Type: string
htmlToText(s) ->{string}
Unescapes the given string from HTML to text
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the escaped string |
Returns:
The unescaped string
Type: string
textToString(s) ->{string}
Escapes the given string from text to JavaScript string
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the unescaped string |
Returns:
The escaped string
Type: string
stringToText(s) ->{string}
Unescapes the given string from JavaScript string to text
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the escaped string |
Returns:
The unescaped string
Type: string
htmlToString(s) ->{string}
Escapes the given string from HTML to JavaScript string
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the unescaped string |
Returns:
The escaped string
Type: string
stringToHtml(s) ->{string}
Unescapes the given string from JavaScript string to HTML
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the escaped string |
Returns:
The unescaped string
Type: string
textToSQL(s) ->{string}
Escapes the given string from text to SQL
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the unescaped string |
Returns:
The escaped string
Type: string
sqlToText(s) ->{string}
Unescapes the given string from SQL to text
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| s | string | the escaped string |
Returns:
The unescaped string
Type: string
fillBreadcrumb(items)
Fills the main breadcrumb
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| items | Array.<string>string | the array of HTML formatted items |
replaceHTML(selector, twig, options) ->{$.Promise}
Puts a HTML or TWIG fragment to the given target
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| selector | string | the target selector | |||
| twig | string | the TWIG fragment | {} | ✓ | |
| options | Object.<string, *> | dictionary of optional parameters (context, scope, dict, twigs) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
prependHTML(selector, twig, options) ->{$.Promise}
Prepends a HTML or TWIG fragment to the given target
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| selector | string | the target selector | |||
| twig | string | the TWIG fragment | {} | ✓ | |
| options | Object.<string, *> | dictionary of optional parameters (context, scope, dict, twigs) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
appendHTML(selector, twig, options) ->{$.Promise}
Appends a HTML or TWIG fragment to the given target
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| selector | string | the target selector | |||
| twig | string | the TWIG fragment | {} | ✓ | |
| options | Object.<string, *> | dictionary of optional parameters (context, scope, dict, twigs) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
parentHTML(selector, twig, options) ->{$.Promise}
Puts a HTML or TWIG fragment to the given target
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| selector | string | the target selector | |||
| twig | string | the TWIG fragment | {} | ✓ | |
| options | Object.<string, *> | dictionary of optional parameters (context, scope, dict, twigs) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
formatTWIG(twig, dict, twigs) ->{string}
Interprets the given TWIG string
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| twig | string | the TWIG string | |||
| dict | Object.<string, *>Array.<Object.<string, *>> | the dictionary | {} | ✓ | |
| twigs | Object.<string, string> | dictionary of fragments | {} | ✓ |
Returns:
The Interpreted TWIG string
Type: string
renderJSDoc(menuSelector, bodySelector, json) ->{AMIJSDoc}
Renders a AMI JSDoc documentation
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| menuSelector | string | selector of the menu div | |||
| bodySelector | string | selector of the body div | |||
| json | object | the JSON documentation |
Returns:
Type: AMIJSDoc
loadResources(urls, options) ->{$.Promise}
Asynchronously loads resources by file extension
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| urls | Array.<string>string | the array of urls | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadSheets(urls, options) ->{$.Promise}
Asynchronously loads CSS sheets
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| urls | Array.<string>string | the array of urls | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadScripts(urls, options) ->{$.Promise}
Asynchronously loads JS scripts
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| urls | Array.<string>string | the array of urls | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadJSONs(urls, options) ->{$.Promise}
Asynchronously loads JSON files
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| urls | Array.<string>string | the array of urls | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadXMLs(urls, options) ->{$.Promise}
Asynchronously loads XML files
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| urls | Array.<string>string | the array of urls | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadHTMLs(urls, options) ->{$.Promise}
Asynchronously loads HTML files
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| urls | Array.<string>string | the array of urls | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadTWIGs(urls, options) ->{$.Promise}
Asynchronously loads TWIG files
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| urls | Array.<string>string | the array of urls | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadTexts(urls, options) ->{$.Promise}
Asynchronously loads text files
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| urls | Array.<string>string | the array of urls | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadSubApp(subapp, userdatanull, options) ->{$.Promise}
Asynchronously loads a subapp
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| subapp | string | the subapp name | |||
| userdata | * | the user data | ✓ | ✓ | |
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadSubAppByURL(defaultSubApp, defaultUserDatanull) ->{$.Promise}
Asynchronously loads a subapp by URL
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| defaultSubApp | string | if 'amiRouter.getArgs()["subapp"]' is null, the default subapp name | |||
| defaultUserData | * | if 'amiRouter.getArgs()["userdata"]' is null, the default user data | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
loadControl(control, options) ->{$.Promise}
Asynchronously loads a control
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| control | string | the control name | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
createControl(parentnull, ownernull, control, params, options) ->{$.Promise}
Asynchronously creates a control
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| parent | * | the parent entity | ✓ | ||
| owner | * | the owner entity | ✓ | ||
| control | string | the control name | |||
| params | Array.<*> | the control's parameters | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
createControlInBody(parentnull, ownernull, control, controlParams, controlOptions, ownerOptions, options) ->{$.Promise}
Asynchronously creates a control in the body
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| parent | * | the parent entity | ✓ | ||
| owner | * | the owner entity | ✓ | ||
| control | string | the control name | |||
| controlParams | Array.<*> | the control's render method mandatory parameters | |||
| controlOptions | Object.<string, *> | the control's render method optional parameters | |||
| ownerOptions | Object.<string, *> | the owner's optional parameters | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
createControlInContainer(parentnull, ownernull, control, controlParams, controlOptions, ownerOptions, icon, title, options) ->{$.Promise}
Asynchronously creates a control in a container
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| parent | * | the parent entity | ✓ | ||
| owner | * | the owner entity | ✓ | ||
| control | string | the control name | |||
| controlParams | Array.<*> | the control's render method mandatory parameters | |||
| controlOptions | Object.<string, *> | the control's render method optional parameters | |||
| ownerOptions | Object.<string, *> | the owner's optional parameters | |||
| icon | string | the icon | |||
| title | string | the title | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise
createControlFromWebLink(parentnull, ownernull, el, ownerOptions, options) ->{$.Promise}
Asynchronously creates a control in a container from a WEB link
Parameters:
| Name | Type | Description | Default | Optional | Nullable |
|---|---|---|---|---|---|
| parent | * | the parent entity | ✓ | ||
| owner | * | the owner entity | ✓ | ||
| el | Element | the HTML element | |||
| ownerOptions | Object.<string, *> | the owner's optional parameters | |||
| options | Object.<string, *> | dictionary of optional parameters (context, cache) | {} | ✓ |
Returns:
A JQuery promise object
Type: $.Promise