From 98aa5fc4c4dc7e951710935cb8d72dc2f0976bdc Mon Sep 17 00:00:00 2001 From: jstirling91 Date: Wed, 18 Nov 2015 12:22:29 -0500 Subject: [PATCH 1/9] check to see if there is an error in the returned html and take action based on that --- modules/imaging_uploader/js/imaging_uploader.js | 10 ++++++++-- .../templates/menu_imaging_uploader.tpl | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/imaging_uploader/js/imaging_uploader.js b/modules/imaging_uploader/js/imaging_uploader.js index d7b6809f0a6..eb91f7fcef4 100644 --- a/modules/imaging_uploader/js/imaging_uploader.js +++ b/modules/imaging_uploader/js/imaging_uploader.js @@ -126,8 +126,14 @@ function uploadFile() { return xhr; }, success: function (data) { - alert("File Uploaded"); - location.reload(); + if (data.indexOf("The following errors occured while attempting to display this page:") > -1) { + document.open(); + document.write(data); + document.close(); + } else { + $("fileUpload").val(""); + $("#mri_upload").submit(); + } } }); } diff --git a/modules/imaging_uploader/templates/menu_imaging_uploader.tpl b/modules/imaging_uploader/templates/menu_imaging_uploader.tpl index aab42719369..b51a48b2b8f 100644 --- a/modules/imaging_uploader/templates/menu_imaging_uploader.tpl +++ b/modules/imaging_uploader/templates/menu_imaging_uploader.tpl @@ -144,6 +144,14 @@ *} + + + + + + +
{$page_links}
+
From 2e79ba1e49c4a9583f3abee8db4e07f887a6431d Mon Sep 17 00:00:00 2001 From: jstirling91 Date: Wed, 18 Nov 2015 13:41:44 -0500 Subject: [PATCH 2/9] make the page load with filters on reload --- modules/imaging_uploader/js/imaging_uploader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imaging_uploader/js/imaging_uploader.js b/modules/imaging_uploader/js/imaging_uploader.js index eb91f7fcef4..441747e9863 100644 --- a/modules/imaging_uploader/js/imaging_uploader.js +++ b/modules/imaging_uploader/js/imaging_uploader.js @@ -132,7 +132,7 @@ function uploadFile() { document.close(); } else { $("fileUpload").val(""); - $("#mri_upload").submit(); + $("#filter").click(); } } }); From 4845c8e35cf874c706109013105824d8b54d2db5 Mon Sep 17 00:00:00 2001 From: Ted Strauss Date: Wed, 18 Nov 2015 16:17:39 -0500 Subject: [PATCH 3/9] fixing 2 bugs on uploader form. --- .../php/NDB_Menu_Filter_imaging_uploader.class.inc | 5 +++++ smarty/templates/main.tpl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc b/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc index 5947d3b579c..349f090eef7 100644 --- a/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc +++ b/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc @@ -239,6 +239,7 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form { //make sure the file-name is valid $temp_file = $file->fileInfo['tmp_name']; + $temp_dir = $this->tempdir(); $db = Database::singleton(); $errors = array(); $config = NDB_Config::singleton(); @@ -249,6 +250,10 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form $header_patient_name = array(); $file_name = $file->fileInfo['name']; $file_path = $temp_dir. "/". $file_name; + $isPhantom = $args['values']['IsPhantom']; + if (empty($isPhantom)){ + $errors[] ="Make sure 'Are these Phantom Scans' is filled out."; + } /////////////////////////////////////////////////////////////////////// /////////Validate the advanced Options only if it's not a Phantom////// /////////////////////////////////////////////////////////////////////// diff --git a/smarty/templates/main.tpl b/smarty/templates/main.tpl index 92713c45d24..42b96919017 100644 --- a/smarty/templates/main.tpl +++ b/smarty/templates/main.tpl @@ -359,7 +359,7 @@ .

- + Please click here to go back .

From 33a1fd0257bfb83fed2658486861c27427c9952b Mon Sep 17 00:00:00 2001 From: Ted Strauss Date: Thu, 19 Nov 2015 10:33:28 -0500 Subject: [PATCH 4/9] phpcs --- .../php/NDB_Menu_Filter_imaging_uploader.class.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc b/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc index 349f090eef7..13ca950495c 100644 --- a/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc +++ b/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc @@ -251,7 +251,7 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form $file_name = $file->fileInfo['name']; $file_path = $temp_dir. "/". $file_name; $isPhantom = $args['values']['IsPhantom']; - if (empty($isPhantom)){ + if (empty($isPhantom)) { $errors[] ="Make sure 'Are these Phantom Scans' is filled out."; } /////////////////////////////////////////////////////////////////////// From 778369881a7c13faa93c36549ea6fc9344e4bafc Mon Sep 17 00:00:00 2001 From: Ted Strauss Date: Thu, 19 Nov 2015 11:57:17 -0500 Subject: [PATCH 5/9] revert back link to history.back --- smarty/templates/main.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smarty/templates/main.tpl b/smarty/templates/main.tpl index 42b96919017..92713c45d24 100644 --- a/smarty/templates/main.tpl +++ b/smarty/templates/main.tpl @@ -359,7 +359,7 @@ .

- + Please click here to go back .

From 7e9fed4024637e6e2ed96e72fa537cb2abd4a0b7 Mon Sep 17 00:00:00 2001 From: jstirling91 Date: Thu, 19 Nov 2015 12:29:35 -0500 Subject: [PATCH 6/9] blah --- .../php/NDB_Menu_Filter_imaging_uploader.class.inc | 2 +- smarty/templates/main.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc b/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc index 349f090eef7..13ca950495c 100644 --- a/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc +++ b/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc @@ -251,7 +251,7 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form $file_name = $file->fileInfo['name']; $file_path = $temp_dir. "/". $file_name; $isPhantom = $args['values']['IsPhantom']; - if (empty($isPhantom)){ + if (empty($isPhantom)) { $errors[] ="Make sure 'Are these Phantom Scans' is filled out."; } /////////////////////////////////////////////////////////////////////// diff --git a/smarty/templates/main.tpl b/smarty/templates/main.tpl index 42b96919017..92713c45d24 100644 --- a/smarty/templates/main.tpl +++ b/smarty/templates/main.tpl @@ -359,7 +359,7 @@ .

- + Please click here to go back .

From 6cc49812c2dfa4fc50ad2c8b87e9c0a8bc3a5187 Mon Sep 17 00:00:00 2001 From: jstirling91 Date: Thu, 19 Nov 2015 13:04:02 -0500 Subject: [PATCH 7/9] remove the progress bar functionality --- .../imaging_uploader/js/imaging_uploader.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/imaging_uploader/js/imaging_uploader.js b/modules/imaging_uploader/js/imaging_uploader.js index 441747e9863..d1ebb531e19 100644 --- a/modules/imaging_uploader/js/imaging_uploader.js +++ b/modules/imaging_uploader/js/imaging_uploader.js @@ -144,14 +144,14 @@ Main function $(function () { "use strict"; change(); - $(".submit-button").click( - function (e){ - if(e.currentTarget.id === "filter"){ - $("#mri_upload").submit(); - } else if (e.currentTarget.id === "upload"){ - e.preventDefault(); - uploadFile(); - } - } - ); + // $(".submit-button").click( + // function (e){ + // if(e.currentTarget.id === "filter"){ + // $("#mri_upload").submit(); + // } else if (e.currentTarget.id === "upload"){ + // e.preventDefault(); + // uploadFile(); + // } + // } + // ); }); From f4af6f0e0fe3e82e82664c66447409cc155eedbc Mon Sep 17 00:00:00 2001 From: Ted Strauss Date: Thu, 19 Nov 2015 14:50:08 -0500 Subject: [PATCH 8/9] appending string to error messages. --- .../NDB_Menu_Filter_imaging_uploader.class.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc b/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc index 13ca950495c..8dcb26cb1eb 100644 --- a/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc +++ b/modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc @@ -138,7 +138,8 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form ) { //catch file overload error... $upload_max_size = ini_get('upload_max_filesize'); $error_message = "Please make sure files are not larger than " . - $upload_max_size; + $upload_max_size . "
Please refresh this page to return ". + "to the Imaging Uploader module"; $tpl_data['error_message'][] = $error_message; } return true; @@ -252,7 +253,8 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form $file_path = $temp_dir. "/". $file_name; $isPhantom = $args['values']['IsPhantom']; if (empty($isPhantom)) { - $errors[] ="Make sure 'Are these Phantom Scans' is filled out."; + $errors[] ="Make sure 'Are these Phantom Scans' is filled out. +
Please refresh this page to return to the Imaging Uploader module"; } /////////////////////////////////////////////////////////////////////// /////////Validate the advanced Options only if it's not a Phantom////// @@ -266,7 +268,8 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form $visit_label = trim($args['values']['Visit_label']); if ((empty($candid)) || (empty($pscid)) || (empty($visit_label))) { $errors[] ="Make sure the CandID, PSCID and Visit_label are ". - "filled out "; + "filled out.
Please refresh this page to return to the Imaging + Uploader module."; } /////////////////////////////////////////////////////////////////////// @@ -287,7 +290,8 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form $errors[] = "Make sure you enter the CandID: $candid ,". " PSCID: $pscid and the corresponding". " Visit-label: $visit_label which". - " already exist"; + " already exist.
Please refresh this page". + "to return to the Imaging Uploader module"; } } } @@ -297,7 +301,8 @@ class NDB_Menu_Filter_Imaging_Uploader extends NDB_Menu_Filter_Form /////////////////////////////////////////////////////////////////////// if (!$this->isCompressed($temp_file)) { $errors[] = "The file $temp_file is not of type". - " .tgz, .tar.gz or .zip"; + " .tgz, .tar.gz or .zip.
Please refresh this + page to return to the Imaging Uploader module"; } if (count($errors) > 0) { From 18046c591f3784b211ea3c54969884db1002293d Mon Sep 17 00:00:00 2001 From: jstirling91 Date: Thu, 19 Nov 2015 14:52:26 -0500 Subject: [PATCH 9/9] readd the progress bar --- .../imaging_uploader/js/imaging_uploader.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/imaging_uploader/js/imaging_uploader.js b/modules/imaging_uploader/js/imaging_uploader.js index d1ebb531e19..441747e9863 100644 --- a/modules/imaging_uploader/js/imaging_uploader.js +++ b/modules/imaging_uploader/js/imaging_uploader.js @@ -144,14 +144,14 @@ Main function $(function () { "use strict"; change(); - // $(".submit-button").click( - // function (e){ - // if(e.currentTarget.id === "filter"){ - // $("#mri_upload").submit(); - // } else if (e.currentTarget.id === "upload"){ - // e.preventDefault(); - // uploadFile(); - // } - // } - // ); + $(".submit-button").click( + function (e){ + if(e.currentTarget.id === "filter"){ + $("#mri_upload").submit(); + } else if (e.currentTarget.id === "upload"){ + e.preventDefault(); + uploadFile(); + } + } + ); });