Engine

Simplicite.UI. Engine

new Engine()

Main UI Controller with abstract view to display components.

  • Controller implements the UI logic with interactions between components (list, form, menu...) and the data (ajax).
  • It does not contain UI drawing and must load the view service to display controls.
  • Each View engine implements the UI interfaces (without data access) and interacts with the controller (to access to data).

Members

FILE_ICONS

Common file extension icon

grant

User rights

KEYS

Common key codes

  • BACKSPACE
  • TAB
  • ENTER
  • SHIFT
  • CTRL
  • ALT
  • PAUSE
  • CAPS_LOCK
  • ESCAPE
  • PAGE_UP
  • PAGE_DOWN
  • END
  • HOME
  • LEFT_ARROW
  • UP_ARROW
  • RIGHT_ARROW
  • DOWN_ARROW
  • INSERT
  • DELETE

MEDIA_SIZE

Media sizes (XS=576, SM=768, MD=992, LG=1200) mobile | tablet | medium | large

MIME_EXT

Mime type to file extension

options

global options: merge of the launch parameters with Simplicite.UI.Globals

screenSize

Current screen size {w,h}

view

View: main renderer

Methods

addLocalLogin(g)

Add the connected login to local storage

Parameters:
Name Type Description
g Object

grant

addShortcuts(keys)

Add keys shortcuts to document

Parameters:
Name Type Description
keys Object

Pair of ('ctrl' | 'shift' | 'alt') + letter or char-code = callback or shortcut definition

alert(params)

Alert dialog box

Parameters:
Name Type Description
params string | Object

Message or object with:

Properties
Name Type Description
name string

Optional name

title string

Optional title, default "ALERT"

type string

Optional 'error|danger|warning|info'

content string | jQuery

Optional alert body

help string | jQuery

Optional help

onOk function

Optional callback on "OK" button

dontAskAgain string

Use the 'dont't ask again' local storage (true=keep user's action or string=forced response), needs a name

toast boolean

True to display a toast instead a dialog

modal boolean

True to display a modal dialog

applyConstraints(ctn, obj, elt, index, context, cbk)

Apply constraints

Parameters:
Name Type Description
ctn jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object

elt string

Optional DOM element (input, select, textarea) with data {field, index}

index string

Optional editlist line index (row Id or creation index 00 01...)

context number

Optional context (default Simplicite.CONTEXT_UPDATE)

cbk function

Optional callback

backendException(msg)

Back-end exception

Parameters:
Name Type Description
msg string | Object | Array

Simple text or { level, message or messages }, or first item of array

backendMessage(msg, toast, title)

Back-end message(s)

Parameters:
Name Type Description
msg string | Object | Array

Plain text / encoded message (code:text#level) / object { code, level, text, label } / or array of messages

toast boolean

True to display a toast instead a dialog box

title string

Optional title

backendMessages(msg)

Back-end messages in a single dialog

Parameters:
Name Type Description
msg Object

Array of backend messages per rowId

bind(name, fn)

Bind one UI action with implementation

Parameters:
Name Type Description
name string

action name

fn function

handler

bindChange(ctn, obj, selector)

Attach change event to fields

  • set the hasChanged on object
  • apply related constraints
  • exclude elements with class js-ignore-haschanged
Parameters:
Name Type Description
ctn jQuery

Container of inputs, selects and textareas

obj Simplicite.Ajax.BusinessObject | Simplicite.Ajax.BusinessProcess

Object or Process

selector string

Optional selector (default: input, select and textarea)

bindEnabled(name, enable)

Enable action binding

Parameters:
Name Type Description
name string

Action name

enable boolean

True to activate / false to disable binding

bindGenericActions()

Bind generic actions (create, copy, delete...)

bindSaveAndQuit(ctn, obj, p, save)

Manage the save and close when fields have changed

Parameters:
Name Type Description
ctn jQuery

Container

obj Simplicite.Ajax.BusinessObject | Simplicite.Ajax.BusinessProcess

Object or Process

p Object

Parameters { msg, msgRow }

save function

Save handler

canCloseContent(ctn, cbk)

Checks if the content can close

Parameters:
Name Type Description
ctn jQuery

Container

cbk function

Callback if the content can close

changeLang(lang, pref)

Change user's language on server side and reload the page

Parameters:
Name Type Description
lang string

Language FRA, ENU...

pref boolean

true to update also the preferred language

clearCache(action)

System clear cache

Parameters:
Name Type Description
action string

Action cc|dc|gc for server, all sessions or granted user

clickDocument(doc)

Click on a document: open the document

Parameters:
Name Type Description
doc Object

Document data

Properties
Name Type Description
object Object

Object name

field Object

Document field name

rowId Object

Row ID

docId Object

Document ID

name Object

Document name

clickImage(doc)

Click on image: default open a dialog with the image

Parameters:
Name Type Description
doc Object

Image data

Properties
Name Type Description
object Object

Object name

field Object

Document field name

rowId Object

Row ID

docId Object

Image ID

name Object

Image name

clickMenu(item)

Main menu handler

Parameters:
Name Type Description
item Object

Menu item

Properties
Name Type Description
label string

Displayed label

object string

Optional object name

state string

Optional object state filter

search string

Optional search mode: list, dock or dialog

workflow string

Optional screenflow name

process string

Optional process name

step string

Optional step filter

bam string

Optional object name for metrics view

tray string

Optional object name for trays view

domain string

Optional domain home

view string

Optional view name

href string

Optional URL

target string

Optional href target

clickShortcut(item)

Shortcut handler

Parameters:
Name Type Description
item

Item { name, url, target, label }

closeForm(ctn)

Close the object form: default going back in navigation

Parameters:
Name Type Description
ctn jQuery

Container

compat(w)

Complete globals in window.Simplicite

Parameters:
Name Type Description
w Object

Optional window to init

confirm(params)

Confirm dialog box

Parameters:
Name Type Description
params string | Object

Message or object with:

Properties
Name Type Description
name string

Optional name

title string

Optional title, default: 'CONFIRM'

content string | jQuery

Optional alert body

help string | jQuery

Optional help

onOk function

Optional callback on "OK" button

onCancel function

Optional callback on "CANCEL" button

dontAskAgain string

Use the 'dont't ask again' local storage (true=keep user's action or string=forced response), needs a name

contentLoaded(ctn, onload, onunload, params)

Prepare content handlers

Parameters:
Name Type Description
ctn jQuery

Container

onload function

Optional load handler

onunload function

Optional unload handler

params boolean

Optional context parameters

copyToClipboard(text, silent)

Copy a text to clipboard

Parameters:
Name Type Description
text string

Text to copy

silent boolean

True to hide the toast

countList(ctn, obj, options, cbk)

Count rows with context and filters

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Name or Business Object

options Simplicite.UI.Globals.list

Options to override Globals

cbk function

Optional callback(obj) to read obj.count

countReference(obj, parent, cbk)

Count references of a parent object in PANELLIST context

Parameters:
Name Type Description
obj string

Referenced object name or business object

parent Object

Specify the parent object and the foreign-key { name, inst, field, rowId }

cbk function

Callback(obj, count)

createReference(ctn, obj, ref, index)

Create an object in a dialog

Parameters:
Name Type Description
ctn string | jQuery

Parent container to populate

obj string | Simplicite.Ajax.BusinessObject

Object

ref string | Simplicite.Ajax.ObjectField

Referenced field or FK itself

index string

Optional row index (edit list)

datamapCompletion(ctn, obj, field, index, sel, disp)

Datamap completion

Parameters:
Name Type Description
ctn jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object

field string | Simplicite.Ajax.ObjectField

Referenced field

index string

Optional row index (edit list)

sel function

Optional select item callback(item)

disp function

Optional display item callback(item, ref)

decodeImage(buffer, {function)

Convert bytes to Image (supports gif, png and jpeg)

Parameters:
Name Type Description
buffer Array

Image as bytes

{function

onload Optional callback

detachURL(url, options)

Open the url in a separate window with the UI engine

Parameters:
Name Type Description
url string

URL to load in a new window

options Object

Detach options

Properties
Name Type Attributes Default Description
name string <optional>
detachurl

Optional window name

width number <optional>
1200

Optional window width in px

height number <optional>
700

Optional window height in px

top number <optional>
0

Optional window top in px

left number <optional>
0

Optional window left in px (default 0)

full boolean

True to load the main parts (menu, header... default load the URL in div.main without parts)

Returns:

new window

dispatchMessages(messages, obj)

Set visible field messages and returns other/head messages

Parameters:
Name Type Description
messages Array.<string> | Array.<Object>

Backend messages code:text#level[#field] (or json object)

obj Simplicite.Ajax.BusinessObject

Optional object to affect message when #field matches

displayAssociate(ctn, obj, def)

Bulk association between objects

Parameters:
Name Type Description
ctn string | jQuery

Parent container

obj Simplicite.Ajax.BusinessObject

Object from panel instance

def Object

Associate definition

Properties
Name Type Description
parent string

Parent object name

parentRefField string

Foreign key field to parent

child string

Optional child object name (when obj is a N,N relationship)

childRefField string

Foreign key field to child

displayCalendar(ctn, obj, agenda, params, cbk)

Calendar rendering

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Name or Business object

agenda string

Agenda name

params Object

Options

cbk function

Optional callback

displayColorPicker(ctn, input, dropdown, cbk)

Color picker

Parameters:
Name Type Description
ctn string | jQuery

Container

input string | jQuery

Element to receive selected color as #RRGGBB

dropdown boolean

Displays as dropdown or dialog box

cbk function

Optional callback(color,valid)

displayCompletion(ctn, obj, field, index, req, cbk)

Field completion on field

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Object or name

field string | Simplicite.Ajax.ObjectField

Field or name

index string

Optional row index (edit list)

req string

User request

cbk function

Callback with search result

displayCrosstab(ctn, obj, name, options, cbk)

Crosstab

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Name or Object

name string

Crosstab name

options Object

Options { inst, filters, options, nav, showNav }

Properties
Name Type Description
inst string

Instance of object

filters Object

Optional filters to limit crosstab data

options Object

Optional crosstab options { zstotal, zstcolor, zcaption, ztable, zgraph... }

cbk function

Optional callback

displayEditor(ctn, options, cbk)

Code editor

Parameters:
Name Type Description
ctn jQuery

Container

options Object

Optional parameters { showNav, nav }

cbk function

Optional callback

displayExport(ctn, obj, rowId)

Display the export dialog and get exported data

Parameters:
Name Type Description
ctn jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object or name

rowId string

Optional row ID to export only one record

displayFeedback()

User feedback

displayForm(ctn, obj, rowId, options, cbk)

Build a form with the object item

Parameters:
Name Type Description
ctn string | jQuery

Target container

obj string | Simplicite.Ajax.BusinessObject

Object

rowId string

Row ID to get

options Simplicite.UI.Globals.form

Options to override globals

cbk function

Optional callback(obj, params)

displayGantt(ctn, obj, ts, options, cbk)

Gantt diagram based on timesheet data

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Assignment object

ts String

Timesheet name

options Object

Options

cbk function

Optional callback

displayHelp(ctn, obj)

Object help: call the help service and open a dialog

Parameters:
Name Type Description
ctn string | jQuery

Parent container

obj Simplicite.Ajax.BusinessObject

Object

displayHome(ctn, options, cbk)

Home page

Parameters:
Name Type Description
ctn string | jQuery

Container

options Object

Options { nav, showNav }

cbk function

Optional callback

displayImportCSV(ctn)

Manage import CSV thru UI

Parameters:
Name Type Description
ctn string | jQuery

Optional container

displayImportXML(ctn)

Manage import XML thru UI

Parameters:
Name Type Description
ctn string | jQuery

Optional container

displayIndex(ctn, options, cbk)

Index search form

Parameters:
Name Type Description
ctn string | jQuery

Container

options Object

Options

Properties
Name Type Description
title string

Search title, the request by default

nav string

'add' or 'new' (default)

showNav boolean

Display the navigation railway, default true

object string

Optional business object to limit search

domain string

Optional domain search

cbk function

Optional callback

displayIndexSearch(ctn, req, options, cbk)

Index search result

Parameters:
Name Type Description
ctn string | jQuery

Container

req string

User request (see Simplicite.Ajax.indexsearch service)

options Object

Options { object, nav, showNav }

cbk function

Optional callback

displayIndexSearchDocs(ctn, req, list, options)

Index search in documents

Parameters:
Name Type Description
ctn string | jQuery

Container for result

req string

User request

list Array.<string>

Array of objects with documents

options Object

Options { object, nav, showNav }

displayIndexSearchDomain(ctn, domain, all, options)

Index search in domain

Parameters:
Name Type Description
ctn string | jQuery

Container for result

domain string

Domain name

all boolean

False to limit search to objects updated by the user

options Object

Options { object, nav, showNav }

displayIndexSearchSession(ctn)

Session index

Parameters:
Name Type Description
ctn string | jQuery

Container for result

displayList(ctn, obj, options, cbk)

Build a list with the object search

Parameters:
Name Type Description
ctn string | jQuery

Target container

obj string | Simplicite.Ajax.BusinessObject

Name or Business Object

options Simplicite.UI.Globals.list

Options to override Globals

cbk function

Optional callback

displayLogs(ctn, {string, {string)

Show server logs thru web-socket. Useful when UI has no console.

Parameters:
Name Type Description
ctn string | jQuery

Optional container to split (default is #work)

{string

action start|stop

{string

pos - Optional position left|right|top|bottom (default)

displayMerge(ctn, obj, options, cbk)

Merge object

Parameters:
Name Type Description
ctn string | jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object with merge access

options Object

Options { ids }

Properties
Name Type Description
ids Array

Optional list of ids to merge (use selected rows if unset)

cbk function

Optional callback

displayModeler(ctn, modelId, options)

Load and display the modeler

Parameters:
Name Type Description
ctn string | jQuery

Container

modelId string

Model row ID

options Object

Options { svg, docked, popup }

displayModuleDelete(ctn, moduleId)

Display the delete module screen

Parameters:
Name Type Description
ctn string | jQuery

Container

moduleId string

module row Id

displayMonitoring(params, cbk)

UI Monitoring

Parameters:
Name Type Description
params Object

Options

Properties
Name Type Description
docked boolean

Dock monitoring on bottom

tabIndex number

Tab to focus

cbk function

Optional callback

displayPlaceMap(ctn, params, cbk)

Placemap service

Parameters:
Name Type Description
ctn string | jQuery

Container to append the map

params Object

Static image { lat, lng, width, height } or dynamic placemap { object, inst, name, nav }

cbk function

Optional callback when the map is loaded

displayPreferences(ctn, obj)

Object preferences

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Name or Business Object

displayPrint(ctn, name, obj, rowId, cbk)

Display a print/publication

Parameters:
Name Type Description
ctn string | jQuery

Optional container (_blank if null)

name string

Print name

obj Simplicite.Ajax.BusinessObject

Object

rowId string

Optional row ID

cbk function

Optional callback

displayReferenceList(ctn, obj, params)

Display referenced object as panel list or pillbox

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Referenced object or name

params Simplicite.UI.Globals.list

List options + parent object + link metadata

Properties
Name Type Description
parent Object

Parent object { name, inst, field, rowId, object }

link Object

Optional link metadata with { child, childfk, rendering }

displayReferencePillbox(ctn, o, params)

Display references in a pillbox control

Parameters:
Name Type Description
ctn string | jQuery

Container

o Simplicite.Ajax.BusinessObject

N,N object

params Simplicite.UI.Globals.list

Reference data

Properties
Name Type Description
parent Object

Parent object { name, inst, field, rowId, object }

link Object

Link metadata with child name and child foreign-key

read boolean

Read only?

title string

Optional link title (empty = no title)

displayRow(ctn, elt, obj, rowId, options, cbk)

Build a record of list

Parameters:
Name Type Description
ctn string | jQuery

Nav container

elt string | jQuery

row container (tr or div)

obj Simplicite.Ajax.BusinessObject

Object

rowId string

Object row Id

options Simplicite.UI.Globals.list

List options to override global row options

cbk function

Optional callback to chain something

displaySearch(ctn, obj, options, cbk)

Search form

Parameters:
Name Type Description
ctn string | jQuery

Parent container

obj string | Simplicite.Ajax.BusinessObject

Name or Business Object

options Simplicite.UI.Globals.search

Options to override Globals

cbk function

Optional callback

displaySocial(ctn, options, cbk)

Displays social posts

Parameters:
Name Type Description
ctn string | jQuery

Container

options Object

Social options

Properties
Name Type Description
object string

Optional object to limit search

rowId string

Optional object ID to limit search

activity boolean

True to display object activities

onpost function

Social service(item) to upsert post

ondel function

Social service(id) to delete post

onlist function

Social service(page,act) to search posts

onlike function

Social service(id,like) to (un)like a post

onfollow function

Follow service

embedded function

Default false = modal dialog

cbk function

Optional callback

displayStatusMetrics(ctn, obj, params, cbk)

Status metrics

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Name or Business object

params Object

Options

Properties
Name Type Description
fromDate string

From date search YYYY-MM-DD, default 1 week ago or obj.locals.ui.metrics.fromDate

toDate string

To date search YYYY-MM-DD, default today or obj.locals.ui.metrics.toDate

period string

Group by period: 1=hour, 2=day, 3=week, 4=month, 5=quarter, 6=semester, 7=year / default 2=day or obj.locals.ui.metrics.period

palette string

Palette name, default sysparam CHART_PALETTE or obj.locals.ui.metrics.palette

show Object

Options to show/hide elements (all visible by default)

Properties
Name Type Description
count boolean

Show the count per status?

duration boolean

Show the duration per status?

history boolean

Show the status history?

terminal boolean

Show the terminal status per duration?

palette boolean

Show palette picker?

statusColors boolean

Use the status colors in PIE?

period boolean | string

true|false or 'read'

fromDate boolean | string

true|false or 'read'

toDate boolean | string

true|false or 'read'

cbk function

Optional callback

displaySummary(ctn, obj, rowId, options, cbk)

Object summary

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Object

rowId string

Object row ID

options Object

Optional parameters

Properties
Name Type Description
inst string

Optional instance name

icon boolean

Display the object icon or image thumbnail, default true

image boolean

Display the object image if any, default true

label string

Optional label, default: object label

userKey string

Optional user key, default: object user key

fields Array.<Simplicite.Ajax.ObjectField>

Optional array of fields to display

onopen function

Optional handler on open, default: engine.openObject

actions Array.<Object>

Optional array of actions, default row actions

item Object

Optional object values

cbk function

Callback to chain

displaySysInfos(ctn, options)

System informations

Parameters:
Name Type Description
ctn string | jQuery

Container

options Object

Options { action, objdt, cache }

displayTemplate(ctn, obj, rowId)

Template editor

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string

ObjectInternal or View

rowId string

Object/view ID

displayTimesheet(ctn, obj, rowId, ts, options, cbk)

Timesheet of object

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Resource object 1 or 2, or panel instance of assign object

rowId String

Optional resource row ID

ts String

Timesheet name

options Object

Options

cbk function

Optional callback

displayTray(ctn, obj, field, options, cbk)

Trays based on a state model

Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Name or Business object

field string

Optional enum name (default is the status field)

options Object

Optional parameters

cbk function

Optional callback

displayTreeView(ctn, obj, rowId, name, options, cbk)

Display a tree view

Parameters:
Name Type Description
ctn string | jQuery

Optional container

obj Simplicite.Ajax.BusinessObject

Root object

rowId string

Row ID of the record

name string

Treeview name

options Object

Optional parameters { inst, depth, display, menu, docked, onOpen, addMenu, delMenu, onPage }

Properties
Name Type Description
inst string

optional instance name (default tree_ajax_[tvname]_[object])

depth number

Max deep search (default 2)

menu boolean

Add the tree in main menu (default open in container)

docked boolean

Open tree in left dock (default open in container)

display function

Optional to override default menu.treeview renderer

onOpen function

Optional open node handler function(n,cbk)

addMenu function

Optional add to menu handler

delMenu function

Optional remove from menu handler

onPage function

Optional add page handler

cbk function

Optional callback

displayUpdateForm(ctn, obj, options, cbk)

Build a form for bulk update

Parameters:
Name Type Description
ctn string | jQuery

Target container

obj string | Simplicite.Ajax.BusinessObject

Name or BusinessObject

options Object

See Globals.form

cbk function

Optional callback

displayUserFilters(ctn, options)

Display the user filters: date range and fields

Parameters:
Name Type Description
ctn string | jQuery

Optional container (dialog if null)

options Object

Options { bar }

displayView(ctn, view, options, cbk)

Display a view

Parameters:
Name Type Description
ctn string | jQuery

Container

view string | Object

View definition or name

options Object

View options

Properties
Name Type Description
home boolean

True on main/domain home view (to get home instance of objects)

parent Object

When view has a parent object

nav string

'new' or 'add'

showNav boolean

True to display the nav

beforeload function

Optional before load callback

onload function

Optional onload callback

onunload function

Optional unload callback

cbk function

Optional callback

displayWebNews(ctn, options)

Display the web news (user needs read access to WebNews)

Parameters:
Name Type Description
ctn string | jQuery

Container (in a dialog if undefined)

options Object

Optional parameters

Properties
Name Type Description
filters Object

Optional filters on WebNews

template string

Optional template (default Simplicite.UI.Globals.news.template)

popup boolean

true to get only news to display (on logon) in a modal dialog

ticker boolean

true to get only news to display on a footer ticker

displayWorkflow(ctn, wkf, action, options, cbk)

Workflow wrapper

Parameters:
Name Type Description
ctn string | jQuery

Container

wkf string | Simplicite.Ajax.BusinessProcess

Business process or name

action string

Action start|abort|lock|unlock|validate|cancel|back|list

options Object

Optional activity { step }

cbk function

Optional callback

doAction(a, obj, rowId)

Execute one action

Parameters:
Name Type Description
a Object

Action metadata

obj Simplicite.Ajax.BusinessObject

Business object

rowId string

Optional object row ID on form/row

doActionCustom(a, obj, rowId, values)

Execute a custom/backend action (object.action call) after saving the form

Parameters:
Name Type Description
a Object

Action metadata

obj Simplicite.Ajax.BusinessObject

Business object

rowId string

Optional object row ID on form/row

values Object

Optional confirm field values

doActionGeneric(a, obj, rowId)

Execute a generic/UI action (all binded implementations)

Parameters:
Name Type Description
a Object

Action metadata

obj Simplicite.Ajax.BusinessObject

Business object

rowId string

Optional object row ID on form/row

doActionModel()

Wrap "open model" actions

doActionURL(a, obj, rowId)

Wrap a backend URL action to front

Parameters:
Name Type Description
a Object

Action metadata

obj Simplicite.Ajax.BusinessObject

Business object

rowId string

Optional object row ID on form/row

error(msg)

Error dialog box

Parameters:
Name Type Description
msg string

Content

findAction(o, name, list, plus)

Find an action in plain or plus actions

Parameters:
Name Type Description
o Simplicite.Ajax.BusinessObject

Object

name string

Action name

list Array.<Object>

List of actions

plus Array.<Object>

List of 'plus' actions

firebase(data)

Firebase service wrapper

Parameters:
Name Type Description
data Object

Service data

Properties
Name Type Description
config Object

Init web browser to receive notifiction

token Object

Add the device token to FIREBASE_TOKENS on server side

tap Object

Incoming notification has been tapped by user?

body Object

Optional received message

title Object

Optional message title

from Object

Optional message origin

message Object

Message to send on server-side

to Object

Recipients { users:[], groups:[] } or 'all' users

fkCompletion(ctn, obj, field, index, sel, disp)

Foreign-key completion

Parameters:
Name Type Description
ctn jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object

field string | Simplicite.Ajax.ObjectField

Referenced field

index string

Optional row index (edit list)

sel function

Optional select item callback(item)

disp function

Optional display item callback(item, ref)

getAjax()

Current ajax session

Returns:

Simplicite.Ajax instance

getApp()

Current ajax session (alias to getAjax)

Returns:

Simplicite.Ajax instance

getFileIcon()

Get icon from the file name

getLocalLogins()

All logins from local storage

getNav(c)

Get container navigator, default returns the main navigation of #work area

Parameters:
Name Type Description
c string | jQuery

Component or selector

Returns:

Simplicite.UI.Navigator instance

getNavContainer(c)

Find the closest container with a navigator

Parameters:
Name Type Description
c string | jQuery

component

getNavInstanceName(c, obj, inst)

Generate the instance name within the component navigator. Returns the common instance name on main navigation, otherwise add a suffix ex: the_ajax_(name)_nav(id)

Parameters:
Name Type Description
c string | jQuery

Component

obj string | Simplicite.Ajax.BusinessObject

Object name or BusinessObject

inst string

Optional instance name, default = the_ajax_(name)

getNavObject(ctn, obj, inst, cbk, params)

Get a business object extended with UI abilities per container navigator

  • obj.metadata: object metadata with extended ObjectField
  • obj.ui: this UI engine shorthand
  • obj.locals.ui: copy of global UI options, to be changed per instance
  • optional editors: load Ace and/or Tinymce
  • optional web resources: STYLES and SCRIPT
  • optional UI constraints script
Parameters:
Name Type Description
ctn string | jQuery

Container

obj string | Simplicite.Ajax.BusinessObject

Object name or BusinessObject

inst string

Optional instance name, default is the_ajax_name to be managed as a Main and Ajax object on server side

cbk function

Callback function(obj) when loaded

params Object

Optional parameters to load metadata { container, context, contextParam, parent, error }

getTop()

Top Simplicite window

getUIAction(ctn, obj, action)

Gets the action with UIAction interface

Parameters:
Name Type Description
ctn string | jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object

action Object

Action metadata or name

getUIArea(ctn, obj, area)

Gets the area with UIArea interface

Parameters:
Name Type Description
ctn string | jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object

area Object

Area metadata or name or position

getUIField(ctn, obj, field, index, silent)

Gets the field extended with the UIField interface

Parameters:
Name Type Description
ctn string | jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object

field string | Simplicite.Ajax.ObjectField

Object field or name

index string

Optional for multiple inputs of the same field (edit list)

silent boolean

No trace when field is unknown

getUIObject(obj, inst, cbk, params)

Get a business object extended with UI abilities:

  • obj.metadata: object metadata with extended ObjectField
  • obj.ui: this UI engine shorthand
  • obj.locals.ui: copy of global UI options, to be changed per instance
  • optional editors: load Ace and/or Tinymce
  • optional web resources: STYLES and SCRIPT
  • optional UI constraints script
Parameters:
Name Type Description
obj string | Simplicite.Ajax.BusinessObject

Object name or BusinessObject

inst string

Optional instance name, default is the_ajax_name to be managed as a Main and Ajax object on server side

cbk function

Callback function(obj) when loaded

params Object

Optional parameters to load metadata { container, context, contextParam, parent, error }

getUIView(ctn, obj, view)

Gets the view with UIView interface

Parameters:
Name Type Description
ctn string | jQuery

Container

obj Simplicite.Ajax.BusinessObject

Optional object

view Object

View metadata or name

gotoDefinition(name, id)

Open one object definition if granted

Parameters:
Name Type Description
name string

Object name (Field...)

id string

Object id

info(msg)

Information dialog box

Parameters:
Name Type Description
msg string

Content

isActionBinded(a)

Is action binded ?

Parameters:
Name Type Description
a Object

Action metadata

Returns:

True if the action is binded

isBinded(name)

Is UI action binded and enabled ?

Parameters:
Name Type Description
name string

Action name

Returns:

True if the action is enabled

isFirefox()

Checks if user agent is Firefox?

isMediaDesktop()

Is the media a desktop ?

isMediaMobile()

Is the media a mobile ?

isMediaTablet()

Is the media a tablet ?

keepAlive(enable, obj, id)

Keep the session alive during data updates (used by form and edit list) and refresh object usage by other people

Parameters:
Name Type Description
enable boolean

true to start the timer, false to stop

obj string

optional object name to get usage

id string

optional rowId

linkedLists(ctn, obj, field, code, index, cbk, all)

Reload the linked lists of an enum field

Parameters:
Name Type Description
ctn string | jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object

field Simplicite.Ajax.ObjectField

Enum field

code string | Array

Selected value(s)

index string

Edit list index

cbk function

Callback function(target) to rebuild each target field with the new listOfValues

all boolean

Get all values when code is empty (case of a search field)

loadAceEditor(cbk)

Load ACE editor

Parameters:
Name Type Description
cbk function

optional callback

loadCalendar(cbk)

Calendar loading from FULLCALENDAR_LIBS or /scripts/fullcalendar. Needs sysparam FULLCALENDAR_VERSION = "3" or "4" (default 3 for backward compatibility)

Parameters:
Name Type Description
cbk function

Optional callback

loadCharts()

Load chart.js libs

loadCSS(p)

Load a server CSS

Parameters:
Name Type Description
p Object | string

Parameters or URL

Properties
Name Type Description
url string

script location

inline boolean

true to inline the styles in header (default add a link to the stylesheet)

async boolean

asynchronous ? true by default

onload function

optional callback when loaded

silent string

true for no logging (not found 404)

force string

ignore the local cache

loadDiagramEngine(svg, cbk)

Load the diagram engine

Parameters:
Name Type Description
svg boolean

Load only SVG engine?

cbk function

Optional callback

loadEditor(editor, {function))

External editor loading

Parameters:
Name Type Description
editor Object

editor parameters

Properties
Name Type Description
name string

unique name

url string

URL of editor script

onload function

optional handler to init the editor

{function)

cbk - callback when loaded

loadEngine(name, cbk)

Load the Rendering engine

Parameters:
Name Type Description
name string

extension name: bootstrap3 or bootstrap4

cbk function

onload callback

loadGridJson(cbk)

Grid tool for JSON in a table

Parameters:
Name Type Description
cbk function

optional callback

loadJqPlot(cbk)

Load jqPlot

Parameters:
Name Type Description
cbk function

optional callback

loadMarked(cbk)

Load Marked parser (Markdown to HTML)

Parameters:
Name Type Description
cbk function

optional callback

loadPart(p)

Load a HTML/JS/CSS resource in the target selector

Parameters:
Name Type Description
p Object

Parameters

Properties
Name Type Description
name string

resource name

url string

or resource URL

type string

"HTML", "CSS" or "JS" (or URL extension)

target string

optional selector to append the "HTML" part

onload function

optional callback when loaded

silent string

true for no logging (not found 404)

force string

ignore the local cache

loadParts(list, {function))

Load HTML/JS/CSS resources

Parameters:
Name Type Description
list Array

list of parts [{ name, url, type, target }]

{function)

cbk - callback when loaded

loadResource(p)

Load a disposition resource and replace [ROOT] tokens

Parameters:
Name Type Description
p Object

Parameters

Properties
Name Type Description
url string

script location

async boolean

asynchronous ? true by default

onload function

optional callback when loaded

silent string

true for no logging (not found 404)

loadScript(p)

Load a server JavaScript

Parameters:
Name Type Description
p Object | string

minimal parameter { url } or URL

Properties
Name Type Description
url string

script location

encoding string

optional, default 'UTF-8'

async string

asynchronous call, true by default

onload string

optional callback when loaded

silent string

true for no logging (not found 404)

force string

ignore the local cache

loadScripts(list, onload)

Load a list of JS/CSS scripts (preserve ordering)

Parameters:
Name Type Description
list Array.<Object> | Array.<string>

list of scripts URL (js or css)

onload function

callback

loadSelectBox(cbk)

Load the select box component (see https://select2.org)

Parameters:
Name Type Description
cbk function

optional callback

loadSpeech()

Load the speech engine

loadTinyMCE(cbk)

Load TinyMCE editor

Parameters:
Name Type Description
cbk function

optional callback

loadURL(ctn, url, options, {function, cbk)

Load URL in a container: wrap the URL to specific controllers (list, form...) or call the back-end thru ajax

Parameters:
Name Type Description
ctn string | jQuery

Container to load the URL (default is #work)

url string

URL to load

options Object

Contextual parameters

Properties
Name Type Description
label string

Optional label to display in nav/dialog/download

target string

Optional target _blank, _top or _popup

nav string

Optional navigation add or new

showNav boolean

Show or hide the navigation

object Object

Optional object of action

rowId Object

Optional object row ID (form/row action)

item Object

Optional object item (form/row action)

noiframe boolean

Optional flag to inline content

{function

options.reader Optional reader(content-type, attach, filename, blob, defaultReader, cbk) to override default download into container

cbk function

Optional callback when loaded

logout(params)

Default logout: confirm (with text CONFIRM_LOGOUT) and save session before quit

Parameters:
Name Type Description
params Object

logout parameters

Properties
Name Type Description
confirm boolean

true to confirm the logout

url string

optional new location URL

login string

optional user login to switch session

token string

optional user token to switch session

main(cbk)

Displays all site parts:

  • Create main div
  • load only options.resources if specified
  • load part MAIN/HEADER/FOOTER/MENU/WORK when options.useMainParts=true
  • load STYLES + SCRIPT resources of disposition or object
Parameters:
Name Type Description
cbk function

Final callback when displayed

mediaSize(w)

Get the media size

Parameters:
Name Type Description
w number

viewport width

Returns:

media size

monitor(ctn, params)

UI monitoring

Parameters:
Name Type Description
ctn jQuery

Container to monitor

params Object

Parameters or action

Properties
Name Type Description
ui boolean

Front or Ajax call

mousePos(e, o)

Get the mouse/touch position {x,y} on screen

Parameters:
Name Type Description
e Object

Mouse or touch event

o Object

Optional offset {left,top} to substract

onFollow(method, param, cbk)

Follow service wrapper

Parameters:
Name Type Description
method string

Method name

param string

Mmethod param

cbk function

Optional callback

onMessageReceived(m)

Firebase default handler when a message is received thru FCM or worker.

Parameters:
Name Type Description
m Object

Message or notification

Properties
Name Type Description
notification string

Optional embedded message with title and body

body string

Message body

title string

Optional title

priority string

Optional priority 'high'|'normal'|'low'

data Object

Optional pairs of key-value (may be present on top of message)

Properties
Name Type Description
object string

Optional object name

rowId string

Optional object rowId

tap string

Foreground or background

icon string

Optional icon

color string

Optional color

openForm(ctn, obj, rowId)

Open object form: default displayForm with nav add

Parameters:
Name Type Description
ctn string | jQuery

Target container

obj string | Simplicite.Ajax.BusinessObject

Name or Business Object

rowId string

Referenced row ID

openObject(ctn, obj, rowId, params)

Open handler (on a list row or summary): default switch to open object form, reference, doc or image

Parameters:
Name Type Description
ctn string | jQuery

Container

obj Simplicite.Ajax.BusinessObject | String

Target object or name

rowId string

Target row ID

params Object

Optional parameters

Properties
Name Type Description
object Simplicite.Ajax.BusinessObject

Source object

rowId string

Source row ID

ref string

Reference object name

refId string

With the reference row ID

field string

Or the doc/image field name

docId string

With the document ID

imageId string

Or the image ID

preview boolean

Preview document?

openURL(url, target)

Open the URL in a new window

Parameters:
Name Type Description
url string

URL to open

target string

Optional, default '_blank'

populateReference(ctn, obj, refField, refId, index, cbk, noChange, userKey)

Populate the referenced fields

Parameters:
Name Type Description
ctn string | jQuery

Container

obj Simplicite.Ajax.BusinessObject

Object

refField string

Foreign key field

refId string

Reference row ID, or null to reset referenced fields

index string

Optional row index (edit list)

cbk function

Optional callback

noChange boolean

Optional to bypass change events on each fields

userKey boolean

Optional to get foreign user-key

previewDocument(doc, embedded)

Preview a document: default open a dialog with the preview

Parameters:
Name Type Description
doc Object

Document data

Properties
Name Type Description
object Object

Object name

field Object

Document field name

rowId Object

Row ID

docId Object

Document ID

name Object

Document name

embedded boolean

Embedded or dialog

prompt(params)

Prompt dialog box

Parameters:
Name Type Description
params string | Object

Message or object with:

Properties
Name Type Description
name string

Optional name

title string

Dialog title

required boolean

Required value

content string | jQuery

Optional alert body

help string | jQuery

Optional help

onOk function

Optional callback(value) on OK button

onCancel function

Optional callback on Cancel button

quit(params)

Default quit is a session logout

Parameters:
Name Type Description
params Object

logout parameters

Properties
Name Type Description
url string

optional new location URL to change scope

login string

optional user login to change user

randomString(len)

Random string

Parameters:
Name Type Description
len

Length

Returns:

Random string of specified length

readCookie(name)

Read a cookie

Parameters:
Name Type Description
name string

cookie name

readField(ctn, obj, f, index, cbk)

Read the form field into object field (async/file reading)

Parameters:
Name Type Description
ctn string | jQuery

Container to find field

obj Simplicite.Ajax.BusinessObject

Optional business object

f Simplicite.Ajax.ObjectField

Business field

index string

Optional index of field (list edit)

cbk function

Callback when readed

readFile(file, cbk, output, progress, optional)

Read a form input file

Parameters:
Name Type Description
file Object

Input file (jQuery, input or file)

cbk function

Required callback

output string

Base64 (default) | ArrayBuffer | File

progress function

Optional progress callback(loaded, total, percent)

optional number

size limit (Mo) 0:no error or null=MAX_UPLOAD_SIZE

readForm(ctn, obj, index, cbk)

Read all form fields into object fields (async/file reading)

Parameters:
Name Type Description
ctn string | jQuery

Container to find fields

obj Simplicite.Ajax.BusinessObject

Business object

index string

Optional index (list edit)

cbk function

Callback

ready(app, engine, options, cbk)

When page is loaded: load user rights, menu, texts and engine.
Then call the main page service.

Parameters:
Name Type Description
app Simplicite.Ajax

Ajax API to access to data

engine string

extension name (default 'bootstrap')

options Simplicite.UI.Globals

some globals options to override

cbk function

Optional callback(err) when loaded

reloadForm(ctn)

Reload the object form: default reload navigation

Parameters:
Name Type Description
ctn jQuery

Container

removeLocalLogin(login)

Remove a login from local storage

Parameters:
Name Type Description
login string

remove all logins if null

resetDatamap(ctn, obj, field, index, cbk)

Reset datamap fields

Parameters:
Name Type Description
ctn string | jQuery

Parent container of referenced fields to set

obj Simplicite.Ajax.BusinessObject

Object

field Simplicite.Ajax.ObjectField

Mapped field

index string

Optional row index (edit list)

cbk function

Optional callback to override fields change

resize(force)

Resize window handler

Parameters:
Name Type Description
force boolean

True to force a full redraw

saveForm(ctn, obj, cbk, params)

Save the object form

Parameters:
Name Type Description
ctn jQuery

Container

obj Simplicite.Ajax.BusinessObject

Business object

cbk function

Callback function(obj, errors, messages)

params Object

Optional parameters (parent)

saveList(ctn, obj, params, cbk)

Save the object list

Parameters:
Name Type Description
ctn jQuery

List container

obj Simplicite.Ajax.BusinessObject

Business object

params Object

Optional parameters (parent)

cbk function

Callback function(obj, errRow, msgRow)

saveObject(ctn, obj, index, params, onSuccess, onError)

Save the object after reading UI values

Parameters:
Name Type Description
ctn jQuery

Container

obj Simplicite.Ajax.BusinessObject

Business object

index string

Optional index/row ID in list

params Object

Optional parameters (parent)

onSuccess function

Callback function(msgs) on success

onError function

Callback function(errs) on error

saveSession(cbk)

Save the session (by default the recent activity in HISTORY)

Parameters:
Name Type Description
cbk function

optional callback

selectDatamap(ctn, obj, field, index, cbk, reset)

Object datamap picker: default open a popup to select data

Parameters:
Name Type Description
ctn string | jQuery

Parent container of referenced fields to set

obj Simplicite.Ajax.BusinessObject

Object

field Simplicite.Ajax.ObjectField

Mapped field

index string

Optional row index (edit list)

cbk function

Optional callback to override fields change

reset boolean

True to only reset all datamap fields

selectMetaObject(ctn, obj, field, index)

Meta-object picker: default open a popup to select a reference

Parameters:
Name Type Description
ctn string | jQuery

Parent container of referenced fields to set

obj string | Simplicite.Ajax.BusinessObject

Object

field string | Simplicite.Ajax.ObjectField

Field of meta-object to select

index string

Optional row index (edit list)

selectObject(ctn, obj, options, cbk)

Object picker: default open a popup to select object(s) (used by pillbox, modeler and associate)

Parameters:
Name Type Description
ctn string | jQuery

Parent container

obj string | Simplicite.Ajax.BusinessObject

Object name or business object

options Object

List additive options { context, filters, parent, minified, layout... }

Properties
Name Type Description
selectRows boolean

true to allows multiple selections

selectedIds Array

optional row Ids to pre-select

cbk function

Callback(obj, id or array of ids) called on selection

selectReference(ctn, obj, ref, refField, index, cbk, userKeys)

Object reference picker: default open a popup to select a reference

Parameters:
Name Type Description
ctn string | jQuery

Parent container of referenced fields to set

obj Simplicite.Ajax.BusinessObject

Object

ref string | Simplicite.Ajax.BusinessObject

Referenced object name or business object (list popup)

refField string | Simplicite.Ajax.ObjectField

Foreign key (or meta object) field to select (name or field)

index string

Optional row index (edit list)

cbk function

Optional callback (will replace all change events on each field)

userKeys boolean

Optional to get foreign user-key

session(cbk, params)

Open the user session with authtoken

Parameters:
Name Type Description
cbk function

callback(err) when the session is opened or not

params Object

options

Properties
Name Type Description
scope string

optional user scope or home view

setAjax(ajax)

Set the Ajax APIs

Parameters:
Name Type Description
ajax Simplicite.Ajax

Simplicite.Ajax instance

setCompletionMinSize(size)

Completion minimum size to trigger the search

Parameters:
Name Type Description
size number

Positive number (0 = disable)

setEngineView(name, cbk)

Set the view engine

Parameters:
Name Type Description
name string

extension name (ex: bootstrap)

cbk function

onload callback

setTheme(theme, cbk)

Change the current CSS theme (stored in local storage)

Parameters:
Name Type Description
theme string

theme name (ex: 'default', 'light', 'dark')

cbk function

optional callback

speechAssist(options, cbk)

Speech assistant (experimental)

Parameters:
Name Type Description
options Object

Options

Properties
Name Type Description
hotword string

optional hotword to detect commands (supports translated TEXT)

commands Array.<Object>

optional commands { name, priority, phrase, callback, regexp }

continuous boolean

continuous speaking? (default true to accept sentences)

autoRestart boolean

auto restart the recognition? (default true to accept long silence)

maxAlternatives number

max recognition alternatives (default 10)

lang string

optional lang (default user's language)

debug boolean

optional console info

cbk function

Callback(assist)

speechRecognition(el, options)

Speech recognition

Parameters:
Name Type Description
el Object

Element input or textarea

options Object

Options

Properties
Name Type Description
lang string

Language (ex: FRA, ENU or fr-FR, en-GB...)

continuous boolean

Continuous speaking (sentence)?

autoRestart boolean

Continuous speaking (no timeout after long silence)?

interimResults boolean

Get interim results?

maxAlternatives number

Max alternatives search

firstCapital boolean

First character uppercase in a sentence?

newLine boolean

Accept new line symbol?

onStart function

Optional handler when started

onEnd function

Optional handler when ended

onError function

Optional handler on error

onChange function

Optional handler to override change event

debug boolean

Optional console info

speechSynthesis(el, options)

Speech synthesis

Parameters:
Name Type Description
el Object

Text or input or textarea

options Object

Options

Properties
Name Type Description
lang string

Preferred language FRA, ENU...

voice string

Optional voice name to force if exists

uri string

Service URI, default native

volume string

0 to 1, default 1

rate string

0.1 to 10, default 1

pitch string

0 to 2, default 1

onStart function

Optional handler when started

onEnd function

Optional handler when ended

debug boolean

Optional console info

splash()

Loading page with status

title(obj, userKey, plural)

Object title to display.

Parameters:
Name Type Description
obj Simplicite.Ajax.BusinessObject

Object with metadata (label, plurallabel, userkey)

userKey boolean

True to add the valued user-key

plural boolean

True to use the plural label if exists

toast(params)

Toast dialog box

Parameters:
Name Type Description
params string | Object

Message or object with:

Properties
Name Type Description
type string

Optional error|danger|warning|info

content string | jQuery

Toast body

position string

Position top|bottom

align string

Align left|right|center

undo boolean

Add an undo button?

unbind(name)

Unbind one UI action

Parameters:
Name Type Description
name string

Action name

undoRedo(ctn, action, num, url)

Undo/Redo service

Parameters:
Name Type Description
ctn string | jQuery

Target container

action string

Undo|redo

num string

Number of iterations (default 1)

url string

Optional URL to reload after server call (else use response url)

warning(msg)

Warning dialog box

Parameters:
Name Type Description
msg string

Content

yesNo(params)

Yes/No dialog box

Parameters:
Name Type Description
params string | Object

Message or object with:

Properties
Name Type Description
name string

Optional name

title string

Optional title, default "CONFIRM"

content string | jQuery

Optional alert body

help string | jQuery

Optional help

onYes function

Optional callback on "YES" button

onNo function

Optional callback on "NO" button

dontAskAgain string

Use the 'dont't ask again' local storage (true=keep user's action or string=forced response), needs a name

yesNoCancel(params)

Yes/No/Cancel dialog box

Parameters:
Name Type Description
params string | Object

Message or object with:

Properties
Name Type Description
name string

Optional name

title string

Optional title, default "CONFIRM"

content string | jQuery

Optional alert body

help string | jQuery

Optional help

onYes function

Optional callback on "YES" button

onNo function

Optional callback on "NO" button

onCancel function

Optional callback on "CANCEL" button

dontAskAgain string

Use the 'dont't ask again' local storage (true=keep user's action or string=forced response), needs a name

zipEditor(ctn, doc, params, cbk)

ZIP editor

Parameters:
Name Type Description
ctn Object

Parent container

doc Object

Document { object, rowId, field, docId, name }

params Object

Options { readonly:true|false }

cbk function

Optional callback to get the new ZIP as Base64

(inner) keydown(e)

Default keydown handler
CTRL-S : trigger "ui.key.ctrls" to all "js-ctrl-s" elements
ESCAPE : in order of priority close dialog, blur field (remove focus), or back in navigation
SHIFT-LEFT/RIGHT : navigation between list items

Parameters:
Name Type Description
e Object

Key event

(inner) loadImport()

load import view