From: Steven Barth Date: Fri, 28 Mar 2008 11:00:58 +0000 (+0000) Subject: * CBI: Generalized templates X-Git-Tag: 0.8.0~1189 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fb2a9a328d619ecf329e64cb500ff1385e3f8290;p=oweals%2Fluci.git * CBI: Generalized templates * admin > network > ifaces: Set default value for protocol allowing new sections to be created. --- diff --git a/src/ffluci/model/cbi/admin_network/ifaces.lua b/src/ffluci/model/cbi/admin_network/ifaces.lua index 62e72462f..aaabe653e 100644 --- a/src/ffluci/model/cbi/admin_network/ifaces.lua +++ b/src/ffluci/model/cbi/admin_network/ifaces.lua @@ -10,6 +10,7 @@ s:depends("proto", "dhcp") p = s:option(ListValue, "proto", "Protokoll") p:value("static", "statisch") p:value("dhcp", "DHCP") +p.default = "static" s:option(Value, "ifname", "Schnittstelle") diff --git a/src/ffluci/view/cbi/fvalue.htm b/src/ffluci/view/cbi/fvalue.htm index cce116af3..b609f1d4f 100644 --- a/src/ffluci/view/cbi/fvalue.htm +++ b/src/ffluci/view/cbi/fvalue.htm @@ -1,11 +1,3 @@ -
"> -
<%=self.title%>
-
+<%+cbi/valueheader%> " name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == self.enabled then %> checked="checked"<% end %> value="1" /> -
<%=self.description%>
-
-
- <% if #self.deps > 0 then %><% end %> \ No newline at end of file +<%+cbi/valuefooter%> \ No newline at end of file diff --git a/src/ffluci/view/cbi/lvalue.htm b/src/ffluci/view/cbi/lvalue.htm index 943a18886..f1ae5a093 100644 --- a/src/ffluci/view/cbi/lvalue.htm +++ b/src/ffluci/view/cbi/lvalue.htm @@ -1,6 +1,4 @@ -
"> -
<%=self.title%>
-
+<%+cbi/valueheader%> <% if self.widget == "select" then %> []"<% if self.size then %> size="<%=self.size%>"<% end %>> <%for i, key in pairs(self.keylist) do %> @@ -18,10 +16,4 @@ local v = self:valuelist(section) <% if c == self.size then c = 0 %>
<% end end %> <% end %> -
<%=self.description%>
-
-
- <% if #self.deps > 0 then %><% end %> \ No newline at end of file +<%+cbi/valuefooter%> \ No newline at end of file diff --git a/src/ffluci/view/cbi/nsection.htm b/src/ffluci/view/cbi/nsection.htm index 90dbb3041..9c54a9942 100644 --- a/src/ffluci/view/cbi/nsection.htm +++ b/src/ffluci/view/cbi/nsection.htm @@ -1,32 +1,12 @@ -<% if self:cfgvalue(self.section) then %> -
+<% if self:cfgvalue(self.section) then +section = self.section %> +

<%=self.title%>

<%=self.description%>
<% if self.addremove then %>
- +
<% end %> -
-<% self:render_children(self.section) %> - <% if #self.optionals[self.section] > 0 or self.dynamic then %> -
- - <% if self.dynamic then %> - - <% else %> - - - <% end %> -
- <% end %> -
+<%+cbi/ucisection%>
<% elseif self.addremove then %>
diff --git a/src/ffluci/view/cbi/tsection.htm b/src/ffluci/view/cbi/tsection.htm index ffeb91575..012ae063a 100644 --- a/src/ffluci/view/cbi/tsection.htm +++ b/src/ffluci/view/cbi/tsection.htm @@ -6,37 +6,16 @@
<% end %> <% if not self.anonymous then %>

<%=k%>

<% end %> -
-<% self:render_children(k) %> - <% if #self.optionals[k] > 0 or self.dynamic then %> -
- <% if self.dynamic then %> - - <% else %> - - - <% end %> - -
- <% end %> -
-
+<% section = k %> +<%+cbi/ucisection%> <% end %> <% if self.addremove then %> -
- <% if self.anonymous then %> - - <% else %> - - <% end %><% if self.err_invalid then %>
<%:cbi_invalid Fehler: Ungültige Eingabe%>
<% end %> -
+
+ <% if self.anonymous then %> + + <% else %> + + <% end %><% if self.err_invalid then %>
<%:cbi_invalid Fehler: Ungültige Eingabe%>
<% end %> +
<% end %>
diff --git a/src/ffluci/view/cbi/ucisection.htm b/src/ffluci/view/cbi/ucisection.htm new file mode 100644 index 000000000..ef1b6cb0e --- /dev/null +++ b/src/ffluci/view/cbi/ucisection.htm @@ -0,0 +1,23 @@ +
+<% self:render_children(section) %> + <% if #self.optionals[section] > 0 or self.dynamic then %> +
+ <% if self.dynamic then %> + + <% else %> + + + <% end %> + +
+ <% end %> +
+
\ No newline at end of file diff --git a/src/ffluci/view/cbi/value.htm b/src/ffluci/view/cbi/value.htm index d027bb448..b994790d2 100644 --- a/src/ffluci/view/cbi/value.htm +++ b/src/ffluci/view/cbi/value.htm @@ -1,12 +1,3 @@ -
"> -
<%=self.title%>
-
+<%+cbi/valueheader%> size="<%=self.size%>" <% end %><% if self.maxlength then %>maxlength="<%=self.maxlength%>" <% end %>name="cbid.<%=self.config.."."..section.."."..self.option%>" value="<%=(self:cfgvalue(section) or "")%>" /> -
<%=self.description%>
-
- <% if self.tag_invalid[section] then %>
<%:cbi_invalid Fehler: Ungültige Eingabe%>
<% end %> -
- <% if #self.deps > 0 then %><% end %> +<%+cbi/valuefooter%> diff --git a/src/ffluci/view/cbi/valuefooter.htm b/src/ffluci/view/cbi/valuefooter.htm new file mode 100644 index 000000000..3f92f09e2 --- /dev/null +++ b/src/ffluci/view/cbi/valuefooter.htm @@ -0,0 +1,8 @@ +
<%=self.description%>
+ + <% if self.tag_invalid[section] then %>
<%:cbi_invalid Fehler: Ungültige Eingabe%>
<% end %> + + <% if #self.deps > 0 then %><% end %> \ No newline at end of file diff --git a/src/ffluci/view/cbi/valueheader.htm b/src/ffluci/view/cbi/valueheader.htm new file mode 100644 index 000000000..86c782d71 --- /dev/null +++ b/src/ffluci/view/cbi/valueheader.htm @@ -0,0 +1,3 @@ +
"> +
<%=self.title%>
+
\ No newline at end of file