Class CmsClientUgcSession

java.lang.Object
org.opencms.ugc.client.export.CmsClientUgcSession
All Implemented Interfaces:
org.timepedia.exporter.client.Exportable

public class CmsClientUgcSession extends Object implements org.timepedia.exporter.client.Exportable
Client side object representing a form editing session.

  • Constructor Details

    • CmsClientUgcSession

      public CmsClientUgcSession(CmsXmlContentUgcApi apiRoot, org.opencms.ugc.shared.CmsUgcContent content)
      Creates a new instance.

      Parameters:
      apiRoot - the CmsXmlContentFormApi instance which was used to create this session object
      content - the form data returned from the server
  • Method Details

    • destroy

      public void destroy()
      Destroys the session.

    • getContentFormApi

      Gets the content form API instance.

      Returns:
      the content form API instance
    • getLink

      public void getLink(String path, I_CmsStringCallback callback)
      Fetches the link for a given path from the server.

      Parameters:
      path - the path for which we want the link
      callback - the callback to call with the result
    • getSessionId

      public String getSessionId()
      Gets the session id.

      Returns:
      the session id
    • getSitePath

      public String getSitePath()
      Gets the site path of the edited content.

      Returns:
      the site path of the edited content
    • getValues

      public com.google.gwt.core.client.JavaScriptObject 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

      public void initFormElement(com.google.gwt.dom.client.Element formElement)
      Initializes the form belonging to this session.

      Parameters:
      formElement - the form element
    • internalGetSessionId

      public org.opencms.util.CmsUUID 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 set
      onSuccess - the callback to be called in case of success
      onFailure - 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 upload
      fileCallback - the callback for the results
      errorCallback - 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