From 6e2f3e082562a5e248dc13a7352a5b93f745eb10 Mon Sep 17 00:00:00 2001 From: Laetitia Fesselier Date: Tue, 4 Apr 2023 14:43:20 -0400 Subject: [PATCH] Review changes --- modules/electrophysiology_uploader/README.md | 51 +++++++++++++++++++ .../jsx/UploadViewer.js | 14 +++-- .../php/electrophysiology_uploader.class.inc | 2 +- .../php/upload.class.inc | 9 ++-- 4 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 modules/electrophysiology_uploader/README.md diff --git a/modules/electrophysiology_uploader/README.md b/modules/electrophysiology_uploader/README.md new file mode 100644 index 00000000000..697f0642cb4 --- /dev/null +++ b/modules/electrophysiology_uploader/README.md @@ -0,0 +1,51 @@ +# Electrophysiology Uploader + +## Purpose + +The electrophysiology uploader is intended to allow users to upload and browse electrophysiology files. + + +## Intended Users + +The primary users are EEG technicians or site coordinators uploading EEG recordings +for registered LORIS candidates and timepoints. + +## Scope + +The electrophysiology uploader has the following built-in capabilities to facilitate +timely eeg insertion into the LORIS database. Specifically, it allows to browse +uploaded recordings using the `Browse` tab and upload recordings using the `Upload` +tab. + +EEG recordings can be reuploaded multiple times. Previous upload attempts will be backup in _EEGUploadIncomingPath_/archives/. + +## Permissions + +#### Module Permission + +Permission `electrophysiology_browser_view_allsites` or `electrophysiology_browser_view_site` +is necessary to have access to the module and gives the user the ability to +upload and browse all recordings uploaded to the database. + +#### Filesystem Permission + +The path on the filesystem where the uploaded files go (_EEGUploadIncomingPath_) should be +readable and writable by the web server. + +## Configurations + +The electrophysiology uploader has the following configurations that affect its usage: + +### Install Configurations + +To enable the module to handle large files, please follow the +instructons for [Handling Large File Uploads](../../docs/wiki/00_SERVER_INSTALL_AND_CONFIGURATION/02_Website_Configuration/Handling_Large_File_Uploads.md). + +#### Database Configurations + +EEGUploadIncomingPath - This setting determines where on the filesystem the + uploader is to place the uploaded recordings. + **Note**: Uploaded recordings are erased from the + `EEGUploadIncomingPath` following a successful archival and insertion + through the LORIS-MRI pipeline. + diff --git a/modules/electrophysiology_uploader/jsx/UploadViewer.js b/modules/electrophysiology_uploader/jsx/UploadViewer.js index bd34b379fbb..a1000eeae5e 100644 --- a/modules/electrophysiology_uploader/jsx/UploadViewer.js +++ b/modules/electrophysiology_uploader/jsx/UploadViewer.js @@ -77,14 +77,12 @@ export default function UploadViewer(props) { ]; return ( - <> - - + ); } diff --git a/modules/electrophysiology_uploader/php/electrophysiology_uploader.class.inc b/modules/electrophysiology_uploader/php/electrophysiology_uploader.class.inc index fc744132ae4..321867fc60d 100644 --- a/modules/electrophysiology_uploader/php/electrophysiology_uploader.class.inc +++ b/modules/electrophysiology_uploader/php/electrophysiology_uploader.class.inc @@ -50,7 +50,7 @@ class Electrophysiology_Uploader extends \DataFrameworkMenu */ public function useProjectFilter(): bool { - return false; + return true; } /** diff --git a/modules/electrophysiology_uploader/php/upload.class.inc b/modules/electrophysiology_uploader/php/upload.class.inc index f11d6519891..3f649e454ec 100644 --- a/modules/electrophysiology_uploader/php/upload.class.inc +++ b/modules/electrophysiology_uploader/php/upload.class.inc @@ -125,8 +125,8 @@ class Upload extends \NDB_Page if (empty($request->getUploadedFiles()) && empty($values)) { $upload_max_size = \Utility::getMaxUploadSize(); return new \LORIS\Http\Response\JSON\InternalServerError( - "The uploaded file size ($upload_max_size) exceeds " . - "the upload_max_filesize or post_max_size directive in php.ini" + "The uploaded file size exceeds the upload_max_filesize " . + "or post_max_size directive in php.ini ($upload_max_size)" ); } @@ -176,7 +176,10 @@ class Upload extends \NDB_Page ); } - // Check for existing files + // Check for an existing file + // If found, add a timestamp suffix to avoid collision + // with any other existing upload attempt + // and move the renamed file in _EEGUploadIncomingPath_/archives/ $targetPath = $targetdir->getPathname() . '/' . $filename; if (file_exists($targetPath)) { $archiveFilename = str_replace(