Class GCN
Base namespace for the Gentics Content.Node JavaScript API.
Defined in: core.js.
Constructor Attributes | Constructor Name and Description |
---|---|
GCN()
|
Field Attributes | Field Name and Description |
---|---|
<static> |
GCN.Admin
Exposes an instance of the AdminAPI via GCN.Admin.
|
<static> |
GCN.global
Reference to the global context.
|
<inner> |
Match URL to internal file
|
<inner> |
Match URL to internal page
|
<static> |
GCN.settings
Settings for the Gentics Content.Node JavaScript API.
|
<static> |
Default GCN backend path.
|
<static> |
GCN.settings.channel
Set a channelid to work on for multichannelling or false if no
channel should be used
|
<static> |
The default callback to determine if a URL is an internal link.
|
<static> |
GCN.settings.lang
The language code with which to render tags.
|
<static> |
Determines whether links will be rendered as back-end urls or
front-end urls.
|
<static> |
The keyword for the construct that defines Aloha Editor links.
|
<static> |
GCN.sid
|
<static> |
GCN.usingSSO
|
Method Attributes | Method Name and Description |
---|---|
<static> |
GCN.afterNextAuthentication(callback)
|
<static> |
GCN.ajax(settings)
Wraps the `jQuery.ajax()' method.
|
<static> |
GCN.authenticate(cancelCallback)
Triggers the `authentication-required' event.
|
<static> |
GCN.channel(channel)
Set channel if a parameter is given retrieve it otherwise.
|
<static> |
GCN.clearSession()
Destroys the saved session data.
|
<static> |
GCN.createError(code, message, data)
Returns an object containing the formal error fields.
|
<static> |
GCN.error(error, error, additional)
Tigger an error message 'error-encountered'.
|
<static> |
GCN.exposeAPI(ctor)
Generates a factory method for chainback classes.
|
<static> |
GCN.file()
Creates a new instance of FileAPI.
|
<static> |
GCN.folder()
Creates a new instance of FolderAPI.
|
<inner> |
GCNError(code, message, data)
|
<static> |
GCN.getResponseCode(response)
Given a GCN ajax response object, return the response code.
|
<static> |
GCN.handleError(error, handler)
Tiggers the GCN error event.
|
<static> |
GCN.handleHttpError(xhr, msg, handler)
Handles the ajax transport error.
|
<static> |
GCN.handleResponseError(reponse, handler)
Handles error that occur when an ajax request succeeds but the
backend responds with an error.
|
<static> |
GCN.image()
Creates a new instance of ImageAPI.
|
<static> |
GCN.linksRenderMode(mode)
Set links render mode if a parameter is given
retrieve it if not
|
<static> |
GCN.login(username, password, success, error)
Log into Content.Node, with the given credentials.
|
<static> |
GCN.loginWithSSO(success, error)
Attemps to authenticate using Single-Sign-On.
|
<static> |
GCN.logout(success, error)
Do a logout and clear the session id.
|
<static> |
GCN.Message()
MessageAPI namespace.
|
<static> |
GCN.node()
Creates a new instance of NodeAPI.
|
<static> |
GCN.onAuthenticated()
This is the method that is passed as `proceed()' to the handler
registered through `onAuthenticationRequired()'.
|
<static> |
GCN.page()
Creates a new instance of PageAPI.
|
<static> |
GCN.pub(message, params)
Publish a message
|
<static> |
GCN.setSid(sid)
Sets the `sid'.
|
<static> |
GCN.sub(message, handler)
Subscribe to a message channel
|
<static> |
GCN.template()
Creates a new instance of TemplateAPI.
|
Field Detail
GCN.Admin
Exposes an instance of the AdminAPI via GCN.Admin.
Defined in: admin.js.
Defined in: admin.js.
- See:
- AdminAPI
GCN.global
Reference to the global context.
INTERNAL_FILEURL
Match URL to internal file
INTERNAL_PAGEURL
Match URL to internal page
GCN.settings
Settings for the Gentics Content.Node JavaScript API.
GCN.settings.BACKEND_PATH
Default GCN backend path. Do not add a trailing slash here.
- Default Value:
- '/CNPortletapp'
GCN.settings.channel
Set a channelid to work on for multichannelling or false if no
channel should be used
- Default Value:
- false
GCN.settings.checkForInternalLink
The default callback to determine if a URL is an internal link.
Matches the given href agains
INTERNAL_PAGEURL
and
INTERNAL_FILEURL
respectively.
GCN.settings.lang
The language code with which to render tags.
- Default Value:
- 'en'
GCN.settings.linksRenderMode
Determines whether links will be rendered as back-end urls or
front-end urls. Can either be set to "backend" or "frontend".
- Default Value:
- 'backend'
GCN.settings.MAGIC_LINK
The keyword for the construct that defines Aloha Editor links. In
most Content.Node installations this will be "gtxalohapagelink",
but can be otherwise defined.
- Default Value:
- 'gtxalohapagelink'
{Stores the user's session id. It is required for making REST-API requests.} GCN.sid
Defined in: session.js.
{Whether or not Single-SignOn is used for automatic authentication.} GCN.usingSSO
Defined in: session.js.
Method Detail
GCN.afterNextAuthentication(callback)
Defined in: session.js.
- Parameters:
- callback
GCN.ajax(settings)
Wraps the `jQuery.ajax()' method.
- Parameters:
- {object} settings
- Throws:
- HTTP_ERROR
GCN.authenticate(cancelCallback)
Triggers the `authentication-required' event. Provides the handler
a `proceed' and a `cancel' function to branch the continuation of
the program's control flow depending on the success or failure of
the authentication attempt.
Defined in: session.js.
Defined in: session.js.
- Parameters:
- {function(GCNError=)} cancelCallback
- A function to be invoked if authentication fails.
- Throws:
- NO_AUTH_HANDLER Thrown if now handler has been registered `onAuthenticatedRequired' method.
{string} GCN.channel(channel)
Set channel if a parameter is given retrieve it otherwise.
If you don't want to work on a channel just set it to false, which
is the default value.
- Parameters:
- {string|boolean} channel
- The id of the channel to be set or false to unset the channel.
- Returns:
- {string} current channel id.
GCN.clearSession()
Destroys the saved session data.
At the moment this only involves clearing the stored SID.
Defined in: session.js.
Defined in: session.js.
{GCNError} GCN.createError(code, message, data)
Returns an object containing the formal error fields. The object
contains a `toString' method to print any uncaught exceptions
nicely.
- Parameters:
- {string} code
- {string} message
- {object} data
- Returns:
- {GCNError}
GCN.error(error, error, additional)
Tigger an error message 'error-encountered'.
- Parameters:
- {string} error
- code
- {string} error
- message
- {object} additional
- error data
GCN.exposeAPI(ctor)
Generates a factory method for chainback classes. The method signature
used with this factory function will match that of the target class'
constructor. Therefore this function is expected to be invoked with the
follow combination of arguments ...
Examples for GCN.pages api:
To get an array containing 1 page:
pages(1)
pages(1, function () {})
To get an array containing 2 pages:
pages([1, 2])
pages([1, 2], function () {})
To get an array containing any and all pages:
pages()
pages(function () {})
To get an array containing no pages:
pages([])
pages([], function () {});
Defined in: abstract-content-object.js.
Defined in: abstract-content-object.js.
- Parameters:
- {Chainback} ctor
- The Chainback constructor we want to expose.
- Throws:
- UNKNOWN_ARGUMENT
GCN.file()
Creates a new instance of FileAPI. See the FileAPI constructor for detailed information.
Defined in: file.js.
Defined in: file.js.
- See:
- FileAPI
GCN.folder()
Creates a new instance of FolderAPI. See the FolderAPI constructor for detailed information.
Defined in: folder.js.
Defined in: folder.js.
- See:
- FolderAPI
GCNError(code, message, data)
- Parameters:
- code
- message
- data
GCN.getResponseCode(response)
Given a GCN ajax response object, return the response code.
Defined in: session.js.
Defined in: session.js.
- Parameters:
- {object} response
- GCN response object return in the ajax request callback.
{boolean} GCN.handleError(error, handler)
Tiggers the GCN error event.
- Parameters:
- {GCNError} error
- {function(GCNError):boolean} handler
- Custom error handler.
- Returns:
- {boolean} Whether or not to the exception was thrown.
GCN.handleHttpError(xhr, msg, handler)
Handles the ajax transport error. It will invoke the custom error
handler if one is provided, and propagate the error onto the global
handler if the an error handler does not return `false'.
- Parameters:
- {object} xhr
- {string} msg
- The error message
- {function} handler
- Custom error handler.
- Throws:
- HTTP_ERROR
GCN.handleResponseError(reponse, handler)
Handles error that occur when an ajax request succeeds but the
backend responds with an error.
- Parameters:
- {object} reponse
- The REST API response object.
- {function(GCNError):boolean} handler
- Custom error handler.
GCN.image()
Creates a new instance of ImageAPI. See the ImageAPI constructor for detailed information.
Defined in: image.js.
Defined in: image.js.
- See:
- ImageAPI
{string} GCN.linksRenderMode(mode)
Set links render mode if a parameter is given
retrieve it if not
- Parameters:
- {string} mode
- Returns:
- {string} mode
GCN.login(username, password, success, error)
Log into Content.Node, with the given credentials.
Defined in: session.js.
Defined in: session.js.
- Parameters:
- {string} username
- {string} password
- {function} success
- Invoked when login attempt completes regardless of whether or not authentication succeeded.
- {function} error
- Called if there an HTTP error occured when performing the ajax request.
GCN.loginWithSSO(success, error)
Attemps to authenticate using Single-Sign-On.
Defined in: session.js.
Defined in: session.js.
- Parameters:
- {function} success
- {function} error
- Throws:
- HTTP_ERROR
GCN.logout(success, error)
Do a logout and clear the session id.
Defined in: session.js.
Defined in: session.js.
- Parameters:
- {function} success
- {function} error
- A callback that will be invoked if an ajax error occurs while trying to accomplish the logout request.
GCN.Message()
MessageAPI namespace. See the MessageAPI constructor for detailed information.
Defined in: message.js.
Defined in: message.js.
- See:
- MessageAPI
GCN.node()
Creates a new instance of NodeAPI. See the NodeAPI constructor for detailed information.
Defined in: node.js.
Defined in: node.js.
- See:
- NodeAPI
GCN.onAuthenticated()
This is the method that is passed as `proceed()' to the handler
registered through `onAuthenticationRequired()'. It ensures that
all functions that are pending authentication will be executed in
FIFO order.
Defined in: session.js.
Defined in: session.js.
GCN.page()
Creates a new instance of PageAPI.
See the PageAPI constructor for detailed information.
Defined in: page.js.
Defined in: page.js.
- See:
- PageAPI
GCN.pub(message, params)
Publish a message
- Parameters:
- {string} message
- channel name
- {*=} params
GCN.setSid(sid)
Sets the `sid'. If one has already been set, the it will be
overwritten.
Defined in: session.js.
Defined in: session.js.
- Parameters:
- {id} sid
- The value to set the `sid' to.
GCN.sub(message, handler)
Subscribe to a message channel
- Parameters:
- {string} message
- channel name
- {function} handler
- function - message parameters will be passed.
GCN.template()
Creates a new instance of TemplateAPI. See the TemplateAPI constructor for detailed information.
Defined in: template.js.
Defined in: template.js.
- See:
- TemplateAPI