Add export graph to svg

This commit is contained in:
Oleg Sh
2022-07-02 13:42:20 +02:00
parent 9ea83bf875
commit 59b01bec36
20 changed files with 1348 additions and 9 deletions

View File

@@ -39,6 +39,20 @@ function getImageFileName($graphName, $fromRoot=false)
return $dirName . "/$graphName.png";
}
function getSvgFileName($graphName, $fromRoot=false)
{
global $g_config;
$dirName = ($fromRoot ? "" : "../") . $g_config['graphSavePath'] . substr($graphName, 0, 2);
if(!file_exists($dirName))
{
mkdir($dirName, 0777, true);
}
return $dirName . "/$graphName.svg";
}
function saveGraphXML($graph, $name, $fromRoot = false)
{

19
cgi-bin/saveSvg.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
include ("../core/config/main.php");
include ("saveGraphHelpers.php");
$name = $_GET["name"];
if (isValidName($name))
{
$imageFilename = getSvgFileName($name);
$svgData = $_POST['svgdata'];
file_put_contents($imageFilename, $svgData);
chmod($imageFilename, 0644);
echo ("OK");
}
?>