RT#18834: Cacti integration [real graph import]
[freeside.git] / httemplate / misc / cacti_graphs.html
1 <% include( '/elements/header.html', 'Cacti Graphs' ) %>
2
3 % if ($load) {
4
5 <FORM NAME="CactiGraphForm" ID="CactiGraphForm" style="margin-top: 0">
6 <INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
7 </FORM>
8 <% include( '/elements/progress-init.html',
9               'CactiGraphForm', 
10               [ 'svcnum' ],
11               $p.'misc/process/cacti_graphs.cgi',
12               { url => 'javascript:window.location.replace("'.popurl(2).'misc/cacti_graphs.html?svcnum='.$svcnum.'")' },
13 ) %>
14 <!--
15   note we use window.location.replace for the callback url above
16   so that this page gets removed from browser history after processing
17   so that process() doesn't get triggered by the back button
18 -->
19 <P>Loading graphs, please wait...</P>
20 <SCRIPT TYPE="text/javascript">
21 process();
22 </SCRIPT>
23
24 % } else {
25 %   if ($error) {
26
27 <P><% $error %></P>
28
29 %   } else {
30
31 <% slurp($htmlfile) %>
32
33 %   }
34 % }
35
36 <%init>
37 use File::Slurp qw( slurp );
38
39 my $svcnum    = $cgi->param('svcnum') or die 'Illegal svcnum';
40 my $load      = $cgi->param('load');
41 my $graphnum  = $cgi->param('graphnum');
42
43 my $htmlfile = $FS::UID::cache_dir 
44              . '/cacti-graphs/'
45              . 'svc_'
46              . $svcnum;
47 $htmlfile .= '_graph_' . $graphnum
48   if $graphnum;
49 $htmlfile .= '.html';
50
51 my $error = (-e $htmlfile) ? '' : 'File not found';
52 </%init>
53