5 return (rowcnt %
2) +
1
10 if type(o.width) == 'number' then
11 return '
style=
"width:%dpx"' % o.width
13 return '
style=
"width:%s"' % o.width
20 <fieldset class=
"cbi-section" id=
"cbi-<%=self.config%>-<%=self.sectiontype%>">
21 <% if self.title and #self.title
> 0 then -%
>
22 <legend><%=self.title%
></legend>
24 <%- if self.sortable then -%
>
25 <input type=
"hidden" id=
"cbi.sts.<%=self.config%>.<%=self.sectiontype%>" name=
"cbi.sts.<%=self.config%>.<%=self.sectiontype%>" value=
"" />
27 <div class=
"cbi-section-descr"><%=self.description%
></div>
28 <div class=
"cbi-section-node">
29 <%- local count =
0 -%
>
30 <table class=
"cbi-section-table">
31 <tr class=
"cbi-section-table-titles">
32 <%- if not self.anonymous then -%
>
33 <%- if self.sectionhead then -%
>
34 <th class=
"cbi-section-table-cell"><%=self.sectionhead%
></th>
39 <%- for i, k in pairs(self.children) do if not k.optional then -%
>
40 <th class=
"cbi-section-table-cell"<%=width(k)%
>>
41 <%- if k.titleref then -%
><a title=
"<%=self.titledesc or translate('Go to relevant configuration page')%>" class=
"cbi-title-ref" href=
"<%=k.titleref%>"><%- end -%
>
43 <%- if k.titleref then -%
></a><%- end -%
>
45 <%- count = count +
1; end; end; if self.sortable then -%
>
46 <th class=
"cbi-section-table-cell"><%:Sort%
></th>
47 <%- end; if self.extedit or self.addremove then -%
>
48 <th class=
"cbi-section-table-cell"> </th>
49 <%- count = count +
1; end -%
>
51 <tr class=
"cbi-section-table-descr">
52 <%- if not self.anonymous then -%
>
53 <%- if self.sectiondesc then -%
>
54 <th class=
"cbi-section-table-cell"><%=self.sectiondesc%
></th>
59 <%- for i, k in pairs(self.children) do if not k.optional then -%
>
60 <th class=
"cbi-section-table-cell"<%=width(k)%
>><%=k.description%
></th>
61 <%- end; end; if self.sortable then -%
>
62 <th class=
"cbi-section-table-cell"></th>
63 <%- end; if self.extedit or self.addremove then -%
>
64 <th class=
"cbi-section-table-cell"></th>
67 <%- local isempty = true
68 for i, k in ipairs(self:cfgsections()) do
71 scope = { valueheader =
"cbi/cell_valueheader", valuefooter =
"cbi/cell_valuefooter" }
73 <tr class=
"cbi-section-table-row<% if self.extedit or self.rowcolors then %> cbi-rowstyle-<%=rowstyle()%><% end %>" id=
"cbi-<%=self.config%>-<%=section%>">
74 <% if not self.anonymous then -%
>
75 <th><h3><%=(type(self.sectiontitle) ==
"function") and self:sectiontitle(section) or k%
></h3></th>
80 for k, node in ipairs(self.children) do
81 if not node.optional then
82 node:render(section, scope or {})
87 <%- if self.sortable then -%
>
88 <td class=
"cbi-section-table-cell">
89 <input class=
"cbi-button cbi-button-up" type=
"button" value=
"" onclick=
"return cbi_row_swap(this, true, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" alt=
"<%:Move up%>" title=
"<%:Move up%>" />
90 <input class=
"cbi-button cbi-button-down" type=
"button" value=
"" onclick=
"return cbi_row_swap(this, false, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" alt=
"<%:Move down%>" title=
"<%:Move down%>" />
94 <%- if self.extedit or self.addremove then -%
>
95 <td class=
"cbi-section-table-cell">
96 <%- if self.extedit then -%
>
97 <input class=
"cbi-button cbi-button-edit" type=
"button" value=
"<%:Edit%>"
98 <%- if type(self.extedit) ==
"string" then
99 %
> onclick=
"location.href='<%=self.extedit:format(section)%>'"
100 <%- elseif type(self.extedit) ==
"function" then
101 %
> onclick=
"location.href='<%=self:extedit(section)%>'"
103 %
> alt=
"<%:Edit%>" title=
"<%:Edit%>" />
104 <%- end; if self.addremove then %
>
105 <input class=
"cbi-button cbi-button-remove" type=
"submit" value=
"<%:Delete%>" onclick=
"this.form.cbi_state='del-section'; return true" name=
"cbi.rts.<%=self.config%>.<%=k%>" alt=
"<%:Delete%>" title=
"<%:Delete%>" />
112 <%- if isempty then -%
>
113 <tr class=
"cbi-section-table-row">
114 <td colspan=
"<%=count%>"><em><br /><%:This section contains no values yet%
></em></td>
119 <% if self.error then %
>
120 <div class=
"cbi-section-error">
121 <ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%
>
122 <li><%=pcdata(e):gsub(
"\n",
"<br />")%
></li>
127 <%- if self.addremove then -%
>
128 <% if self.template_addremove then include(self.template_addremove) else -%
>
129 <div class=
"cbi-section-create cbi-tblsection-create">
130 <% if self.anonymous then %
>
131 <input class=
"cbi-button cbi-button-add" type=
"submit" value=
"<%:Add%>" name=
"cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" title=
"<%:Add%>" />
133 <% if self.invalid_cts then -%
><div class=
"cbi-section-error"><% end %
>
134 <input type=
"text" class=
"cbi-section-create-name" id=
"cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name=
"cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" />
135 <script type=
"text/javascript">cbi_validate_field('cbi.cts.<%=self.config%
>.<%=self.sectiontype%
>.<%=section%
>', true, 'uciname');
</script>
136 <input class=
"cbi-button cbi-button-add" type=
"submit" onclick=
"this.form.cbi_state='add-section'; return true" value=
"<%:Add%>" title=
"<%:Add%>" />
137 <% if self.invalid_cts then -%
>
138 <br /><%:Invalid%
></div>