V2 File Handling
2013.08.31 AH & JK discussion
2013.09.02 AH & TN review
Issues
Design Issues
- Files attached attached to tasks or task notes?
Answer: Task notes
How to handle file category for files attached to task notes?
Answer: Allow data entry, but ignore the field when attaching files to task notes. Default is_working_file = false
Is the is attached to something flag in the metadata required in the database of should be be derived?
Answer: It is implied by resource_id and resource_type not being null
Will paging be required when selecting folders, baskets, files in forms:
Answer: no
- How should file versioning and file locking work?
Answer: See File Versioning
Items to Prototype
The prototype could also be an early version of the actual software
Rails Chosen. See chosen-rails
- Selecting folders, where the folder contents are dynamically displayed when the folder select list is changed
Introduction
- A file can only be attached to one object
- The first release will allow files to be attached to the following objects:
- Revisions
- Task notes (or directly to tasks?)
- It is possible to search for and generate lists of files
- By default only non-attached files are displayed
Permissions
- The file must be assigned to a folder
- The folder determines who can view the file's metadata and download the file
- When a file is attached to an object the file is automatically assigned to the object's folder
- Anyone with write permission on a folder can upload files
File Metadata
File metadata is stored in the File Assets table
- The File Assets table contains:
- Metadata associated with each file
- Links to the actual files stored in the file system
Metadata Fields
Field Name
Type
Req.
Field Description
Notes
id
int
YES
Record id
folder_id
int
YES
Folder file is assigned to
asset_file_name
string
YES
File name
Set automatically, can be overridden
asset_content_type
string
YES
File mime type
Set automatically
asset_file_size
int
YES
File size in bytes
Set automatically
asset_fingerprint
string
YES
File checksum
Set automatically
asset_updated_at
datetime
YES
Upload date/time
Set automatically
description
string
NO
Description
is_working_file
boolean
YES
File category (working or revision file)
Defaults to revision file
user_id
int
YES
Who uploaded file
Set automatically, can be overridden
file_type_ref_id
int
YES?
File type (source, publish, etc.)
Required?
resource_id
int
NO
Object id, when file attached
Set automatically
resource_type
string
NO
Object type, when file attached
Set automatically
created_at
datetime
YES
Date/time of file upload
Set automatically
updated_at
datetime
YES
Rails record last update date/time
Set automatically
New Fields
is_locked
boolean
YES
Set is file (and metadata?) can no longer be changed
Set automatically
previous_id
int
NO
File asset id of previous version of file
Set automatically
Transactions
- List files, including specifying search/sort criterion:
- Search/sort by metadata fields
- Folder
- Filename
- Date
- Who uploaded
- Description (optional)
- By default display only non-attached files
- But also able to include attached files (and exclude non-attached files)
- Add files in the resulting list into to a basket
- Select files and add to a (new) basket
- Search/sort by metadata fields
- File detail screen showing the file's metadata and a download link
- Edit file details, including the file name
- Download a file
- Delete uploaded files
- Re-upload files
Uploading Files
The current Stock of Uploaded files will be completely hidden from the user
- Only one file can be uploaded in a single tab/window. It is possible to multiple uploads by using multiple browser windows
- File upload can be initiated from:
From a revision detail screen, press the Add File button
Comment note screen, press the Add File button
From the menu Files --> New (or Upload?)
From the file list Upload File button?
- A form appears with a file select and data entry fields for the metadata
- The user selects a file to upload
- The user enters the metadata
- The filename field is optional. If it is left blank then it is filled in with the name of the file being uploaded
The users presses Upload on the form and the file is uploaded (displaying a progress bar)
- When the upload is complete:
- The file and metadata is automatically saved
- If the upload was performed in the context of an object, the file is automatically attached to it
- No confirmation step is required
Attaching Files to an Object
In a Revision Detail or Task screen, press the Add File button
- The choice will be given:
- Select a non-attached file
- Upload a file
Select the non-attached file radio button
- A form fill be displayed:
- Select a Folder
- When the folder select is changed, the file select, containing the list non-attached files dynamically refreshed
- Select a file from the folder
- The file's data is displayed in a data entry form
- Select a Folder
- Review file's metadata, and possibly change it
Press Attache File button
- The metadata is saved and the file is attached to the object
Editing File Metadata
- It is possible to edit a file's metadata
File Versioning
When a file is deleted, it is retained in the system (DO we need a deleted flag or other way of tracking this?)
- When files are replaced (re-uploaded), the previous file is retained in the system
- A copy of the file asset record is made for the new version of the file
- The previous file id is set to the id of the old record
- Files which have been transmitted are locked
Future Releases
Uploading ZIP Files
- The ZIP file is unpacked
- Each individual file is saved separately
- The metadata for the files is only entered once and is the same for each file (except for the file name)
Uploading Multiple Files in One Operation
- Allow the user to select more than one file to upload
- All metadata for the files will be the same, as entered in the form
- The filenames will be set to the uploaded files
Attaching Files
Additional options for attaching files:
From a revision or task note or New File press the Add File button.
- A new screen, or part of a screen, appears with the following choices:
- Upload a file
- Add the file from a basket
- Select a files which is not attached to anything
Select a flagged file (not included in first release?
Selecting File From a Basket
- Select a basket (paging required?)
- The basket's content is displayed (paging required?)
- Select a file from the basket
- Enter the metadata
- Press 'Go'
- The metadata is saved and the file is attached to the object
Selecting a Flagged File
- The list of flagged files is displayed
- Select a file from the list
- Review file's metadata, and possible change it
- Press 'Go'
- The metadata is saved and the file is attached to the object