summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-03-27 14:20:48 -0500
committerJonathan Prykop <jonathan@freeside.biz>2015-03-27 14:20:48 -0500
commitd9db63d82fce670cc3c21f86e577dd99c3d14028 (patch)
treedf09c1d38f0845594e59d47b336e7a427e59d289 /httemplate/misc
parent1c9056a27c303170060004c1be93787c6a32dcb6 (diff)
RT#18834: Cacti integration [real graph import]
Diffstat (limited to 'httemplate/misc')
-rw-r--r--httemplate/misc/cacti_graphs.html53
-rw-r--r--httemplate/misc/process/cacti_graphs.cgi6
2 files changed, 59 insertions, 0 deletions
diff --git a/httemplate/misc/cacti_graphs.html b/httemplate/misc/cacti_graphs.html
new file mode 100644
index 000000000..9cc5e2494
--- /dev/null
+++ b/httemplate/misc/cacti_graphs.html
@@ -0,0 +1,53 @@
+<% include( '/elements/header.html', 'Cacti Graphs' ) %>
+
+% if ($load) {
+
+<FORM NAME="CactiGraphForm" ID="CactiGraphForm" style="margin-top: 0">
+<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
+</FORM>
+<% include( '/elements/progress-init.html',
+ 'CactiGraphForm',
+ [ 'svcnum' ],
+ $p.'misc/process/cacti_graphs.cgi',
+ { url => 'javascript:window.location.replace("'.popurl(2).'misc/cacti_graphs.html?svcnum='.$svcnum.'")' },
+) %>
+<!--
+ note we use window.location.replace for the callback url above
+ so that this page gets removed from browser history after processing
+ so that process() doesn't get triggered by the back button
+-->
+<P>Loading graphs, please wait...</P>
+<SCRIPT TYPE="text/javascript">
+process();
+</SCRIPT>
+
+% } else {
+% if ($error) {
+
+<P><% $error %></P>
+
+% } else {
+
+<% slurp($htmlfile) %>
+
+% }
+% }
+
+<%init>
+use File::Slurp qw( slurp );
+
+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 $error = (-e $htmlfile) ? '' : 'File not found';
+</%init>
+
diff --git a/httemplate/misc/process/cacti_graphs.cgi b/httemplate/misc/process/cacti_graphs.cgi
new file mode 100644
index 000000000..160b1ad85
--- /dev/null
+++ b/httemplate/misc/process/cacti_graphs.cgi
@@ -0,0 +1,6 @@
+<% $server->process %>
+
+<%init>
+my $server = FS::UI::Web::JSRPC->new('FS::part_export::cacti::process_graphs', $cgi);
+</%init>
+