PMA.UI Documentation by Pathomation

Context

Context

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.

Constructor

new Context(options)

Source:
Tutorials:
  • Tutorial: 03-gallery
  • Tutorial: 04-tree
  • Tutorial: 05-annotations
Parameters:
Name Type Description
options Object
Properties
Name Type Description
caller string

Classes

Context

Methods

checkPmaStartServer(success, failure)

Source:
Checks if a PMA.start server is available
Parameters:
Name Type Description
success function The function to call when check succeded
failure function The function to call when check failed

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

getPmaStartCorsUrl() → {string}

Source:
Returns the url to PMA.start CORS allow page
Returns:
Type
string

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 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 GetSlidesScope The search scope to use
success function <optional>
Called upon success
failure function <optional>
Called upon failure

getUserInfo(serverUrl) → {Context~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
Context~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 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 AutoLogin | PromptLogin | SessionLogin

removeAuthenticationProvider(provider, clearCache)

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

runScript(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
name string The script name to run
params object <optional>
Optional script parameters to pass
success function <optional>
Called upon success
failure function <optional>
Called upon failure

uploadFile(options)

Source:
Uploads a file to the pma.core server
Parameters:
Name Type Description
options Object
Properties
Name Type Description
serverUrl string The server url to use
targetPath string The virtual path to upload to
file File The file object to upload
progress Context~uploadProgressCallback A progress callback
Returns:
A promise to get the result of the upload

Type Definitions

authenticationResponse

Source:
Properties:
Name Type Description
SessionId string The session ID
Username string The username
Email string The user's email
FirstName string The user's first name
LastName string The user's last name
PMA.core authentication response
Type:
  • Object

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

uploadProgressCallback(name, progress)

Source:
A function called for progress on an upload
Parameters:
Name Type Description
name String The file name uploaded
progress Number The progress percentage