2 LuCI - Lua Configuration Interface
3 Copyright
2008 Steven Barth
<steven@midlink.org
>
4 Copyright
2008-
2010 Jo-Philipp Wich
<xm@subsignal.org
>
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
10 http://www.apache.org/licenses/LICENSE-
2.0
18 local vals = self:cfgvalue(section) or {}
22 <input class=
"cbi-input-text" value=
"<%=pcdata(val)%>" onchange=
"cbi_d_update(this.id)" type=
"text"<%= attr(
"id", cbid ..
"." .. i) .. attr(
"name", cbid) .. ifattr(self.size,
"size")%
> /><br />
25 <script type=
"text/javascript">
26 cbi_dynlist_init('<%=cbid%
>');
27 <% if self.datatype then -%
>
28 <% if #self.keylist
> 0 then -%
>
29 cbi_combobox_init('<%=cbid ..
"." .. i%
>', {
30 <%- for i, k in ipairs(self.keylist) do -%
>
31 <%-=string.format(
"%q", k) ..
":" .. string.format(
"%q", self.vallist[i])-%
>
32 <%-if i<#self.keylist then-%
>,<%-end-%
>
34 }, '<%- if not self.rmempty and not self.optional then -%
>
36 <%- end -%
>', '<%: -- custom -- %
>');
38 <% for i=
1, #vals +
1 do -%
>
39 cbi_validate_field('<%=cbid%
>.<%=i%
>', <%=tostring(self.optional == true or i
> #vals)%
>, '<%=self.datatype%
>');