about summary refs log tree commit diff
path: root/sourcecodes/upload_structure_file.php
diff options
context:
space:
mode:
authorziejd22021-02-24 14:36:59 -0600
committerziejd22021-02-24 14:36:59 -0600
commit25b843f6bbacb1937bdb960777b73acbece64115 (patch)
tree88645b9d1d8a0eea19d7229555bf8805571bc8b7 /sourcecodes/upload_structure_file.php
parent33cedf36248f616aa37d1462c69a4a3058a5d92e (diff)
downloadBNW-25b843f6bbacb1937bdb960777b73acbece64115.tar.gz
GENENET8 update
Diffstat (limited to 'sourcecodes/upload_structure_file.php')
-rw-r--r--sourcecodes/upload_structure_file.php97
1 files changed, 61 insertions, 36 deletions
diff --git a/sourcecodes/upload_structure_file.php b/sourcecodes/upload_structure_file.php
index 9eb6694b..35758533 100644
--- a/sourcecodes/upload_structure_file.php
+++ b/sourcecodes/upload_structure_file.php
@@ -1,3 +1,6 @@
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
 <?php
   //Going to modify this so it just writes the uploaded data to a file.
   //Standardization and determining other factors will be performed in
@@ -10,7 +13,7 @@ include("input_validate.php");
 
 $searchID="";
 $UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+$TextFile=$_FILES["MyFile"]["name"];
 
 
 /////////////Generate a random key/////////////////////
@@ -31,14 +34,19 @@ if($_POST["My_key"]!="")
 $keyval=valid_keyval($keyval);
 
 $sid=$keyval."continuous_input";
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+
+//$input_table_file="./data/".$keyval."input_table.txt";
+$input_table_file=$dir.$keyval."input_table.txt";
 
 $TextinFile=$dir.$sid."_orig.txt";
 
 
-if(isset($HTTP_POST_VARS["searchkey"]))
+if(isset($_POST["searchkey"]))
 {
-   $searchID=$HTTP_POST_VARS["searchkey"];
+   $searchID=$_POST["searchkey"];
 
 }
 
@@ -47,7 +55,7 @@ if($searchID=="")
 ?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
+<ul class="navbar2">
   <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
@@ -55,9 +63,9 @@ if($searchID=="")
 <?php
 }
 
-if(isset($HTTP_POST_VARS["MyUpload"]))
+if(isset($_POST["MyUpload"]))
 {
-   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   $UploadValue=$_POST["MyUpload"];
    if ($UploadValue=="YES")
    {
         if($TextFile!="")
@@ -88,32 +96,26 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
 ?>
 <div id="outernew">
 <h2><font>Upload data file</font></h2>
-<FORM name="key_search" enctype="multipart/form-data" ACTION="upload_structure_file.php" METHOD=POST>
-
-<table align="left" cellspacing="3" cellpadding="1" border="0"  width="90%">
-<tr>
-   <td>
-       <INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 > 
-       <INPUT TYPE="submit" value="  Upload  " onclick="return Upload();">
-      <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-        <INPUT TYPE="hidden" name="MyUpload" value="NO"> 
-   </td>
-</tr>
-<tr>
-   <td><font color=#3735CA><br>Content of uploaded data file:</font><br>
-          <textarea name="searchkey" rows="10" cols="100"><?PHP print($searchID)?> </textarea>
-  </td>
-</tr>
-<tr>
-    <td>
-       <INPUT TYPE="submit" value="  Load example data  " onclick="return demo();">&nbsp&nbsp&nbsp
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="upload_structure_file.php" METHOD=POST>
+<INPUT style="background-color:#FFFFFF;" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()" >
+<label for="MyFile_id">Choose a file. . .</label>
+  <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+<INPUT TYPE="hidden" name="MyUpload" value="NO">
+  <textarea name="searchkey" style="display:none;"><?PHP print($searchID)?> </textarea>
+<br><br>
+  <INPUT TYPE="submit" class=button2 value="  Load example data  " onclick="return demo();">&nbsp&nbsp&nbsp
       <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-    </td>
-</tr>
-
-</table>
 </FORM>
 </div>
+<script>
+  function upload_submit() {
+    Upload();
+    document.getElementById("in_form").submit();
+  }
+</script>
+
+
+
 <?php
 
 if($searchID!="")
@@ -126,16 +128,39 @@ if($searchID!="")
   shell_exec('./run_scripts/run_prep_input '.$keyval);
 ?>
 <ul class="navbar2">
-  <li><a href="net_structure.php?My_key=<?php print($keyval);?>">Upload structure file</a>
-  <li><a href="javascript:void(0);"
-NAME="InputCheck" title="InputCheck"
-    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Rat//ting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
-</ul>
-<ul class="navbar">
   <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
 </ul>
+<div id="outernew_load">
+<br>
+<a class=button3 href="net_structure.php?My_key=<?php print($keyval);?>">Upload structure file</a>
+<br>
+<br>
+<p><h3>The variables in the data file have the following properties:
+<br></h3>
+<?php
+$table_text = json_encode(file("file://".$input_table_file));
+?>
+  <div class="d3_table" id="table_div1">
+  <script type="text/javascript">
+   d3.text("", function(error, raw_temp){
+       var dsv = d3.dsvFormat("\t");
+       var data1 = <?php echo $table_text?>;
+	var data2 = data1.join("");
+	 var data = dsv.parse(data2);
+	 var caption_text = data.pop();
+       if (error) throw error;
+       tabulate_caption("#table_div1",data,caption_text.Variable);
+     });
+</script>
+</div>
+<br><br><br></h3>
+</p>
+<br>
+
+
+
 <?php
 }
 ?>