torrus, RT#10574
authorivan <ivan>
Mon, 24 Jan 2011 02:59:48 +0000 (02:59 +0000)
committerivan <ivan>
Mon, 24 Jan 2011 02:59:48 +0000 (02:59 +0000)
httemplate/elements/select-torrus_serviceid.html
httemplate/elements/tr-select-torrus_serviceid.html [new file with mode: 0644]

index a8cfca8..34e8e93 100644 (file)
@@ -5,7 +5,9 @@
 % }
 
 % foreach my $serviceid ( keys %serviceid ) {
-    <OPTION VALUE="<%$serviceid%>"><% $serviceid %></OPTION>
+    <OPTION VALUE="<%$serviceid%>"
+            <% $serviceid eq $value ? 'SELECTED' : '' %>
+    ><% $serviceid %></OPTION>
 % } 
 
 </SELECT>
@@ -14,6 +16,8 @@
 
 my %opt = @_;
 
+my $value = $opt{'curr_value'} || $opt{'value'};
+
 #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;
diff --git a/httemplate/elements/tr-select-torrus_serviceid.html b/httemplate/elements/tr-select-torrus_serviceid.html
new file mode 100644 (file)
index 0000000..32eb6f7
--- /dev/null
@@ -0,0 +1,10 @@
+<TR>
+  <TD ALIGN="right"><% $opt{'label'} || 'Torrus serviceid' %></TD>
+  <TD><% include('select-torrus_serviceid.html', %opt) %></TD>
+</TR>
+
+<%init>
+
+my %opt = @_;
+
+</%init>