$equipmentid = GetVariable("equipmentid"); $siteid = GetVariable("siteid"); $projectid = GetVariable("projectid"); $instanceid = GetVariable("instanceid"); $transactionid = GetVariable("transactionid"); $altuid = GetVariable("altuid"); $instance = GetVariable("instance"); $dataformat = GetVariable("dataformat"); $matchidonly = GetVariable("matchidonly"); switch($action) { case 'UploadNonDICOM': UploadDICOM($uuid, $anonymize, $dataformat, $equipmentid, $siteid, $projectid, $instanceid, $matchidonly,$transactionid); break; case 'UploadDICOM': UploadDICOM($uuid, $anonymize, $dataformat, $equipmentid, $siteid, $projectid, $instanceid, $matchidonly,$transactionid); break; case 'getUID': GetUIDFromAltUID($altuid); break; case 'getInstanceList': GetInstanceList($u); break; case 'getProjectList': GetProjectList($u, $instance); break; case 'getSiteList': GetSiteList($u, $instance); break; case 'getEquipmentList': GetEquipmentList(); break; case 'startTransaction': StartTransaction($u); break; case 'endTransaction': EndTransaction($transactionid); break; default: echo "Welcome to NiDB v" . $GLOBALS['cfg']['version']; } /* -------------------------------------------- */ /* ------- Authenticate ----------------------- */ /* -------------------------------------------- */ function Authenticate($username, $password) { $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); if ((AuthenticateUnixUser($username, $password)) && (!$GLOBALS['ispublic'])) {
$seriesnotes = GetVariable("seriesnotes"); switch ($action) { case 'UploadNonDICOM': UploadDICOM($uuid, $seriesnotes, $altuids, $anonymize, $dataformat, $equipmentid, $siteid, $projectid, $instanceid, $matchidonly, $transactionid); break; case 'UploadDICOM': UploadDICOM($uuid, $seriesnotes, $altuids, $anonymize, $dataformat, $equipmentid, $siteid, $projectid, $instanceid, $matchidonly, $transactionid); break; case 'getUID': GetUIDFromAltUID($altuid); break; case 'getInstanceList': GetInstanceList($u); break; case 'getProjectList': GetProjectList($u, $instance); break; case 'getSiteList': GetSiteList($u, $instance); break; case 'getEquipmentList': GetEquipmentList(); break; case 'startTransaction': StartTransaction($u); break; case 'endTransaction': EndTransaction($transactionid); break; default: echo "Welcome to NiDB v" . $GLOBALS['cfg']['version'];
function DisplayImportMenu() { $urllist['Home'] = "index.php"; $urllist['Import'] = "import.php"; $urllist['Import'] = "import.php?action=import"; NavigationBar("Import", $urllist); ?> <style> .gradientsummary { background: -moz-linear-gradient(left, rgba(151,187,229,1) 0%, rgba(151,187,229,0.99) 1%, rgba(125,185,232,0) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(151,187,229,1)), color-stop(1%,rgba(151,187,229,0.99)), color-stop(100%,rgba(125,185,232,0))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(left, rgba(151,187,229,1) 0%,rgba(151,187,229,0.99) 1%,rgba(125,185,232,0) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(left, rgba(151,187,229,1) 0%,rgba(151,187,229,0.99) 1%,rgba(125,185,232,0) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(left, rgba(151,187,229,1) 0%,rgba(151,187,229,0.99) 1%,rgba(125,185,232,0) 100%); /* IE10+ */ background: linear-gradient(to right, rgba(151,187,229,1) 0%,rgba(151,187,229,0.99) 1%,rgba(125,185,232,0) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#97bbe5', endColorstr='#007db9e8',GradientType=1 ); /* IE6-9 */ color: black; /*font-weight:bold*/ } </style> <script> function AlphaNumeric(e) { var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.which; else return true; keychar = String.fromCharCode(key); keychar = keychar.toLowerCase(); // control keys if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) return true; // alphas and numbers else if ((("abcdefghijklmnopqrstuvwxyz0123456789_").indexOf(keychar) > -1)) return true; else return false; } </script> <div style="font-weight:bold; color: darkblue; font-size:14pt">Upload data to NiDB</div> <br> <span style="color:#444">Instance <b><?php echo $GLOBALS['instancename']; ?> </b></span> <br> <br> <div style="padding:8px; border: 1px solid #ccc; border-radius:5px"> <b>Web upload ( < 1GB file size )</b> <table width="100%"> <tr> <td> <table class="entrytable"> <form action="import.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="uploaddicom"> <tr> <td class="label">Site</td> <td> <select name="siteid" required> <option value="">Select site...</option> <? $s = GetSiteList(); foreach ($s as $site) { ?><option value="<?php echo $site['id']; ?> "><?php echo $site['name']; ?> </option><? } ?> </select> </td> </tr> <tr> <td class="label">Project</td> <td> <select name="projectid" required> <option value="">Select project...</option> <? $projects = GetProjectList(); foreach ($projects as $p) { ?><option value="<?php echo $p['projectid']; ?> "><?php echo $p['name']; ?> (<?php echo $p['costcenter']; ?> )</option><? } ?> </select> </td> </tr> <? if (!$GLOBALS['cfg']['ispublic']) { ?> <tr> <td class="label">Anonymize?</td> <td><input type="checkbox" name="anonymize" value="1" checked></td> </tr> <? } ?> <tr> <td class="label">Select files<br><span class="tiny">DICOM files only. Or any zip<br>file containing DICOM files</span></td> <td><input type="file" name="files[]" multiple style="border:none"></td> </tr> <tr> <td colspan="2"><input type="submit" value="Import DICOM"></td> </tr> </form> </table> </td> </tr> </table> </div> <br> <script> $(document).ready(function() { var MaxInputs = 8; //maximum input boxes allowed var InputsWrapper = $("#InputsWrapper"); //Input boxes wrapper ID var AddButton = $("#AddMoreFileBox"); //Add button ID var x = InputsWrapper.length; //initlal text box count var FieldCount=1; //to keep track of text box added $(AddButton).click(function (e) //on add input button click { if(x <= MaxInputs) //max input box allowed { FieldCount++; //text box added increment //add input box $(InputsWrapper).append('<span> / <select name="importdirs[]" id="field_'+ FieldCount +'"><option value="modality">Modality</option><option value="subjectid">Subject ID</option><option value="seriesdesc">Series description</option><option value="seriesnum">Series number</option><option value="studydesc">Study Description</option><option value="studydatetime">Study datetime</option><option value="thefiles">{The files}</option><option value="beh">beh</option></select><a href="#" class="removeclass">×</a></span>'); x++; //text box increment } return false; }); $("body").on("click",".removeclass", function(e){ //user click on remove text if( x > 1 ) { $(this).parent('span').remove(); //remove text box x--; //decrement textbox } return false; }); $('#nondicomform').on('submit', function(e) { //prevent the default submithandling e.preventDefault(); //send the data of 'this' (the matched form) to yourURL var posting = $.post('import.php', $(this).serialize(), function(data) { $( "#result" ).empty().append( data ); }); }); }); </script> <style> .removeclass { color: darkred; text-decoration:none; } .removeclass:hover { text-decoration:underline; } .direxample { font-family: monospace; white-space: pre; font-size:10pt } .btn { background-color: #ccc; border: 1px solid gray; color: black; text-decoration: none; padding: 1px 4px; } .freelabel {font-weight: bold; text-align: right; padding-right: 10px; vertical-align: top; color: #666666; font-size:12pt; white-space:nowrap; } </style> <details> <summary>Import non-DICOM Image Data</summary> <form action="import.php" id="nondicomform" method="post"> <input type="hidden" name="apiaction" value="uploadnondicom"> <div style="margin-left: 20px; padding:8px;"> <table width="100%"> <tr> <td> <table class="entrytable"> <tr> <td class="label">Site</td> <td> <select name="siteid" required> <option value="">Select site...</option> <? $s = GetSiteList(); foreach ($s as $site) { ?><option value="<?php echo $site['id']; ?> "><?php echo $site['name']; ?> </option><? } ?> </select> </td> </tr> <tr> <td class="label">Project</td> <td> <select name="projectid" required> <option value="">Select project...</option> <? $projects = GetProjectList(); foreach ($projects as $p) { ?><option value="<?php echo $p['projectid']; ?> "><?php echo $p['name']; ?> (<?php echo $p['costcenter']; ?> )</option><? } ?> </select> </td> </tr> <tr> <td colspan="2"> <span class="freelabel">Directory structure</span> <br> <details> <summary style="font-size:10pt">Example directory structures</summary> <table> <tr> <td style="padding:2px 20px;"> <span class="direxample">/MR/23490802/t1/{files}</span> </td> <td>→</td> <td style="padding:2px 20px;"> <span class="direxample">/Modality/SubjectID/SeriesDesc/{The files}</span> </td> </tr> <tr> <td style="padding:2px 20px;"> <span class="direxample">/34890JKP/20140324_120934/5/{files}/beh</span> </td> <td>→</td> <td style="padding:2px 20px;"> <span class="direxample">/SubjectID/StudyDatetime/SeriesNum/{The files}/beh</span> </td> </tr> </table> </details> <br> <a href="#" id="AddMoreFileBox" class="btn">Add Directory →</a> <div id="InputsWrapper"> <span><select name="importdirs[]" id="field_0"><option value="modality">Modality</option><option value="subjectid">Subject ID</option><option value="seriesdesc">Series description</option><option value="seriesnum">Series number</option><option value="studydesc">Study Description</option><option value="studydatetime">Study datetime</option><option value="thefiles"><span style="color: blue">{The files}</span></option><option value="beh">beh</option></select><a href="#" class="removeclass">×</a></span> </div> <br> </td> </tr> <tr> <td colspan="2"><input type="submit" value="Import non-DICOM"> <div id="result" style="color: darkred"></div></td> </tr> </table> </td> </tr> </table> </div> </form> </details> <br> <? if ($_SESSION['enablebeta']) { ?> <details> <summary>Import Subject Demographics <?php echo PrintBeta(); ?> </summary> <div style="margin-left: 40px; padding:8px; background-color: #e5eeff"> <table width="100%"> <tr> <td valign="top"> <table class="entrytable" style="border:1px solid #ccc"> <form action="import.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="importdemographics"> <tr> <td class="label">Site</td> <td> <select name="siteid" required> <option value="">Select site...</option> <? $s = GetSiteList(); foreach ($s as $site) { ?><option value="<?php echo $site['id']; ?> "><?php echo $site['name']; ?> </option><? } ?> </select> </td> </tr> <tr> <td class="label">Project</td> <td> <select name="projectid" required> <option value="">Select project...</option> <? $projects = GetProjectList(); foreach ($projects as $p) { ?><option value="<?php echo $p['projectid']; ?> "><?php echo $p['name']; ?> (<?php echo $p['costcenter']; ?> )</option><? } ?> </select> </td> </tr> <tr> <td class="label">Select files<br><span class="tiny">.csv file in<br>NiDB demographics format</span></td> <td><input type="file" name="files[]" multiple style="border:none"></td> </tr> <tr> <td colspan="2"><input type="submit" value="Import Demographics"></td> </tr> </form> </table> </td> <td valign="top"> .csv format <div style="border: 1px dashed #ccc;font-family: monospace; white-space: pre; font-size:8pt"> UID, sex, ethnicity, race, weight, height, handedness, education, maritalstatus, smokingstatus </div> <br> <b>Column values</b> <ul style="font-size:10pt"> <li>Sex <ul> <li>M - Male <li>F - Female <li>O - Other <li>U - Unknown </ul> <li><b>Ethnicity:</b> hispanic, nothispanic <li><b>Race:</b> unknown, asian, black, indian, islander, mixed, white, other <li><b>Weight</b> (in kg) <li><b>Height</b> (in meters) <li>Handedness <ul> <li>L - Left <li>R - Right <li>A - Ambidextrous <li>U - Unknown </ul> <li>Education <ul> <li>0 - Unknown <li>1 - Grade school <li>2 - Middle school <li>3 - High school/GED <li>4 - Trade school <li>5 - Associates degree <li>6 - Bachelors degree <li>7 - Masters degree <li>8 - Doctoral degree </ul> <li><b>Marital status:</b> unknown, married, single, divorced, separated, civilunion, cohabitating, widowed <li><b>Smoking status:</b> unknown, never, current, past </ul> </td> </tr> </table> </div> </details> <br> <? } ?> <details> <summary>Import Assessment Forms</summary> <div style="margin-left: 20px; padding:8px;"> <table width="100%"> <tr> <td valign="top"> <table class="entrytable"> <form action="import.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="importassessmentform"> <!--<tr> <td class="label">Form Name</td> <td><input type="text" name="newformname" maxlength="50" onKeyPress="return AlphaNumeric(event)"></td> </tr>--> <tr> <td class="label">Select files<br><span class="tiny">.csv file in NiDB<br>assessment format</span></td> <td><input type="file" name="files[]" multiple style="border:none"></td> </tr> <tr> <td colspan="2"><input type="submit" value="Import Assessment Forms"></td> </tr> </form> </table> </td> <td valign="top"> .csv format <div style="border: 1px dashed #ccc;font-family: monospace; white-space: pre; font-size:8pt; padding: 5px">Title,,,, description,,,, question_num, question_text, datatype, values, comment</div> First line contains title, second line contains description. The remaining lines contain the questions <br><br> <b>Datatype</b> <ul> <li title="<big><b>multichoice Example</b></big><br><br><i>DSM Classification</i><br><br>100.1 - Silly<br>100.2 - Absurd<br>100.3 - Funny<br>100.4 - Humerous">multichoice <span class="tiny">List of pre-selected answers, multiple can be selected</span> <li title="<big><b>singlechoice Example</b></big><br><br><i>Handedness</i><br><br>L<br>R<br>B">singlechoice <span class="tiny">List of pre-selected answers, only one can be selected</span> <li>string <span class="tiny">Single line of text</span> <li>text <span class="tiny">Multiple lines of text</span> <li title="<big><b>singlechoice Example</b></big><br><br>3.141592 <i>or</i> 5">number <span class="tiny">Value that must be numeric</span> <li title="<big><b>singlechoice Example</b></big><br><br>2014/03/01">date <span class="tiny">A date</span> <li title="<big><b>singlechoice Example</b></big><br><br>The following section will assess your well-being">header <span class="tiny">Information, or section separator</span> </ul> </tr> </table> </div> </details> <br> <? if ($_SESSION['enablebeta']) { ?> <details> <summary>Import Assessment Data <?php echo PrintBeta(); ?> </summary> <div style="margin-left: 20px; padding:8px;"> <table width="100%"> <tr> <td> <table class="entrytable"> <form action="import.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="importassessmentdata"> <tr> <td class="label" colspan="2"><a href="import.php?action=viewassessmentforms">View Available Assessment Forms</a></td> </tr> <tr> <td class="label">Site</td> <td> <select name="siteid" required> <option value="">Select site...</option> <? $s = GetSiteList(); foreach ($s as $site) { ?><option value="<?php echo $site['id']; ?> "><?php echo $site['name']; ?> </option><? } ?> </select> </td> </tr> <tr> <td class="label">Project</td> <td> <select name="projectid" required> <option value="">Select project...</option> <? $projects = GetProjectList(); foreach ($projects as $p) { ?><option value="<?php echo $p['projectid']; ?> "><?php echo $p['name']; ?> (<?php echo $p['costcenter']; ?> )</option><? } ?> </select> </td> </tr> <tr> <td class="label">Select files<br><span class="tiny">.csv file in NiDB<br>assessment data format</span></td> <td><input type="file" name="files[]" multiple style="border:none"></td> </tr> <tr> <td colspan="2"><input type="submit" value="Import Assessment Scores"></td> </tr> </form> </table> </td> </tr> </table> </div> </details> <br> <? } ?> <? if ($_SESSION['enablebeta']) { ?> <details> <summary>Import Measures (name/value pairs only) <?php echo PrintBeta(); ?> </summary> <div style="margin-left: 20px; padding:8px;"> <table width="100%"> <tr> <td> <table class="entrytable"> <form action="import.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="importmeasures"> <tr> <td class="label">Site</td> <td> <select name="siteid" required> <option value="">Select site...</option> <? $s = GetSiteList(); foreach ($s as $site) { ?><option value="<?php echo $site['id']; ?> "><?php echo $site['name']; ?> </option><? } ?> </select> </td> </tr> <tr> <td class="label">Project</td> <td> <select name="projectid" required> <option value="">Select project...</option> <? $projects = GetProjectList(); foreach ($projects as $p) { ?><option value="<?php echo $p['projectid']; ?> "><?php echo $p['name']; ?> (<?php echo $p['costcenter']; ?> )</option><? } ?> </select> </td> </tr> <tr> <td class="label">Select .csv files</td> <td><input type="file" name="files[]" multiple required style="border:none"></td> </tr> <tr> <td class="label">File format</td> <td> <table cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <input type="radio" name="fileformat" value="short" required>Short rows <img src="images/help.gif" title="One row for each measure/value pair, no header"> </td> <td valign="top"> <details><summary class="tiny">File format example</summary><pre style="font-size:10pt; border: 1px solid #aaa; border-radius:3px; padding: 5px">S1234ABC, instrument1, measure1, value<br>S1234ABC, instrument1, measure2, value<br>S1234ABC, instrument2, measure1, value<br>S1234ABC, instrument2, measure3, value</pre></details> </td> </tr> <tr> <td valign="top"> <input type="radio" name="fileformat" value="long" required>Long rows <img src="images/help.gif" title="One row for each subject, with header"> </td> <td valign="top"> <details><summary class="tiny">File format example</summary><pre style="font-size:10pt; border: 1px solid #aaa; border-radius:3px; padding: 5px">-, instrument1, instrument1, instrument2, instrument2, etc<br>UID, measure1, measure2, measure1, measure3, etc<br>S1234ABC, value1, value2, value3, value4, etc<br>S5678LMN, value1, value2, value3, value4, etc<br>S9292XYZ, value1, value2, value3, value4, etc</pre></details> </td> </tr> </table> </td> </tr> <tr> <td colspan="2"><input type="submit" value="Import Measures"></td> </tr> </form> </table> </td> </tr> </table> </div> </details> <? } ?> <? }