Class CmsClientUgcSession

  • All Implemented Interfaces:

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

    • Constructor Detail

      • CmsClientUgcSession

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

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

      • destroy

        public void destroy()
        Destroys the session.

      • getLink

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

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

        public java.lang.String getSessionId()
        Gets the session id.

        the session id
      • getSitePath

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

        the site path of the edited content
      • getValues

        public getValues()
        Gets the old content values as a Javascript object.

        a Javascript object whose properties are the xpaths of the existing content values
      • initFormElement

        public void initFormElement​( formElement)
        Initializes the form belonging to this session.

        formElement - the form element
      • internalGetSessionId

        public org.opencms.util.CmsUUID internalGetSessionId()
        Gets the session id as a UUID.

        the session id
      • saveContent

        public void saveContent​( newValues,
                                I_CmsStringCallback onSuccess,
                                I_CmsErrorCallback onFailure)
        Asks the server to save the values set via setNewValue in the XML content.

        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​(java.lang.String[] fieldNames,
                                I_CmsJavaScriptObjectCallback fileCallback,
                                I_CmsErrorCallback errorCallback)
        Uploads multiple files.

        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​( newValues,
                             I_CmsJavaScriptObjectCallback onSuccess)
        Validates the new content values.

        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