Package org.opencms.ugc.client.export
Class CmsClientUgcSession
java.lang.Object
org.opencms.ugc.client.export.CmsClientUgcSession
- All Implemented Interfaces:
org.timepedia.exporter.client.Exportable
Client side object representing a form editing session.
-
Constructor Summary
ConstructorDescriptionCmsClientUgcSession
(CmsXmlContentUgcApi apiRoot, org.opencms.ugc.shared.CmsUgcContent content) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Destroys the session.Gets the content form API instance.void
getLink
(String path, I_CmsStringCallback callback) Fetches the link for a given path from the server.Gets the session id.Gets the site path of the edited content.com.google.gwt.core.client.JavaScriptObject
Gets the old content values as a Javascript object.void
initFormElement
(com.google.gwt.dom.client.Element formElement) Initializes the form belonging to this session.org.opencms.util.CmsUUID
Gets the session id as a UUID.void
saveContent
(com.google.gwt.core.client.JavaScriptObject newValues, I_CmsStringCallback onSuccess, I_CmsErrorCallback onFailure) Asks the server to save the values set via setNewValue in the XML content.void
uploadFiles
(String[] fieldNames, I_CmsJavaScriptObjectCallback fileCallback, I_CmsErrorCallback errorCallback) Uploads multiple files.void
validate
(com.google.gwt.core.client.JavaScriptObject newValues, I_CmsJavaScriptObjectCallback onSuccess) Validates the new content values.
-
Constructor Details
-
Method Details
-
destroy
Destroys the session. -
getContentFormApi
Gets the content form API instance.- Returns:
- the content form API instance
-
getLink
Fetches the link for a given path from the server.- Parameters:
path
- the path for which we want the linkcallback
- the callback to call with the result
-
getSessionId
Gets the session id.- Returns:
- the session id
-
getSitePath
Gets the site path of the edited content.- Returns:
- the site path of the edited content
-
getValues
Gets the old content values as a Javascript object.- Returns:
- a Javascript object whose properties are the xpaths of the existing content values
-
initFormElement
Initializes the form belonging to this session.- Parameters:
formElement
- the form element
-
internalGetSessionId
Gets the session id as a UUID.- Returns:
- the session id
-
saveContent
public void saveContent(com.google.gwt.core.client.JavaScriptObject newValues, I_CmsStringCallback onSuccess, I_CmsErrorCallback onFailure) Asks the server to save the values set via setNewValue in the XML content.- Parameters:
newValues
- the new values to setonSuccess
- the callback to be called in case of successonFailure
- the callback to be called in case of failure
-
uploadFiles
public void uploadFiles(String[] fieldNames, I_CmsJavaScriptObjectCallback fileCallback, I_CmsErrorCallback errorCallback) Uploads multiple files.- Parameters:
fieldNames
- the array of form field names containing files to uploadfileCallback
- the callback for the resultserrorCallback
- the error handling callback
-
validate
public void validate(com.google.gwt.core.client.JavaScriptObject newValues, I_CmsJavaScriptObjectCallback onSuccess) Validates the new content values.- Parameters:
newValues
- a Javascript object with the value xpaths as keys and the corresponding content values as values.onSuccess
- the callback to call with the validation results
-