Context

.Components. Context

new Context(options)

Source:
Tutorials:
The Context class glues component instances together. It provides API method implementations and simplifies the interaction with PMA.core by automatically managing authentication and sessionID handling, via the authentication provider classes.
Parameters:
Name Type Description
options Object
Properties
Name Type Description
caller string

Methods

distinctValues(options)

Source:
Gets all distinct values for a field in aform
Parameters:
Name Type Description
options Object Parameters to pass to the "distinct values" request
Properties
Name Type Attributes Description
serverUrl string The server url to use
formId string The Form Id to use
fieldId string The Field Id to get distinct values for
success function <optional>
Called upon success
failure function <optional>
Called upon failure

getAuthenticationProviders() → {PMA.UI.Authentication.AutoLogin|PMA.UI.Authentication.PromptLogin|PMA.UI.Authentication.SessionLogin}

Source:
Gets the list of available authentication methods
Returns:
[] providers
Type
PMA.UI.Authentication.AutoLogin | PMA.UI.Authentication.PromptLogin | PMA.UI.Authentication.SessionLogin

getCaller() → {string}

Source:
Gets the caller value
Returns:
Type
string

getEvents(options)

Source:
Gets the events log from the server
Parameters:
Name Type Description
options Object Parameters to pass to the GetEvents request
Properties
Name Type Attributes Description
serverUrl string The server url to get events log
page number The page to fetch
pageSize number The page size to fetch
success function <optional>
Called upon success
failure function <optional>
Called upon failure

getImagesInfo(options)

Source:
Gets information for all slides specified
Parameters:
Name Type Description
options Object Parameters to pass to the GetSlides request
Properties
Name Type Attributes Description
serverUrl string The server url to get slides from
images Array.<string> An array of image paths or uids to fetch information for
success function <optional>
Called upon success
failure function <optional>
Called upon failure

getSession(serverUrl, success, failureopt)

Source:
Finds a session ID for the requested server, either by scanning the already cached session ids or by invoking one by one the available authentication providers, until a valid session ID is found
Parameters:
Name Type Attributes Description
serverUrl string The URL of the PMA.core for which to fetch a session ID
success PMA.UI.Components.Context~getSessionCallback
failure function <optional>

getSlides(options)

Source:
Gets all slides in a specified path
Parameters:
Name Type Description
options Object Parameters to pass to the GetSlides request
Properties
Name Type Attributes Description
serverUrl string The server url to get slides from
path string The path to get slides from
scope PMA.UI.Components.GetSlidesScope The search scope to use
success function <optional>
Called upon success
failure function <optional>
Called upon failure

getUserInfo(serverUrl) → {PMA.UI.Components~authenticationResponse}

Source:
Gets the user information associated with a server
Parameters:
Name Type Description
serverUrl string The URL of the PMA.core for which to fetch user information
Returns:
If no authentication has taken place for the particular server, null is returned, otherwise an object.
Type
PMA.UI.Components~authenticationResponse

metadata(options)

Source:
Gets slides that satisfy the specified expressions
Parameters:
Name Type Description
options Object Parameters to pass to the "distinct values" request
Properties
Name Type Attributes Description
serverUrl string The server url to use
expressions Array.<Object> The Expressions to use
Properties
Name Type Description
FormID Number The form Id for this expression
FieldID Number The field Id for this expression
Operator Number The Operator for this expression ( Equals = 0, LessThan = 1, LessThanOrEquals = 2, GreaterThan = 3, GreaterThanOrEquals = 4)
Value Number The value to compare for this expression
success function <optional>
Called upon success
failure function <optional>
Called upon failure

pingServers(servers, done, maxAttemptsopt)

Source:
Pings a list of servers to find the fastests
Parameters:
Name Type Attributes Default Description
servers Array.<string> An array of server url to ping
done PMA.UI.Components.Context~pingServersDoneCallback The done callback to run
maxAttempts Number <optional>
5 The number of attempts for each server

registerAuthenticationProvider(provider)

Source:
Adds an authentication provider to the list of available authentication methods
Parameters:
Name Type Description
provider PMA.UI.Authentication.AutoLogin | PMA.UI.Authentication.PromptLogin | PMA.UI.Authentication.SessionLogin

removeAuthenticationProvider(provider, clearCache)

Source:
Removes an authentication provider from the list of available authentication methods
Parameters:
Name Type Description
provider PMA.UI.Authentication.AutoLogin | PMA.UI.Authentication.PromptLogin | PMA.UI.Authentication.SessionLogin The provider to remove
clearCache bool Clears the session ids cache

Type Definitions

getSessionCallback(sessionID)

Source:
Called when a session ID was successfully obtained
Parameters:
Name Type Description
sessionID string

pingServersDoneCallback(servers, detailInfo)

Source:
A function called after successfully pinging a list of servers
Parameters:
Name Type Description
servers Array.<String> A sorted list of server url's from fastest to slowest
detailInfo Array.<Object> An array of detailed information from pinging the servers (not sorted)
Properties
Name Type Description
serverUrl string The server url
success bool Whether the server responded to any pinging
times Array.<Number> An array of all the times the server took to respond (in miliseconds)
avgTime Number The average time the server took to respond (in miliseconds)
attempts Number The number of attempted pings to the server