f6652fb0a2516bb7ca42f0a15e68f98a7961162f
[project/luci.git] / libs / cbi / luasrc / view / cbi / ucisection.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15 <% self:render_children(section, scope or {}) %>
16                                                 <% if #self.optionals[section] > 0 or self.dynamic then %>
17                                                         <div class="cbi-optionals">
18                                                         <% if self.dynamic then %>
19                                                                 <input type="text" name="cbi.opt.<%=self.config%>.<%=section%>" />
20                                                         <% else %>
21                                                                 <select name="cbi.opt.<%=self.config%>.<%=section%>">
22                                                                         <option><%:cbi_addopt%></option>
23                                                                 <% for key, val in pairs(self.optionals[section]) do %>
24                                                                         <option id="cbi-<%=self.config.."-"..section.."-"..val.option%>" value="<%=val.option%>"><%=val.title%></option>
25                                                                 <% end %>
26                                                                 </select>
27                                                                 <script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %>
28                                                                         <% if #val.deps > 0 then %><% for j, d in ipairs(val.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..val.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>");
29                                                                 <% end %><% end %>
30                                                                 <% end %></script>
31                                                         <% end %>
32                                                                 <input type="submit" value="<%:add%>" />
33                                                         </div>
34                                                 <% end %>