AMI Web Framework API > Namespace > amiWebApp


amiWebApp

The AMI webapp subsystem

Methods


start(options) ->{AMIWebApp}
Starts the Web application

Parameters:
NameTypeDescriptionDefaultOptionalNullable
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
deferred$.Deferred
doneCallbackfunction
failCallbackfunction

_internal_always(deferred, alwaysCallback)

Parameters:
NameTypeDescriptionDefaultOptionalNullable
deferred$.Deferred
alwaysCallbackfunction

typeOf(x) ->{string}
Gets the type name of the given object

Parameters:
NameTypeDescriptionDefaultOptionalNullable
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:
NameTypeDescriptionDefaultOptionalNullable
x*the object
Returns:
The resulting array
Type: Array.<*>

isString(x) ->{boolean}
Checks whether the given object is a string

Parameters:
NameTypeDescriptionDefaultOptionalNullable
x*the object
Returns:
Type: boolean

isArray(x) ->{boolean}
Checks whether the given object is an array

Parameters:
NameTypeDescriptionDefaultOptionalNullable
x*the object
Returns:
Type: boolean

isObject(x) ->{boolean}
Checks whether the given object is an object

Parameters:
NameTypeDescriptionDefaultOptionalNullable
x*the object
Returns:
Type: boolean

isSet(x) ->{boolean}
Checks whether the given object is a set

Parameters:
NameTypeDescriptionDefaultOptionalNullable
x*the object
Returns:
Type: boolean

isMap(x) ->{boolean}
Checks whether the given object is a map

Parameters:
NameTypeDescriptionDefaultOptionalNullable
x*the object
Returns:
Type: boolean

setup(optionNames, optionDefaults, options) ->{Array.<*>}

Parameters:
NameTypeDescriptionDefaultOptionalNullable
optionNamesArray.<string>
optionDefaultsArray.<*>
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
canLeave

error(message, fadeOut)
Shows an 'error' message

Parameters:
NameTypeDescriptionDefaultOptionalNullable
messagestringArray.<string>the message
fadeOutbooleanif True, the message disappears after 60s

info(message, fadeOut)
Shows an 'info' message

Parameters:
NameTypeDescriptionDefaultOptionalNullable
messagestringArray.<string>the message
fadeOutbooleanif True, the message disappears after 60s

success(message, fadeOut)
Shows a 'success' message

Parameters:
NameTypeDescriptionDefaultOptionalNullable
messagestringArray.<string>the message
fadeOutbooleanif True, the message disappears after 60s

warning(message, fadeOut)
Shows a 'warning' message

Parameters:
NameTypeDescriptionDefaultOptionalNullable
messagestringArray.<string>the message
fadeOutbooleanif True, the message disappears after 60s

flush()
Flushes messages


base64Encode(s) ->{string}
Encodes the given string to base64

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe decoded string
Returns:
The encoded string
Type: string

base64Decode(s) ->{string}
Decodes the given string from base64

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe encoded string
Returns:
The decoded string
Type: string

textToHtml(s) ->{string}
Escapes the given string from text to HTML

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe unescaped string
Returns:
The escaped string
Type: string

htmlToText(s) ->{string}
Unescapes the given string from HTML to text

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe escaped string
Returns:
The unescaped string
Type: string

textToString(s) ->{string}
Escapes the given string from text to JavaScript string

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe unescaped string
Returns:
The escaped string
Type: string

stringToText(s) ->{string}
Unescapes the given string from JavaScript string to text

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe escaped string
Returns:
The unescaped string
Type: string

htmlToString(s) ->{string}
Escapes the given string from HTML to JavaScript string

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe unescaped string
Returns:
The escaped string
Type: string

stringToHtml(s) ->{string}
Unescapes the given string from JavaScript string to HTML

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe escaped string
Returns:
The unescaped string
Type: string

textToSQL(s) ->{string}
Escapes the given string from text to SQL

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe unescaped string
Returns:
The escaped string
Type: string

sqlToText(s) ->{string}
Unescapes the given string from SQL to text

Parameters:
NameTypeDescriptionDefaultOptionalNullable
sstringthe escaped string
Returns:
The unescaped string
Type: string

fillBreadcrumb(items)
Fills the main breadcrumb

Parameters:
NameTypeDescriptionDefaultOptionalNullable
itemsArray.<string>stringthe array of HTML formatted items

replaceHTML(selector, twig, options) ->{$.Promise}
Puts a HTML or TWIG fragment to the given target

Parameters:
NameTypeDescriptionDefaultOptionalNullable
selectorstringthe target selector
twigstringthe TWIG fragment{}
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
selectorstringthe target selector
twigstringthe TWIG fragment{}
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
selectorstringthe target selector
twigstringthe TWIG fragment{}
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
selectorstringthe target selector
twigstringthe TWIG fragment{}
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
twigstringthe TWIG string
dictObject.<string, *>Array.<Object.<string, *>>the dictionary{}
twigsObject.<string, string>dictionary of fragments{}
Returns:
The Interpreted TWIG string
Type: string

renderJSDoc(menuSelector, bodySelector, json) ->{AMIJSDoc}
Renders a AMI JSDoc documentation

Parameters:
NameTypeDescriptionDefaultOptionalNullable
menuSelectorstringselector of the menu div
bodySelectorstringselector of the body div
jsonobjectthe JSON documentation
Returns:
Type: AMIJSDoc

loadResources(urls, options) ->{$.Promise}
Asynchronously loads resources by file extension

Parameters:
NameTypeDescriptionDefaultOptionalNullable
urlsArray.<string>stringthe array of urls
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise

loadSheets(urls, options) ->{$.Promise}
Asynchronously loads CSS sheets

Parameters:
NameTypeDescriptionDefaultOptionalNullable
urlsArray.<string>stringthe array of urls
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise

loadScripts(urls, options) ->{$.Promise}
Asynchronously loads JS scripts

Parameters:
NameTypeDescriptionDefaultOptionalNullable
urlsArray.<string>stringthe array of urls
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise

loadJSONs(urls, options) ->{$.Promise}
Asynchronously loads JSON files

Parameters:
NameTypeDescriptionDefaultOptionalNullable
urlsArray.<string>stringthe array of urls
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise

loadXMLs(urls, options) ->{$.Promise}
Asynchronously loads XML files

Parameters:
NameTypeDescriptionDefaultOptionalNullable
urlsArray.<string>stringthe array of urls
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise

loadHTMLs(urls, options) ->{$.Promise}
Asynchronously loads HTML files

Parameters:
NameTypeDescriptionDefaultOptionalNullable
urlsArray.<string>stringthe array of urls
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise

loadTWIGs(urls, options) ->{$.Promise}
Asynchronously loads TWIG files

Parameters:
NameTypeDescriptionDefaultOptionalNullable
urlsArray.<string>stringthe array of urls
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise

loadTexts(urls, options) ->{$.Promise}
Asynchronously loads text files

Parameters:
NameTypeDescriptionDefaultOptionalNullable
urlsArray.<string>stringthe array of urls
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise

loadSubApp(subapp, userdatanull, options) ->{$.Promise}
Asynchronously loads a subapp

Parameters:
NameTypeDescriptionDefaultOptionalNullable
subappstringthe subapp name
userdata*the user data
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
defaultSubAppstringif '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:
NameTypeDescriptionDefaultOptionalNullable
controlstringthe control name
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
parent*the parent entity
owner*the owner entity
controlstringthe control name
paramsArray.<*>the control's parameters
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
parent*the parent entity
owner*the owner entity
controlstringthe control name
controlParamsArray.<*>the control's render method mandatory parameters
controlOptionsObject.<string, *>the control's render method optional parameters
ownerOptionsObject.<string, *>the owner's optional parameters
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
parent*the parent entity
owner*the owner entity
controlstringthe control name
controlParamsArray.<*>the control's render method mandatory parameters
controlOptionsObject.<string, *>the control's render method optional parameters
ownerOptionsObject.<string, *>the owner's optional parameters
iconstringthe icon
titlestringthe title
optionsObject.<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:
NameTypeDescriptionDefaultOptionalNullable
parent*the parent entity
owner*the owner entity
elElementthe HTML element
ownerOptionsObject.<string, *>the owner's optional parameters
optionsObject.<string, *>dictionary of optional parameters (context, cache){}
Returns:
A JQuery promise object
Type: $.Promise