Class FileUploadControl

  • All Implemented Interfaces:
    java.util.Observer, VariableResolver, IControl, IDataBoundControl, IDataControl, IRenderer

    public class FileUploadControl
    extends DataBoundControl
    Doui control that allows the upload of files to the portal.

    Behavior, according to the request parameters:

    • Parameter <control id>_prevFileId must contain the original fileId if the control currently has a file data value.
    • If the parameter <control id>_clearFile has value equals to true, then this control's data fullPath is set to null, to indicate that the file should be removed, and the upload is ignored.
    • Else if the parameter, whose name is specified in the xml filenameField tag, is present, the current file (if present) is renamed to the parameter's value.
    • Else if a file is uploaded with the parameter name equals to this control's id, and there is no previous file or the parameter <control id>_replaceFile has value equals to true, then the control's value will be changed to the uploaded file.
    • If the parameter <control id>_clearFile has value equals to false, then case the parameter <control id>.applyImageEdition has value equals to true and there is no previous file or the parameter <control id>_replaceFile has value equals to false, then the control's value will be set with the file created from an image edition.


    • Example use: <control:lum_fileUpload id="imageFile" /> xml data available for xsl rendering: <control id="imageFile" type="lum_fileUpload"> <strings> <string id="STR_REMOVE">Remove</string> <string id="STR_FILE_NOT_FOUND">File not found</string> <string id="STR_FILE_REMOVED">File Removed</string> <string id="STR_CANCEL_UPLOAD">Cancel Upload</string> <string id="STR_DOWNLOAD">Download</string> <string id="STR_EDIT_IMAGE">Edit Image</string> <string id="STR_CANCEL_EDITING_IMAGE">Cancel Editing Image</string> <string id="STR_IMAGE_EDITED">(Edited)</string> </strings> <data> <suffixId>imageFile</suffixId> </data> </control>
    Since:
    4.0.0
    Version:
    $Revision: 20825 $ $Date: 2017-12-11 14:43:21 -0200 (Mon, 11 Dec 2017) $
    • Constructor Detail

      • FileUploadControl

        public FileUploadControl()
    • Method Detail

      • getFilenameParameterName

        protected java.lang.String getFilenameParameterName​(java.lang.String fieldId)
      • addImageEditorControls

        protected void addImageEditorControls()
                                       throws PortalException
        Add controls for the image edition functionality.

        xml data available for xsl rendering: <control id="<control id>.imageEditor" type="lum_imageEditor"> <control id="<control id>.imageEditionId" trim="true" type="lum_inputHidden"/> <control id="<control id>.imageDataURL" trim="true" type="lum_inputHidden"/> <control id="<control id>.editing<control id>name" trim="true" type="lum_inputHidden"/> <control id="<control id>.editingImageContentType" trim="true" type="lum_inputHidden"/> <control id="<control id>.applyImageEdition" trim="true" type="lum_inputHidden"/> <control id="<control id>.editImageButton" type="lum_button"> <onClick type="popupRunTimeInterface" openRuntimeInterfaceBehavior="replace"> <interfaceId>lumis.service.doui.fileupload.editimage.editimage</interfaceId> <addParameters> <parameter name="imageEditionId"> <value controlId="<control id>.imageEditionId" type="getValue"/> </parameter> <parameter name="imageDataURL"> <value controlId="<control id>.imageDataURL" type="getValue"/> </parameter> <parameter name="fileId"> <value controlId="<control id>" type="getValue"/> </parameter> <parameter name="editing<control id>name"> <value controlId="<control id>.editing<control id>name" type="getValue"/> </parameter> <parameter name="editingImageContentType"> <value controlId="<control id>.editingImageContentType" type="getValue"/> </parameter> </addParameters> </onClick> </control> </control>
        Throws:
        PortalException
        Since:
        8.1.0
      • getEditedImageFile

        protected java.io.File getEditedImageFile()
                                           throws UnexpectedException
        Returns the edited image file or null if it does not exist.
        Returns:
        the edited image file or null if it does not exist.
        Throws:
        UnexpectedException
        Since:
        8.1.0
      • getImageEditionFolderPath

        public static java.lang.String getImageEditionFolderPath​(SessionConfig sessionConfig,
                                                                 java.lang.String imageEditionId)
        Returns the image edition folder path of the given image edition id.
        Parameters:
        sessionConfig - the user's session.
        imageEditionId - the image edition id
        Returns:
        the image edition folder path of the given image edition id.
        Since:
        8.1.0
      • getStringsToLocalize

        protected java.util.Map<java.lang.String,​java.lang.String> getStringsToLocalize()
        Overrides:
        getStringsToLocalize in class Control