2014-06-02 Alejandro Gallardo <alejandro.gallardo@artica.es>

* godmode/setup/setup_visuals.php,
	  include/functions_config.php: Added a new config token
	to hold a custom path for the graphviz binaries.

	* include/functions_networkmap.php: Minor fixes on the
	functions "networkmap_create_module_node" and
	"networkmap_open_graph".

	* operation/agentes/networkmap.groups.php,
	  operation/agentes/networkmap.topology.php: Modified to
	support the custom graphviz directory, blanks in paths, etc.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10080 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
alexhigh 2014-06-02 17:36:00 +00:00
parent 47872751c0
commit b00614eb63
7 changed files with 40 additions and 23 deletions

View File

@ -1,3 +1,17 @@
2014-06-02 Alejandro Gallardo <alejandro.gallardo@artica.es>
* godmode/setup/setup_visuals.php,
include/functions_config.php: Added a new config token
to hold a custom path for the graphviz binaries.
* include/functions_networkmap.php: Minor fixes on the
functions "networkmap_create_module_node" and
"networkmap_open_graph".
* operation/agentes/networkmap.groups.php,
operation/agentes/networkmap.topology.php: Modified to
support the custom graphviz directory, blanks in paths, etc.
2014-06-02 Ramon Novoa <rnovoa@artica.es>
* godmode/setup/license.php: Added to repository. License configuration

View File

@ -382,7 +382,10 @@ $table->data[$row][1] .= __('No') . '&nbsp;' .
$row++;
$table->data[$row][0] = __('Custom graphviz directory') . ui_print_help_tip (__("Custom directory where the graphviz binaries are stored."), true);
$table->data[$row][1] = html_print_input_text ('graphviz_bin_dir', $config["graphviz_bin_dir"], '', 50, 255, true);
$row++;
echo '<form id="form_setup" method="post">';
html_print_input_hidden ('update_config', 1);

View File

@ -432,7 +432,9 @@ function config_update_config () {
$error_update[] = __('Autohidden menu');
if (!config_update_value ('paginate_module', get_parameter('paginate_module')))
$error_update[] = __('Paginate module');
if (!config_update_value ('graphviz_bin_dir', get_parameter('graphviz_bin_dir')))
$error_update[] = __('Custom graphviz directory');
$interval_values = get_parameter ('interval_values');
// Add new interval value if is provided

View File

@ -1183,7 +1183,7 @@ function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $
'width=0.20, ' .
'height=0.20, ' .
'label="", ' .
'tooltip="' . $url_tooltip .
'tooltip="' . $url_tooltip . '"' .
'];';
}
return $node;
@ -1278,7 +1278,7 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $fo
$size = $size_x . ',' . $size_y;
// BEWARE: graphwiz DONT use single ('), you need double (")
$head = "graph networkmap { bgcolor=\"transparent\", labeljust=l; margin=0; ";
$head = "graph networkmap { bgcolor=\"transparent\"; labeljust=l; margin=0; ";
if ($nooverlap != '') {
$head .= "overlap=\"$overlap\";";
$head .= "ranksep=\"$ranksep\";";

View File

@ -117,4 +117,4 @@ function d3_tree_map_graph ($data, $width = 700, $height = 700, $return = false)
return $output;
}
?>
?>

View File

@ -47,11 +47,9 @@ if ($graph === false) {
// Generate image and map
// If image was generated just a few minutes ago, then don't regenerate
// (it takes long) unless regen checkbox is set
$filename_map = safe_url_extraclean($config["attachment_store"]) .
"/networkmap_" . $filter;
$filename_img = "attachment/networkmap_" . $filter . "_" . $font_size;
$filename_dot = safe_url_extraclean($config["attachment_store"]) .
"/networkmap_" . $filter;
$filename_map = io_safe_output($config["attachment_store"]) . "/networkmap_" . $filter;
$filename_img = io_safe_output($config["attachment_store"]) . "/networkmap_" . $filter . "_" . $font_size;
$filename_dot = io_safe_output($config["attachment_store"]) . "/networkmap_" . $filter;
if ($simple) {
$filename_map .= "_simple";
$filename_img .= "_simple";
@ -77,8 +75,8 @@ else {
}
else {
fwrite ($fh, $graph);
$cmd = "$filter -Tcmapx -o" . $filename_map . " -Tpng " .
"-o" . $filename_img . " " . $filename_dot;
$graphviz_path = ($config['graphviz_bin_dir']) ? io_safe_output($config['graphviz_bin_dir']."/") : "";
$cmd = escapeshellarg($graphviz_path.$filter) . " -Tcmapx " . escapeshellarg("-o$filename_map") . " -Tpng ". escapeshellarg("-o$filename_img") . " " . escapeshellarg($filename_dot);
$result = system ($cmd);
fclose ($fh);
unlink ($filename_dot);
@ -96,8 +94,8 @@ if ($result !== false) {
return;
}
echo "<div style='text-align:center'>";
html_print_image ($filename_img, false,
array ("alt" => __('Network map'), "usemap" => "#networkmap"));
$image_url = str_replace(realpath(io_safe_output($config['homedir'])), "", realpath($filename_img));
html_print_image ($image_url, false, array ("alt" => __('Network map'), "usemap" => "#networkmap"));
echo "</div>";
require ($filename_map);
}

View File

@ -49,12 +49,11 @@ if ($graph === false) {
}
// Generate image and map
// If image was generated just a few minutes ago, then don't regenerate (it takes long) unless regen checkbox is set
$filename_map = safe_url_extraclean($config["attachment_store"]) .
"/networkmap_" . $filter;
$filename_img = "attachment/networkmap_" . $filter . "_" . $font_size;
$filename_dot = safe_url_extraclean($config["attachment_store"]) .
"/networkmap_" . $filter;
// If image was generated just a few minutes ago, then don't regenerate
// (it takes long) unless regen checkbox is set
$filename_map = io_safe_output($config["attachment_store"]) . "/networkmap_" . $filter;
$filename_img = io_safe_output($config["attachment_store"]) . "/networkmap_" . $filter . "_" . $font_size;
$filename_dot = io_safe_output($config["attachment_store"]) . "/networkmap_" . $filter;
if ($simple) {
$filename_map .= "_simple";
$filename_img .= "_simple";
@ -71,7 +70,6 @@ $filename_dot .= "_" . $id_networkmap . ".dot";
if ($regen != 1 && file_exists ($filename_img) &&
filemtime ($filename_img) > get_system_time () - SECONDS_5MINUTES) {
$result = true;
}
else {
@ -81,10 +79,11 @@ else {
}
else {
fwrite ($fh, $graph);
$cmd = "$filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img." ".$filename_dot;
$graphviz_path = ($config['graphviz_bin_dir']) ? io_safe_output($config['graphviz_bin_dir']."/") : "";
$cmd = escapeshellarg($graphviz_path.$filter) . " -Tcmapx " . escapeshellarg("-o$filename_map") . " -Tpng ". escapeshellarg("-o$filename_img") . " " . escapeshellarg($filename_dot);
$result = system ($cmd);
fclose ($fh);
//unlink ($filename_dot);
unlink ($filename_dot);
}
}
@ -99,7 +98,8 @@ if ($result !== false) {
return;
}
echo "<div style='text-align:center'>";
html_print_image ($filename_img, false, array ("alt" => __('Network map'), "usemap" => "#networkmap"));
$image_url = str_replace(realpath(io_safe_output($config['homedir'])), "", realpath($filename_img));
html_print_image ($image_url, false, array ("alt" => __('Network map'), "usemap" => "#networkmap"));
echo "</div>";
require ($filename_map);
}