* Fixed templates to be XHTML 1.1 compliant
[project/luci.git] / src / ffluci / view / cbi / tsection.htm
index b613f6271f069b588a831a2d306acac05460e1e8..ffeb91575b0f6abea3d1dc0301d538263fa624c3 100644 (file)
@@ -1,21 +1,42 @@
-<%
-local allsections = self.map:read()
-local sections = {}
-for k, v in pairs(allsections) do
-       if v[".type"] == self.sectiontype then
-               sections[k] = v
-       end
-end 
-%>
-                               <div class="cbi-tsection" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+                               <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
                                        <h2><%=self.title%></h2>
-                                       <div class="cbi-tsection-descr"><%=self.description%></div>
-<% for k, v in pairs(sections) do %>
-                                       <div class="cbi-tsection-node" id="cbi-<%=self.config%>-<%=k%>">
-<% for i, node in ipairs(self.children) do
-       node.section = k
-       node:render()
-end %>
-                                       </div>
+                                       <div class="cbi-section-descr"><%=self.description%></div>
+<% for k, v in pairs(self:cfgsections()) do%>
+                                               <% if self.addremove then %><div class="cbi-section-remove right">
+                                                       <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:cbi_del Eintrag entfernen%>" />
+                                               </div><% end %>
+                                               <% if not self.anonymous then %><h3><%=k%></h3><% end %>
+                                       <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=k%>">
+<% self:render_children(k) %>
+                                               <% if #self.optionals[k] > 0 or self.dynamic then %>
+                                                       <div class="cbi-optionals">
+                                                       <% if self.dynamic then %>
+                                                               <input type="text" name="cbi.opt.<%=self.config%>.<%=k%>" />
+                                                       <% else %>
+                                                               <select name="cbi.opt.<%=self.config%>.<%=k%>">
+                                                                       <option><%:cbi_addopt -- Feld --%></option>
+                                                               <% for key, val in pairs(self.optionals[k]) do %>
+                                                                       <option id="cbi-<%=self.config.."-"..k.."-"..val.option%>" value="<%=val.option%>"><%=val.title%></option>
+                                                               <% end %>
+                                                               </select>
+                                                               <script type="text/javascript"><% for key, val in pairs(self.optionals[k]) do %>
+                                                                       <% if #val.deps > 0 then %><% for j, d in ipairs(val.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..k.."-"..val.option%>", "cbid.<%=self.config.."."..k.."."..d.field%>", "<%=d.value%>");
+                                                               <% end %><% end %>
+                                                               <% end %></script>
+                                                       <% end %>
+                                                               <input type="submit" value="<%:add hinzufügen%>" />
+                                                       </div>
+                                               <% end %>
+                                       </fieldset>
+                                       <br />
+<% end %>
+<% if self.addremove then %>
+                               <div class="cbi-section-create">
+                                       <% if self.anonymous then %>
+                                       <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add Eintrag hinzufügen%>" />
+                                       <% else %><input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+                                       <input type="submit" value="<%:cbi_add Eintrag hinzufügen%>" />
+                                       <% end %><% if self.err_invalid then %><div class="cbi-error"><%:cbi_invalid Fehler: Ungültige Eingabe%></div><% end %>
+                               </div>
 <% end %>
                                </div>