summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorivan <ivan>2011-01-24 02:56:02 +0000
committerivan <ivan>2011-01-24 02:56:02 +0000
commit69b3b149f2a83cf280022388b1cd37e62990c721 (patch)
tree388d1470da593865ad8e7f95d043afb9dbb60b22 /httemplate/elements
parent09f8c585713778224eafa929d2ec3d83a3f8339a (diff)
torrus, RT#10574
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/select-torrus_serviceid.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/httemplate/elements/select-torrus_serviceid.html b/httemplate/elements/select-torrus_serviceid.html
new file mode 100644
index 000000000..a8cfca8b8
--- /dev/null
+++ b/httemplate/elements/select-torrus_serviceid.html
@@ -0,0 +1,28 @@
+<SELECT NAME="<% $opt{'field'} || 'serviceid' %>">
+
+% unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
+ <OPTION VALUE="">Select serviceid</OPTION>
+% }
+
+% foreach my $serviceid ( keys %serviceid ) {
+ <OPTION VALUE="<%$serviceid%>"><% $serviceid %></OPTION>
+% }
+
+</SELECT>
+
+<%init>
+
+my %opt = @_;
+
+#is this going to get too slow or will the index make it okay?
+my $sth = dbh->prepare("SELECT DISTINCT(serviceid) FROM srvexport")
+ or die dbh->errstr;
+$sth->execute or die $sth->errstr;
+my %serviceid = ();
+while ( my $row = $sth->fetchrow_arrayref ) {
+ my $serviceid = $row->[0];
+ $serviceid =~ s/_(IN|OUT)$//;
+ $serviceid{$serviceid}=1;
+}
+
+</%init>