17 include_once (
"FDL/Class.WDoc.php");
33 $usage->setDefinitionText(
"Generate graph image for workflow");
34 $docid =
$usage->addRequiredParameter(
"id",
"workflow id");
35 $type =
$usage->addOptionalParameter(
"type",
"graph detail level", array(
42 $format =
$usage->addOptionalParameter(
"format",
"image format", array(
47 $orient =
$usage->addOptionalParameter(
"orient",
"orientation", array(
51 $size =
$usage->addOptionalParameter(
"size",
"image size", array() ,
"auto");
52 $ratio =
$usage->addOptionalParameter(
"ratio",
"ration", array(
58 $tool =
$usage->addOptionalParameter(
"tool",
"tool used to generate", array(
70 if ($tool ==
"sfdp") {
71 $tool.=
" -Goverlap=prism";
72 } elseif ($tool ==
"neato") {
73 $tool.=
" -Goverlap=prism";
74 } elseif ($tool ==
"twopi") {
75 $tool.=
" -Granksep=3.0 -Gnodesep=2.0 -Goverlap=false";
83 if (count(
$doc->cycle) == 0) {
84 $action->lay->template = _(
"no cycle defined");
85 $action->lay->noparse =
true;
88 $cmd.= sprintf(
"--api=wdoc_graphviz --size=%s --ratio=%s --type=%s --orient=%s --docid=%d", escapeshellarg(
$size) , escapeshellarg(
$ratio) , escapeshellarg(
$type) , escapeshellarg(
$orient) ,
$doc->id);
89 $svgfile =
"var/cache/image/w$type-" . $action->
getParam(
"CORE_LANG") .
"-" .
$doc->id .
".$format";
90 if ($format ==
"dot") $svgfile.=
".txt";
92 if ($format ==
"dot") {
93 $cmd.= sprintf(
" > %s", escapeshellarg(
$dest));
95 $cmd.= sprintf(
" | %s -T%s -o%s 2>&1", $tool, escapeshellarg($format) , escapeshellarg(
$dest));
102 if ($format ==
"png") $mime =
"image/png";
103 elseif ($format ==
"svg") $mime =
"image/svg+xml";
104 else $mime =
"text/plain";
105 Http_DownloadFile($svgfile, sprintf(
"graph %s.%s",
$doc->getTitle() , $format) , $mime,
true,
false,
true);
view_workflow_graph(Action &$action)
exitError($texterr, $exit=true, $code="")
foreach($argv as $arg) $cmd
getWshCmd($nice=false, $userid=0, $sudo=false)
Verify arguments for action function.
Http_DownloadFile($filename, $name, $mime_type= '', $inline=false, $cache=true, $deleteafter=false)