From 9cfdddf49df7d5f47691ca467d9fbae51bfd71a0 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 6 Apr 2015 22:01:05 -0500 Subject: RT#18834: Cacti integration [database storage] --- httemplate/misc/cacti_graphs.html | 42 ++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'httemplate/misc/cacti_graphs.html') diff --git a/httemplate/misc/cacti_graphs.html b/httemplate/misc/cacti_graphs.html index 9cc5e2494..90a435091 100644 --- a/httemplate/misc/cacti_graphs.html +++ b/httemplate/misc/cacti_graphs.html @@ -21,33 +21,43 @@ process(); -% } else { -% if ($error) { +% } elsif ($error) { -

<% $error %>

+

<% emt($error) %>

+
+ + + +
-% } else { +% } else { -<% slurp($htmlfile) %> +<% $content %> -% } % } <%init> use File::Slurp qw( slurp ); +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); + my $svcnum = $cgi->param('svcnum') or die 'Illegal svcnum'; my $load = $cgi->param('load'); -my $graphnum = $cgi->param('graphnum'); - -my $htmlfile = $FS::UID::cache_dir - . '/cacti-graphs/' - . 'svc_' - . $svcnum; -$htmlfile .= '_graph_' . $graphnum - if $graphnum; -$htmlfile .= '.html'; +my $graphnum = $cgi->param('graphnum') || ''; + +my ($content,$error); +unless ($load) { + my $page = qsearchs({ + 'table' => 'cacti_page', + 'hashref' => { 'svcnum' => $svcnum, 'graphnum' => $graphnum }, + }); + if ($page) { + $content = $page->content; + } else { + $error = 'No graphs found in import cache. Click below to retry import.'; + } +} -my $error = (-e $htmlfile) ? '' : 'File not found'; -- cgit v1.2.1