Namespace tao.items.Api
tao.items
Defined in: api.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Provides tools to manage the communication with a TAO context from an XHTML item.
|
Field Attributes | Field Name and Description |
---|---|
instanciate the EventTracer object
|
|
instanciate the TaoStack object
|
Method Attributes | Method Name and Description |
---|---|
finish()
Define the item's state as finished.
|
|
Get the values answered by the subject
|
|
Get the informations of the current delivery
|
|
Get the endorsment of the item
|
|
getItem()
Get the current item's informations
|
|
getScore()
Get the score of the item
|
|
Get the data of the user currently doing the item (the subject)
|
|
Get the login of the subject
|
|
Get the name of the subject (firstname and lastname)
|
|
getTest()
Get the informations of the currently running test
|
|
getToken()
Get the communication token (this token is sent at each communication)
|
|
getUserVar(key)
Get a previously defined user's variable.
|
|
initDataSource(environment, settings)
This fuction enables you to set up the data the item need.
|
|
initEventServices(source, destination)
Initialize the interfaces communication for the events logging.
|
|
initManualDataSource(source)
This function is a convenience method to add directly the datasource
by writing the data in the source object (JSON) .
|
|
initPush(environment, settings)
Initialize the push communication.
|
|
logCustomEvent(eventName, data)
Log the a eventName by sending the data
|
|
logEvent(elementName, eventType, data)
Log the an eventType bound on elementName by sending the data.
|
|
onFinish(callback)
Add a callback that will be executed on finish state.
|
|
push()
This method enables you to push the data to the server.
|
|
setAnsweredValues(endorsment)
Set the values answered by the subject.
|
|
setEndorsment(endorsment)
Set the endorsment of the item
|
|
setScore(score)
Set the final score of the item
|
|
setUserVar(key, the)
This function enables you to create and edit custom variables: the user's variables
The variable is identified by a key you have chosen.
|
Namespace Detail
tao.items.Api
Provides tools to manage the communication with a TAO context from an XHTML item.
Field Detail
{EventTracer}
eventTracer
instanciate the EventTracer object
taoStack
instanciate the TaoStack object
- See:
- TaoStack
Method Detail
finish()
Define the item's state as finished.
This state can have some consequences.
{boolean}
getAnsweredValues()
Get the values answered by the subject
- Returns:
- {boolean}
{Object}
getDelivery()
Get the informations of the current delivery
- Returns:
- {Object} the delivery's data (uri, label)
{boolean}
getEndorsment()
Get the endorsment of the item
- Returns:
- {boolean}
{Object}
getItem()
Get the current item's informations
- Returns:
- {Object} the item's data (uri, label)
{String|Number}
getScore()
Get the score of the item
- Returns:
- {String|Number}
{Object}
getSubject()
Get the data of the user currently doing the item (the subject)
- Returns:
- {Object} all the data related to the subject
{String}
getSubjectLogin()
Get the login of the subject
- Returns:
- {String} the subject's login
{Object}
getSubjectName()
Get the name of the subject (firstname and lastname)
- Returns:
- {Object} the subject's name
{Object}
getTest()
Get the informations of the currently running test
- Returns:
- {Object} the test's data (uri, label)
{String}
getToken()
Get the communication token (this token is sent at each communication)
- Returns:
- {String} the token
{String|number|boolean}
getUserVar(key)
Get a previously defined user's variable.
- Parameters:
- {String} key
- the key of the variable you want to retrieve
- Returns:
- {String|number|boolean}
initDataSource(environment, settings)
This fuction enables you to set up the data the item need.
You can retrieve this data from either a remote or a manual source.
If you don't need to change the default values, don't call this function.
- Parameters:
- {Object} environment
- set to null if you want to keep all the default values
- {String} environment.type Optional, Default: "async"
- the datasource type (manual|sync|async)
- {String} environment.url Optional, Default: "/tao/Api/getContext"
- the url of the server where the data are sent
- {Object} environment.params Optional
- the additional parameters to send with the data
- {Object} settings
- set to null if you want to keep all the default values
- {String} settings.format Optional, Default: "json"
- the data format. Only json is supported in the current version
- {String} settings.method Optional, Default: "post"
- HTTP method to push the data (get|post)
initEventServices(source, destination)
Initialize the interfaces communication for the events logging.
The source service defines where and how we retrieve the list of events to catch
The destination service defines where and how we send the catched events
- Parameters:
- {Object} source
- {String} source.type Optional, Default: "sync"
- the type of source (sync|manual)
- {Object} source.data Optional
- For the manual source type, set direclty the events list in the data
- {String} source.url Optional, Default: "/taoDelivery/ItemDelivery/getEvents"
- For the sync source type, the URL of the remote service
- {Object} source.params Optional
- the parameters to send to the sync service
- {String} source.format Optional, Default: "json"
- the data format. Only json is supported in the current version
- {String} source.method Optional, Default: "post"
- HTTP method of the sync service (get|post)
- {Object} destination
- {String} destination.url Optional, Default: "/taoResults/Server/traceEvents"
- the URL of the remote service
- {Object} destination.params Optional
- the common parameters to send to the service
- {String} destination.format Optional, Default: "json"
- the data format. Only json is supported in the current version
- {String} destination.method Optional, Default: "post"
- HTTP method of the service (get|post)
initManualDataSource(source)
This function is a convenience method to add directly the datasource
by writing the data in the source object (JSON) .
- Parameters:
- {Object} source
initPush(environment, settings)
Initialize the push communication.
If you don't need to change the default values, don't call this function.
- Parameters:
- {Object} environment
- set to null if you want to keep all the default values
- {String} environment.url Optional, Default: "/tao/Api/save"
- the url of the server where the data are sent
- {Object} environment.params Optional
- the additional parameters to send with the data
- {Object} settings
- set to null if you want to keep all the default values
- {String} settings.format Optional, Default: "json"
- the data format. Only json is supported in the current version
- {String} settings.method Optional, Default: "post"
- HTTP method to push the data (get|post)
- {boolean} settings.async Optional, Default: true
- if the request is asynchronous
- {boolean} settings.clearAfter Optional, Default: true
- if the variables stacks are cleared once the push is done
logCustomEvent(eventName, data)
Log the a eventName by sending the data
- Parameters:
- {String} eventName
- the name of the custom event
- {mixed} data
logEvent(elementName, eventType, data)
Log the an eventType bound on elementName by sending the data.
- Parameters:
- {String} elementName
- an HTML tag name
- {String} eventType
- a JS User Events
- {mixed} data
- any data strucuture you want to trace
onFinish(callback)
Add a callback that will be executed on finish state.
- Parameters:
- {function} callback
push()
This method enables you to push the data to the server.
setAnsweredValues(endorsment)
Set the values answered by the subject.
If the item contains a free text field,
you can record here the complete response.
- Parameters:
- {boolean} endorsment
setEndorsment(endorsment)
Set the endorsment of the item
- Parameters:
- {boolean} endorsment
setScore(score)
Set the final score of the item
- Parameters:
- {String|Number} score
setUserVar(key, the)
This function enables you to create and edit custom variables: the user's variables
The variable is identified by a key you have chosen.
This variable will be saved temporarly into the taoApi.
When you call the
push()
function, the user's variables are sent to the server.
It's a way to record some data other than the results and the events.
- Parameters:
- {String} key
- to identify of the variable
- {String|number|boolean} the
- value of the variable