JIRA - KULRICE-12514
Component Spec - Multiple File Upload
After initial couple days of research here is a preliminary set of things I have come up with:
This will expose some of the options of the file upload plugin, as well as affect ftl output
private String url - partial or full url - default will be blank which will then default at the js level to ?methodToCall=fileUpload&formKey=...&cacheKey=..., thus calling the default controller
private String propertyName - wondering if we need BindingInfo, or make this something other than content element - leaning towards no because the files will not exist directly on the form (as far as I can tell at the moment)
private boolean renderUploadButton;
private boolean renderCancelAllButton - not sure how to get this one working yet
private boolean renderDeleteButton - not sure how to get this one working yet
String label parameters for the above buttons
private String acceptFileTypes - regex
private Integer maxFileSize - in bytes
private Integer minFileSize - in bytes
private Integer maxNumberOfFiles
private String fileUploadRowTemplate - template name to use to define the upload row template, this has to be done this way as I think generating it off settings will get to complex
private String fileDownloadRowTemplate - template name to use to define the download row template, this has to be done this way as I think generating it off settings will get to complex
private List<String> fileTableColumnNames - names of the columns of the table
Everything else will need to be done through templateOptions
Not sure how we should configure a delete url as it is only used in the controller to hand back to the UI
This template outputs the table and buttons and the krad.script call necessary to initialize the plugin. It will also render the file upload and download row templates by calling them here.
Defaults for the row templates what they actually do by default to be determined, we may need to create a readOnly version of the fileDownloadRow that does not include the delete action
Still investigating here, but we need a method to call for the file uploads. This I have gotten working in receiving a file and then handing back a response object in json that the plugin expects. However, we need to figure out a fundamental problem, how and where to store the file it receives by default in KRAD. For this we can probably use a database table, but what the object looks like is to be determined. The object I hand back should include a url to the file download, as well as, a url to a thumbnail of the file (if a picture), I'm not sure exactly how the video and audio previews work exactly yet.
Also it seems like, and I'm not sure yet, we need a method to call with the same signature that is a get version which is called to retrieve the set of files that already exist. I still have some experimenting to do on what this involves, or how/when it is getting invoked by the plugin. This would query the file system/datatbase for the files it needs and hand back the appropriate json response objects representing the file information.
We also need a methodToCall for file deletion, this url is handed back as part of the file information so it can be anything we desire.
This is an unknown to me at the moment. There may be some file generation involved in this to generate thumbnails for the image types, as well.
Currently the server can't receive files larger that 500kb, is this a local or global problem?
How to do the get request call (I need to experiment here still)?
How to make the cancel all and delete buttons work?
How do we store files by default? How can we make this easily configurable?
How do we do deletes, and how can we make this configurable?
Method/file security? No clue at all here
Columns: File, Size, Date Uploaded, Actions
Buttons: Add files, Upload All, Cancell All Uploads
Action buttons: Delete = trash icon, Cancel = trash icon
Delete should have a warning dialog with an option to toggle off for duration of that viewing