Bladeren bron

added php script

DS 2 jaren geleden
bovenliggende
commit
5d833be511
3 gewijzigde bestanden met toevoegingen van 12 en 20 verwijderingen
  1. 4 0
      js/execParser.php
  2. 3 16
      js/executeNodeSetParser.js
  3. 5 4
      js/myEvents.js

+ 4 - 0
js/execParser.php

@@ -0,0 +1,4 @@
+<?php
+$output = shell_exec('ls');
+echo "<pre>$output</pre>";
+?>

+ 3 - 16
js/executeNodeSetParser.js

@@ -3,19 +3,6 @@ sources:
 https://stackoverflow.com/questions/1880198/how-to-execute-shell-command-in-javascript, 02/03/2022
 */
 
-
-
-export function parseAll(){
-	var exec = require('child_process').exec;
-	var listxml = '';
-exec('cd .. && cd nodesets && ls',
-    function (error, stdout, stderr) {
-        //console.log('stdout: ' + stdout);
-        //console.log('stderr: ' + stderr);
-		listxml = stdout;
-		console.log('stdout: ' + listxml);
-        if (error !== null) {
-             console.log('exec error: ' + error);
-        }
-    });	
-}
+var fs = require('fs');
+var files = fs.readdirSync('.');
+console.log('OK: ' + files);

+ 5 - 4
js/myEvents.js

@@ -1,5 +1,5 @@
 $(document).ready(function(){
-    function newElementaddressSpace(){
+	function newElementaddressSpace(){
 		var $tr = $('<tr>');
 		$tr.append('<td><img src='+'graphics/Gauge.svg'+' height='+"100"+' width='+"100"+'></img></td></tr>');
 		
@@ -8,9 +8,10 @@ $(document).ready(function(){
 	}
 	
 	function parseAll(){
-		var fs = require('fs');
-		var files = fs.readdirSync('.');
-		console.log('OK: ' + files);
+	$.getScript("executeNodeSetParser.js");
+	console.log('OK1');
+	$.ajax({url: 'execParser.php'})
+	console.log('OK2');
 	}
 	
 	$(".nodeRoot").click(function () {