Fixing Issue #4239 - Graph Template Edit Drilldown

On "Graph Utility View" add the name of and a link to the graph template which the graph is based on
This commit is contained in:
TheWitness committed 2022-10-16 20:46:37 -04:00
1 parent 769b4c1699
commit 982dda4d09
4 files changed
+49 -8

No files matched your search

+1
View File
@@ -22,6 +22,7 @@ Cacti CHANGELOG
-issue#4944: Newer Cacti Packages should be signed with SHA256 as SHA1 is being deprecated
-issue#4947: When creating a Data Template, ensure that the default max value is always 'U' and not '0'
-feature#3131: Button to reindex bad indexes
-feature#4239: On "Graph Utility View" add the name of and a link to the graph template which the graph is based on
-feature#4417: Remote Pollers - Support execution of custom functions at poller bottom
-feature#4638: Detect the graph with stale rrd or missing rrd
-feature#4762: Allow Package Import to be selective
+36 -8
View File
@@ -102,11 +102,13 @@ case 'view':
</tr>
<?php
$graph = db_fetch_row_prepared('SELECT local_graph_id, width, height
$graph = db_fetch_row_prepared('SELECT local_graph_id, width, height, graph_template_id
FROM graph_templates_graph
WHERE local_graph_id = ?',
array(get_request_var('local_graph_id')));
$graph_template_id = $graph['graph_template_id'];
$i = 0;
if (cacti_sizeof($rras)) {
$graph_end = time() - 30;
@@ -118,6 +120,7 @@ case 'view':
}
$aggregate_url = aggregate_build_children_url(get_request_var('local_graph_id'), $graph_start, $graph_end, $rra['id']);
?>
<tr class='tableRowGraph'>
<td class='center'>
@@ -126,12 +129,26 @@ case 'view':
<td>
<div class='graphWrapper' id='wrapper_<?php print $graph['local_graph_id'] ?>' graph_id='<?php print $graph['local_graph_id'];?>' rra_id='<?php print $rra['id'];?>' graph_width='<?php print $graph['width'];?>' graph_height='<?php print $graph['height'];?>' graph_start='<?php print $graph_start;?>' graph_end='<?php print $graph_end;?>' title_font_size='<?php print ((read_user_setting('custom_fonts') == 'on') ? read_user_setting('title_size') : read_config_option('title_size'));?>'></div>
</td>
<?php if (is_realm_allowed(27)) { ?><td id='dd<?php print get_request_var('local_graph_id');?>' style='vertical-align:top;' class='graphDrillDown noprint'>
<a class='iconLink utils' href='#' id='graph_<?php print get_request_var('local_graph_id');?>_util' graph_start='<?php print $graph_start;?>' graph_end='<?php print $graph_end;?>' rra_id='<?php print $rra['id'];?>'><img class='drillDown' src='<?php print $config['url_path'] . 'images/cog.png';?>' alt='' title='<?php print __esc('Graph Details, Zooming and Debugging Utilities');?>'></a><br>
<a id='graph_<?php print $rra['id'];?>_csv' class='iconLink csv' href='<?php print html_escape($config['url_path'] . 'graph_xport.php?local_graph_id=' . get_request_var('local_graph_id') . '&rra_id=' . $rra['id'] . '&view_type=' . get_request_var('view_type') . '&graph_start=' . $graph_start . '&graph_end=' . $graph_end);?>'><img src='<?php print $config['url_path'] . 'images/table_go.png';?>' alt='' title='<?php print __esc('CSV Export');?>'></a><br>
<?php if (read_config_option('realtime_enabled') == 'on' || is_realm_allowed(25)) print "<a class='iconLink' href='#' onclick=\"window.open('".$config['url_path'] . 'graph_realtime.php?top=0&left=0&local_graph_id=' . get_request_var('local_graph_id') . "', 'popup_" . get_request_var('local_graph_id') . "', 'directories=no,toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=no,status=no,titlebar=no,width=650,height=300');return false\"><img src='" . $config['url_path'] . "images/chart_curve_go.png' alt='' title='" . __esc('Click to view just this Graph in Real-time') . "'></a><br/>\n";?>
<?php print ($aggregate_url != '' ? $aggregate_url:'')?>
<?php api_plugin_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => get_request_var('local_graph_id'), 'rra' => $rra['id'], 'view_type' => get_request_var('view_type'))); ?>
<?php
if (is_realm_allowed(10) && $graph_template_id > 0) {
print "<a class='iconLink' role='link' title='" . __esc('Edit Graph Template') . "' href='" . html_escape($config['url_path'] . '/graph_templates.php?action=template_edit&id=' . $graph_template_id) . "'><img src='" . html_escape($config['url_path'] . 'images/template_edit.png') . "'></img></a>";
print '<br/>';
}
if (read_config_option('realtime_enabled') == 'on' || is_realm_allowed(25)) {
print "<a class='iconLink' href='#' onclick=\"window.open('".$config['url_path'] . 'graph_realtime.php?top=0&left=0&local_graph_id=' . get_request_var('local_graph_id') . "', 'popup_" . get_request_var('local_graph_id') . "', 'directories=no,toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=no,status=no,titlebar=no,width=650,height=300');return false\"><img src='" . $config['url_path'] . "images/chart_curve_go.png' alt='' title='" . __esc('Click to view just this Graph in Real-time') . "'></a><br/>\n";
}
print ($aggregate_url != '' ? $aggregate_url:'');
api_plugin_hook('graph_buttons', array('hook' => 'view', 'local_graph_id' => get_request_var('local_graph_id'), 'rra' => $rra['id'], 'view_type' => get_request_var('view_type')));
?>
</td><?php } ?>
</tr>
<tr>
@@ -158,6 +175,8 @@ case 'view':
var graphTimeout = null;
function initializeGraph() {
$('a.iconLink').tooltip();
$('.graphWrapper').each(function() {
var itemWrapper = $(this);
var itemGraph = $(this).find('.graphimage');
@@ -344,13 +363,14 @@ case 'zoom':
$graph_start--;
}
$graph = db_fetch_row_prepared('SELECT width, height, title_cache, local_graph_id
$graph = db_fetch_row_prepared('SELECT width, height, title_cache, local_graph_id, graph_template_id
FROM graph_templates_graph
WHERE local_graph_id = ?',
array(get_request_var('local_graph_id')));
$graph_height = $graph['height'];
$graph_width = $graph['width'];
$graph_height = $graph['height'];
$graph_width = $graph['width'];
$graph_template_id = $graph['graph_template_id'];
if (read_user_setting('custom_fonts') == 'on' && read_user_setting('title_size') != '') {
$title_font_size = read_user_setting('title_size');
@@ -383,7 +403,14 @@ case 'zoom':
<img class='drillDown' src='<?php print $config['url_path'] . 'images/table_go.png';?>' alt='' title='<?php print __esc('Graph Data');?>'>
</a>
<br>
<?php api_plugin_hook('graph_buttons', array('hook' => 'zoom', 'local_graph_id' => get_request_var('local_graph_id'), 'rra' => get_request_var('rra_id'), 'view_type' => get_request_var('view_type'))); ?>
<?php
if (is_realm_allowed(10) && $graph_template_id > 0) {
print "<a class='iconLink' role='link' title='" . __esc('Edit Graph Template') . "' href='" . html_escape($config['url_path'] . '/graph_templates.php?action=template_edit&id=' . $graph_template_id) . "'><img src='" . html_escape($config['url_path'] . 'images/template_edit.png') . "'></img></a>";
print '<br/>';
}
api_plugin_hook('graph_buttons', array('hook' => 'zoom', 'local_graph_id' => get_request_var('local_graph_id'), 'rra' => get_request_var('rra_id'), 'view_type' => get_request_var('view_type')));
?>
</td><?php } ?>
</tr>
<tr>
@@ -535,6 +562,7 @@ case 'zoom':
initializeGraph();
$('#navigation').show();
$('#navigation_right').show();
$('a.iconLink').tooltip();
});
</script>
Binary file not shown.

After

Width:  |  Height:  |  Size: 826 B

+12
View File
@@ -452,10 +452,16 @@ function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = '', $extr
function graph_drilldown_icons($local_graph_id, $type = 'graph_buttons', $tree_id = 0, $branch_id = 0) {
global $config;
static $rand = 0;
$aggregate_url = aggregate_build_children_url($local_graph_id);
$graph_template_id = db_fetch_cell_prepared('SELECT graph_template_id
FROM graph_local
WHERE id = ?',
array($local_graph_id));
print "<div class='iconWrapper'>";
print "<a class='iconLink utils' href='#' role='link' id='graph_" . $local_graph_id . "_util'><img class='drillDown' src='" . $config['url_path'] . "images/cog.png' alt='' title='" . __esc('Graph Details, Zooming and Debugging Utilities') . "'></a><br>";
print "<a class='iconLink csvexport' href='#' role='link' id='graph_" . $local_graph_id . "_csv'><img class='drillDown' src='" . $config['url_path'] . "images/table_go.png' alt='' title='" . __esc('CSV Export of Graph Data'). "'></a><br>";
@@ -474,6 +480,11 @@ function graph_drilldown_icons($local_graph_id, $type = 'graph_buttons', $tree_i
}
}
if (is_realm_allowed(10) && $graph_template_id > 0) {
print "<a class='iconLink' role='link' title='" . __esc('Edit Graph Template') . "' href='" . html_escape($config['url_path'] . '/graph_templates.php?action=template_edit&id=' . $graph_template_id) . "'><img src='" . html_escape($config['url_path'] . 'images/template_edit.png') . "'></img></a>";
print '<br/>';
}
if (read_config_option('realtime_enabled') == 'on' && is_realm_allowed(25)) {
if (read_user_setting('realtime_mode') == '' || read_user_setting('realtime_mode') == '1') {
print "<a class='iconLink realtime' href='#' role='link' id='graph_" . $local_graph_id . "_realtime'><img class='drillDown' src='" . $config['url_path'] . "images/chart_curve_go.png' alt='' title='" . __esc('Click to view just this Graph in Real-time'). "'></a><br/>";
@@ -2553,6 +2564,7 @@ function html_common_header($title, $selectedTheme = '') {
print get_md5_include_css('include/themes/' . $selectedTheme .'/jquery.colorpicker.css');
print get_md5_include_css('include/themes/' . $selectedTheme .'/billboard.css');
print get_md5_include_css('include/themes/' . $selectedTheme .'/pace.css');
print get_md5_include_css('include/themes/' . $selectedTheme .'/Diff.css');
print get_md5_include_css('include/fa/css/all.css');
print get_md5_include_css('include/vendor/flag-icon-css/css/flag-icon.css');
print get_md5_include_css('include/themes/' . $selectedTheme .'/main.css');