Skip to content

Commit

Permalink
Merge pull request #1415 from jstirling91/imaging_uploader_reload
Browse files Browse the repository at this point in the history
Imaging uploader reload
  • Loading branch information
driusan committed Nov 19, 2015
2 parents c49bfe4 + 4f446c7 commit a9e3804
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
10 changes: 8 additions & 2 deletions modules/imaging_uploader/js/imaging_uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
$("#filter").click();
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 . "<br>Please refresh this page to return ".
"to the Imaging Uploader module";
$tpl_data['error_message'][] = $error_message;
}
return true;
Expand Down Expand Up @@ -239,6 +240,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();
Expand All @@ -249,6 +251,11 @@ 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.
<br>Please refresh this page to return to the Imaging Uploader module";
}
///////////////////////////////////////////////////////////////////////
/////////Validate the advanced Options only if it's not a Phantom//////
///////////////////////////////////////////////////////////////////////
Expand All @@ -261,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. <br>Please refresh this page to return to the Imaging
Uploader module.";
}

///////////////////////////////////////////////////////////////////////
Expand All @@ -282,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. <br>Please refresh this page".
"to return to the Imaging Uploader module";
}
}
}
Expand All @@ -292,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. <br>Please refresh this
page to return to the Imaging Uploader module";
}

if (count($errors) > 0) {
Expand Down
8 changes: 8 additions & 0 deletions modules/imaging_uploader/templates/menu_imaging_uploader.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@
</table>
*}

<!-- title table with pagination -->
<table border="0" valign="bottom" width="100%">
<tr>
<!-- display pagination links -->
<td align="right">{$page_links}</td>
</tr>
</table>

<div class="row">
<table class ="dynamictable table table-hover table-primary table-bordered" border="0" width="100%">
<thead>
Expand Down

0 comments on commit a9e3804

Please sign in to comment.