diff options
Diffstat (limited to 'sourcecodes/net_structure.php')
| -rw-r--r-- | sourcecodes/net_structure.php | 175 |
1 files changed, 94 insertions, 81 deletions
diff --git a/sourcecodes/net_structure.php b/sourcecodes/net_structure.php index ac61e143..12126e45 100644 --- a/sourcecodes/net_structure.php +++ b/sourcecodes/net_structure.php @@ -1,42 +1,62 @@ <?php + //Going to modify this so it just writes the uploaded data to a file. + //Standardization and determining other factors will be performed in + // a Matlab/Octave script. + include("header_new.inc"); include("header_batchsearch.inc"); include("input_validate.php"); -////////////////continuous/////////////// + $searchID=""; $UploadValue="NO"; -$TextFile=$HTTP_POST_FILES["MyFile"]["name"]; - -if($_POST["My_key"]!="") - $keyval=$_POST["My_key"]; +$TextFile=$_FILES["MyFile"]["name"]; if($_GET["My_key"]!="") $keyval=$_GET["My_key"]; +if($_POST["My_key"]!="") + $keyval=$_POST["My_key"]; + $keyval=valid_keyval($keyval); $sid="structure_input"; -$dir="./data/$keyval"; +//$dir="./data/"; +//$dir="/tmp/bnw/".$keyval; +$dir="/var/lib/genenet/bnw/"; -$TextinFileFinal=$dir.$sid.".txt"; +$TextinFile=$dir.$keyval.$sid.".txt"; -$TextinFile=$dir.$sid."_temp.txt"; +//$TextinFileFinal=$dir.$sid.".txt"; -$TextinFilenamelist=$dir."name.txt"; +//$TextinFile=$dir.$sid."_temp.txt"; -if(isset($HTTP_POST_VARS["searchkey"])) +if(isset($_POST["searchkey"])) { - $searchID=$HTTP_POST_VARS["searchkey"]; + $searchID=$_POST["searchkey"]; + +} + +if($searchID=="") +{ +?> + +<!-- Site navigation menu --> +<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> +</ul> +<?php } -if(isset($HTTP_POST_VARS["MyUpload"])) +if(isset($_POST["MyUpload"])) { - $UploadValue=$HTTP_POST_VARS["MyUpload"]; + $UploadValue=$_POST["MyUpload"]; if ($UploadValue=="YES") { if($TextFile!="") { - $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile); + $sta=move_uploaded_file($_FILES['MyFile']['tmp_name'],$TextinFile); if(!$sta) { echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>"; @@ -45,14 +65,10 @@ if(isset($HTTP_POST_VARS["MyUpload"])) } else { - $searchID=file_get_contents("$TextinFile"); - //fclose($fh); - unlink($TextinFile); - + $searchID=file_get_contents("$TextinFile"); + //unlink($TextinFile); } - } - else { echo "<script type='text/javascript'> window.alert ('Sorry, please select upload file.')</script>"; @@ -60,79 +76,76 @@ if(isset($HTTP_POST_VARS["MyUpload"])) } } -if($searchID!="") -{ ?> - -<!-- Site navigation menu --> -<ul class="navbar2"> - <li><a href="graphviz_structure.php?My_key=<?php print($keyval);?>">Display structure</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> -<?php -} -else -{ - -?> -<!-- Site navigation menu --> -<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> -<?php -} -?> - <div id="outernew"> - -<h2>Upload network structure</h2> -<FORM name="key_search" enctype="multipart/form-data" ACTION="net_structure.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 structure file:</font><br> - <textarea name="searchkey" rows="10" cols="100"><?PHP print($searchID)?> </textarea> - </td> -</tr> -<tr> - <td> - <INPUT TYPE="submit" value=" Load example structure " onclick="return demo_str();">    +<h2><font>Upload structure file</font></h2> +<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="net_structure.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 structure " onclick="return demo_str();">    <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!="") + { + if ($UploadValue=="NO") + { $str_arr=array(); $searchID=trim($searchID); $str_arr=explode("\n",$searchID); $data=array(); - - $fpmain = fopen($TextinFileFinal,"w"); - + + $fpmain = fopen($TextinFile,"w"); + foreach($str_arr as $line) { - $line=trim($line); - fwrite($fpmain, "$line\n"); - - } + $line=trim($line); + fwrite($fpmain, "$line\n"); + } + } +?> +<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> +</ul> +<div id="outernew_load"> +<br> +<a class=button3 href="graphviz_structure.php?My_key=<?php print($keyval);?>">Display uploaded network</a> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<?php +} ?> + +</body> +</html> + + |
