]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
permanent link to settings on xml pages
authorJan Michel <j.michel@gsi.de>
Mon, 23 Mar 2020 11:01:00 +0000 (12:01 +0100)
committerJan Michel <j.michel@gsi.de>
Mon, 23 Mar 2020 11:01:00 +0000 (12:01 +0100)
web/htdocs/commands/xmlpage.pm
web/htdocs/scripts/xmlpage.js

index 59d42333e086263a0357789f382977212139de5d..0960860d8b60abe3462447badbfb791e24c5c3aa 100644 (file)
@@ -84,6 +84,7 @@ print qq|
 <div class="checkbox"><input type="checkbox" value="0" id="fold" title="Fold table on large pages" $isfold>
     <label for="cache">Fold Tables</label></div>
 <div class="checkbox"><input type="button" class="stdbutton" onClick="refresh(-1);" value="Refresh"></div>
+<div class="checkbox" style="margin:auto;"><a id="permalink" target="_blank" href="">Permalink</a></div>
 </div>
 <div id="content"></div>|;
 
index 60d641dfcef0a91c9439a182e4542a69f8b06d49..c736105a0e3975192f1721972e193f537086796f 100644 (file)
@@ -2,7 +2,7 @@
     if(e.target.getAttribute("class") && e.target.getAttribute("class").indexOf("editable")!=-1) {
       var curr = e.target.innerHTML.split('<',1);
       if (e.target.parentNode.getAttribute("bit") == '1') { // search for fields that represent single bits
-        console.debug("single bit clicked");
+//         console.debug("single bit clicked");
         if ( parseInt(e.target.parentNode.getAttribute("raw")) == 0 )
           getdataprint('../xml-db/put.pl?'+e.target.parentNode.getAttribute("cstr")+'-'+'1','returntext',false,-1,refresh);
         if ( parseInt(e.target.parentNode.getAttribute("raw")) == 1 )
@@ -70,7 +70,6 @@
       
     if(e != -1) {refresh(period);}
     makeCookies();
-  
     }
     
 /*    command = "";
       }
     if(document.getElementById("address")) {
       setCookie("address"+currentpage,document.getElementById("address").value);
-      }       
+      }
+    document.getElementById("permalink").href=permaLink();  
     }
  
   function eatCookies() {
       }
         
     }
+function permaLink() {
+  var link = location.origin + location.pathname + location.search + "#";
+  
+  if(document.getElementById("address")) {
+    link += "&address="+document.getElementById("address").value;
+    }
+  if(document.getElementById("period")) {
+    link += "&period="+document.getElementById("period").value;
+    }
+  if(document.getElementById("target")) {
+    link += "&target="+document.getElementById("target").value;
+    }
+  link += "&cache="+document.getElementById("cache").checked;
+  link += "&rate="+document.getElementById("rate").checked;
+  return link;
+  }
+    
 /*From w3schools.com*/ 
   function getCookie(cname,pagename) {
 //URI