* CBI: Generalized templates
[project/luci.git] / src / ffluci / view / cbi / lvalue.htm
index b7db0def964fc02a5b943a565b6017bfa681c353..f1ae5a093900db90c816d219646ad805d5d413c0 100644 (file)
@@ -1,11 +1,16 @@
-<div class="cbi-lvalue">
-<div class="cbi-lvalue-title"><%=self.title%></div>
-<div class="cbi-lvalue-field">
-<select name="<%=self.map.config.."."..self.section.."."..self.option%>">
-<%for k, v in self.list do%>
-<option value="<%=k%>"><%=v%></option>
+<%+cbi/valueheader%>
+<% if self.widget == "select" then %>
+                                                               <select onchange="cbi_d_update(this.id)" id="cbid.<%=self.config.."."..section.."."..self.option%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self.size then %> size="<%=self.size%>"<% end %>>
+<%for i, key in pairs(self.keylist) do%>
+                                                                       <option<% if self:cfgvalue(section) == key then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option>
 <% end %>
-</select>
-</div>
-<div class="cbi-value-description"><%=self.description%></div>
-</div>
\ No newline at end of file
+                                                               </select>
+<% elseif self.widget == "radio" then
+       local c = 0;
+       for i, key in pairs(self.keylist) do
+       c = c + 1%>
+                                                               <%=self.vallist[i]%><input type="radio" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == key then %> checked="checked"<% end %> value="<%=key%>" />
+<% if c == self.size then c = 0 %><br />
+<% end end %>
+<% end %>
+<%+cbi/valuefooter%>
\ No newline at end of file