about summary refs log tree commit diff
path: root/sourcecodes/layout_svg_wt.php
diff options
context:
space:
mode:
authorziejd22021-02-24 14:36:59 -0600
committerziejd22021-02-24 14:36:59 -0600
commit25b843f6bbacb1937bdb960777b73acbece64115 (patch)
tree88645b9d1d8a0eea19d7229555bf8805571bc8b7 /sourcecodes/layout_svg_wt.php
parent33cedf36248f616aa37d1462c69a4a3058a5d92e (diff)
downloadBNW-25b843f6bbacb1937bdb960777b73acbece64115.tar.gz
GENENET8 update
Diffstat (limited to 'sourcecodes/layout_svg_wt.php')
-rw-r--r--sourcecodes/layout_svg_wt.php140
1 files changed, 59 insertions, 81 deletions
diff --git a/sourcecodes/layout_svg_wt.php b/sourcecodes/layout_svg_wt.php
index f24bb338..3f4bc6f0 100644
--- a/sourcecodes/layout_svg_wt.php
+++ b/sourcecodes/layout_svg_wt.php
@@ -1,21 +1,10 @@
 <!DOCTYPE html>
 <html>
 <head>
-<style>
-.button {
-  font-family: Times;
-  background-color: #33339F;
-  border: none;
- color: white;
- padding: 5px 5px;
-   text-align: center;
-   font-size: 16px;
- }
-
-.button:hover {
-  background-color: blue;
- }
-</style>
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
+
 </head>
 
 <?php
@@ -24,9 +13,10 @@ include("header_new.inc");
 include("input_validate.php");
 $keyval=valid_keyval($_GET["My_key"]);
 
-$dir="./data/";
+//$dir="./data/";
+$dir="/var/lib/genenet/bnw/";
 
-$svg_file=$dir.$keyval."network.svg";
+$svg_file=$keyval."network.svg";
 $png_file=$keyval."network.png";
 
 
@@ -47,94 +37,76 @@ function calcHeight()
 //-->
 </script>
 
-<script src="http://d3js.org/d3.v4.min.js" charset="utf-8"></script>
-<script src="http://d3js.org/d3-selection-multi.v1.js"></script>
-<script src="https://cdn.rawgit.com/eligrey/canvas-toBlob.js/f1a01896135ab378aa5c0118eadd81da55e698d8/canvas-toBlob.js"></script>
-<script src="https://cdn.rawgit.com/eligrey/FileSaver.js/e9d941381475b5df8b7d7691013401e171014e89/FileSaver.min.js"></script>
+<script src="./scripts/d3.v4.min.js" charset="utf-8"></script>
+<script src="./scripts/d3-selection-multi.v1.js"></script>
+<script src="./scripts/canvas-toBlob.js"></script>
+<script src="./scripts/FileSaver.min.js"></script>
 
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-   <li><p>Network ID:<br><?php print($keyval);?></p></li>
+<li class="noHover">Network ID:<br><?php print($keyval);?></li>
+<li><a href="layout.php?My_key=<?php print($keyval);?>">Use network to make predictions</a></li>
 </ul>
-
-<ul class="navbar">
-<li><a href="layout.php?My_key=<?php print($keyval);?>">Use network to make predictions</a>
-<li><a href="layout_cyto.php?My_key=<?php print($keyval);?>" target='_blank'>Modify network structure</a>
+  <button class="accordion">Network image options&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+<li><a href="layout_svg_no.php?My_key=<?php print($keyval);?>">Hide edge weights</a></li>
+</li>
+<button id='saveButton' class="button1">Save network as PNG</button>
+<button id='saveButton_svg' class="button1">Save network as SVG</button>
+</ul>
+</div>
+   <button class="accordion">More about network&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+  <li><a href="matrix_new.php?My_key=<?php print($keyval);?>" target="_blank">View structure matrix</a>  
+  <li><a href="parameter_display.php?My_key=<?php print($keyval);?>" target="_blank">View network parameters</a>  
+  <li><a href="review_settings.php?My_key=<?php print($keyval);?>" target="_blank">View structure learning settings</a>  
+  <li><a href="input_check.php?My_key=<?php print($keyval);?>" target="_blank">View input data and descriptions</a>  
+</ul>
+</div>
+ <button class="accordion">Modify network structure&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+<li><a href="layout_cyto.php?My_key=<?php print($keyval);?>" target='_blank'>Add or remove edges from network</a>
 <li><a href="modify_structure_learning.php?My_key=<?php print($keyval);?>" target='_blank';>Modify structure learning settings</a>
-  <li><a href="javascript:void(0);"
-NAME="Model Averaging Matrix" title="Model Averaging Matrix"
-onClick=window.open("matrix.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>Display structure matrix</a>  
- <li><a href="help.php" target='_blank'>Help</a> 
+<li><a href="remove_variables.php?My_key=<?php print($keyval);?>" target='_blank';>Select variables to remove and relearn structure</a>
+</ul>
+</div>
+<ul class="navbar2">
+ <li><a href="about_this_page.php#network_structure" target='_blank'>About this page</a>
+ <li><a href="help.php" target='_blank'>Help</a>
  <li><a href="../home.php">Home</a>
 </ul>
 
-<div id="svg_div">
 
-<a href="layout_svg_no.php?My_key=<?php print($keyval);?>"><button type="submit" class="button">Remove edge weights</button></a>
-&nbsp;
-&nbsp;
-&nbsp;
-<button id='saveButton' class="button">Save network as PNG</button>
-&nbsp;
-&nbsp;
-&nbsp;
-<a href="<?php print($svg_file);?>" download><button type="submit" class="button">Save network as SVG</button></a>
+
+
+<div id="svg_div">
 <br>
 <br>
 
 
 <script>
-  //onload = "makeDraggable(evt)";
 
-d3.xml("<?php print($svg_file);?>", function(error, documentFragment){
-  if (error) {console.log(error); return;}
 
-  
+<?php
+$svg_xml = json_encode(file("file://".$dir.$svg_file));
+?>
+d3.xml("", function(dumm){
+ var data1 = <?php echo $svg_xml;?>;
+ var data2 = data1.join("");
+ parser = new DOMParser();
+ documentFragment = parser.parseFromString(data2,"text/xml");
  var svgNode = documentFragment
     .getElementsByTagName("svg")[0];
 
   d3.select("#svg_div").node().appendChild(svgNode);
-  //nodes = d3.selectAll('.node');
-  //links = d3.selectAll('.edge');
 
   width = svgNode.getBBox().width*5;
   height = svgNode.getBBox().height*5;
 
-  //  nodes
-  //  .call(d3.drag()
-  //	  .on("start",dragstarted)
-  //	  .on("drag",dragged)
-  //	  .on("end",dragended));
-
-  //  links
-  //  .call(d3.drag()
-  //	  .on("start",dragstarted)
-  //	  .on("drag",dragged)
-  //	  .on("end",dragended));
-
-
-  //function dragstarted(d) {
-  //  d3.select(this).raise().classed("active", true);
-  //}
-
-  //function dragged(d) {
-  //  this.x = this.x || 0;
-  //  this.y = this.y || 0;
-  //  this.x += d3.event.dx;
-  //  this.y += d3.event.dy;
-  //  d3.select(this)
-  //    .attr("transform","translate(" + this.x + "," + this.y + ")");
-  //}
-
-  //function dragended(d) {
-  //  d3.select(this).classed("active", false);
-  //}
-
-//console.log(svgNode);
-//console.log(nodes);
-//console.log(links);
-
   });
 
 </script>
@@ -142,6 +114,12 @@ d3.xml("<?php print($svg_file);?>", function(error, documentFragment){
 
 
 <script>
+    d3.select('#saveButton_svg').on('click',function() {
+        var svgString = getSVGString(d3.select("#svg_div").select('svg').node());
+   var svgBlob = new Blob([svgString],{type:"image/svg+xml;charset=utf-8"});
+   saveAs(svgBlob,"<?php echo $svg_file;?>");
+});
+
 
     d3.select('#saveButton').on('click', function(){
 	 var svgString = getSVGString(d3.select("#svg_div").select('svg').node());
@@ -262,4 +240,4 @@ function svgString2Image( svgString, width, height, format, callback ) {
 
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>