summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/part_export.cgi2
-rw-r--r--httemplate/edit/elements/part_export/cacti.html42
-rw-r--r--httemplate/edit/part_export.cgi15
3 files changed, 58 insertions, 1 deletions
diff --git a/httemplate/browse/part_export.cgi b/httemplate/browse/part_export.cgi
index 1f835d729..af988d37b 100755
--- a/httemplate/browse/part_export.cgi
+++ b/httemplate/browse/part_export.cgi
@@ -66,7 +66,7 @@ function part_export_areyousure(href) {
% if ( $group ) {
% my @values = split("\n", $opt{$optname});
% $multiples{$group} ||= [];
-% push @{ $multiples{$group} }, [ $optname, @values ] if @values;
+% push @{ $multiples{$group} }, [ $def->{label} || $optname, @values ] if @values;
% delete $opt{$optname};
% } elsif (length($opt{$optname})) { # the normal case
% my $value = $opt{$optname};
diff --git a/httemplate/edit/elements/part_export/cacti.html b/httemplate/edit/elements/part_export/cacti.html
new file mode 100644
index 000000000..9e4a8ecd7
--- /dev/null
+++ b/httemplate/edit/elements/part_export/cacti.html
@@ -0,0 +1,42 @@
+<table bgcolor="#cccccc" border=0 cellspacing=3>
+<TR>
+ <TH>Graph Template ID</TH>
+ <TH>SNMP Query ID</TH>
+ <TH>SNMP Query Type ID</TH>
+ <TH>SNMP Field</TH>
+ <TH>SNMP Value</TH>
+</TR>
+<TR id="mytemplate">
+ <TD><INPUT TYPE="text" NAME="graph_template_id" ID="graph_template_id"></TD>
+ <TD><INPUT TYPE="text" NAME="snmp_query_id" ID="snmp_query_id"></TD>
+ <TD><INPUT TYPE="text" NAME="snmp_query_type_id" ID="snmp_query_type_id"></TD>
+ <TD><INPUT TYPE="text" NAME="snmp_field" ID="snmp_field"></TD>
+ <TD><INPUT TYPE="text" NAME="snmp_value" ID="snmp_value"></TD>
+</TR>
+<& /elements/auto-table.html,
+ template_row => 'mytemplate',
+ fieldorder => ['graph_template_id','snmp_query_id','snmp_query_type_id','snmp_field','snmp_value'],
+ data => \@data,
+ table => 'cacti',
+&>
+</table>
+<INPUT TYPE="hidden" name="multi_options" value="<% $multiopts %>">
+<%init>
+my %opt = @_;
+my $part_export = $opt{part_export} || die "No part_export specified";
+
+my @fields = ('cacti_graph_template_id','cacti_snmp_query_id','cacti_snmp_query_type_id','cacti_snmp_field','cacti_snmp_value');
+my $multiopts = join(',',@fields);
+my @byfield = map {
+ [ split("\n", $part_export->option($_)) ]
+} @fields;
+my @data;
+for (my $i = 0; $i < @{$byfield[0]}; $i++) {
+ my @thisrow;
+ for (my $j = 0; $j < @byfield; $j++) {
+ push(@thisrow,$byfield[$j][$i]);
+ }
+ push(@data,\@thisrow);
+}
+
+</%init>
diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi
index 0e53e29d0..382093116 100644
--- a/httemplate/edit/part_export.cgi
+++ b/httemplate/edit/part_export.cgi
@@ -183,6 +183,10 @@ my $widget = new HTML::Widgets::SelectLayers(
? $optinfo->{default}
: ''
);
+
+ #handle these with post_config_element
+ next if $type eq 'custom';
+
if ( $type eq 'title' ) {
$html .= qq!<TR><TH COLSPAN=1 ALIGN="right"><FONT SIZE="+1">! .
$label .
@@ -283,6 +287,17 @@ my $widget = new HTML::Widgets::SelectLayers(
$html .= '</TABLE>';
+ # false laziness with config_element above
+ # create 'post_config_element' to generate the whole layer with a Mason component
+ if ( my $include = $exports->{$layer}{post_config_element} ) {
+ # might need to adjust the scope of this at some point
+ $html .= $m->scomp($include,
+ part_export => $part_export,
+ layer => $layer,
+ export_info => $exports->{$layer}
+ );
+ }
+
$html .= '<INPUT TYPE="hidden" NAME="options" VALUE="'.
join(',', keys %{$exports->{$layer}{options}} ). '">';