diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-04-06 22:01:05 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-04-13 18:11:21 -0500 |
commit | af8b1f302097a43229b59cdc2ab9782fbff28dc9 (patch) | |
tree | 8349f969f8febdc63bd4c808f3e5723ca80879e9 /httemplate/misc | |
parent | ecf01f1adf08cfbbb489d18c39a9626079112526 (diff) |
RT#18834: Cacti integration [database storage]
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/cacti_graphs.html | 42 | ||||
-rw-r--r-- | httemplate/misc/process/cacti_graphs.cgi | 3 |
2 files changed, 29 insertions, 16 deletions
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(); </SCRIPT> -% } else { -% if ($error) { +% } elsif ($error) { -<P><% $error %></P> +<P><% emt($error) %></P> +<FORM NAME="CactiGraphForm" ID="CactiGraphForm" style="margin-top: 0"> +<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>"> +<INPUT TYPE="hidden" NAME="load" VALUE="1"> +<INPUT TYPE="submit" VALUE="Reload Graphs"> +</FORM> -% } 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'; </%init> diff --git a/httemplate/misc/process/cacti_graphs.cgi b/httemplate/misc/process/cacti_graphs.cgi index 160b1ad85..f2baeb455 100644 --- a/httemplate/misc/process/cacti_graphs.cgi +++ b/httemplate/misc/process/cacti_graphs.cgi @@ -1,6 +1,9 @@ <% $server->process %> <%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); + my $server = FS::UI::Web::JSRPC->new('FS::part_export::cacti::process_graphs', $cgi); </%init> |