summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/view/cbi/ucisection.htm
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-12-03 15:17:05 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-08 16:26:20 +0100
commit1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch)
tree35e16f100466e4e00657199b38bb3d87d52bf73f /modules/luci-base/luasrc/view/cbi/ucisection.htm
parent9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff)
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-base/luasrc/view/cbi/ucisection.htm')
-rw-r--r--modules/luci-base/luasrc/view/cbi/ucisection.htm75
1 files changed, 75 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/ucisection.htm b/modules/luci-base/luasrc/view/cbi/ucisection.htm
new file mode 100644
index 0000000000..3b69f12f2e
--- /dev/null
+++ b/modules/luci-base/luasrc/view/cbi/ucisection.htm
@@ -0,0 +1,75 @@
+<%-
+ if type(self.hidden) == "table" then
+ for k, v in pairs(self.hidden) do
+-%>
+ <input type="hidden" id="<%=k%>" name="<%=k%>" value="<%=pcdata(v)%>" />
+<%-
+ end
+ end
+%>
+
+<% if self.tabs then %>
+ <%+cbi/tabcontainer%>
+<% else %>
+ <% self:render_children(section, scope or {}) %>
+<% end %>
+
+<% if self.error and self.error[section] then -%>
+ <div class="cbi-section-error">
+ <ul><% for _, e in ipairs(self.error[section]) do -%>
+ <li>
+ <%- if e == "invalid" then -%>
+ <%:One or more fields contain invalid values!%>
+ <%- elseif e == "missing" then -%>
+ <%:One or more required fields have no value!%>
+ <%- else -%>
+ <%=pcdata(e)%>
+ <%- end -%>
+ </li>
+ <%- end %></ul>
+ </div>
+<%- end %>
+
+<% if self.optionals[section] and #self.optionals[section] > 0 or self.dynamic then %>
+ <div class="cbi-optionals">
+ <% if self.dynamic then %>
+ <input type="text" id="cbi.opt.<%=self.config%>.<%=section%>" name="cbi.opt.<%=self.config%>.<%=section%>" />
+ <% if self.optionals[section] and #self.optionals[section] > 0 then %>
+ <script type="text/javascript">
+ cbi_combobox_init('cbi.opt.<%=self.config%>.<%=section%>', {
+ <%-
+ for i, val in pairs(self.optionals[section]) do
+ -%>
+ <%-=string.format("%q", val.option) .. ":" .. string.format("%q", striptags(val.title))-%>
+ <%-if next(self.optionals[section], i) then-%>,<%-end-%>
+ <%-
+ end
+ -%>
+ }, '', '<%-: -- custom -- -%>');
+ </script>
+ <% end %>
+ <% else %>
+ <select id="cbi.opt.<%=self.config%>.<%=section%>" name="cbi.opt.<%=self.config%>.<%=section%>">
+ <option><%: -- Additional Field -- %></option>
+ <% for key, val in pairs(self.optionals[section]) do -%>
+ <option id="cbi-<%=self.config.."-"..section.."-"..val.option%>" value="<%=val.option%>"><%=striptags(val.title)%></option>
+ <%- end %>
+ </select>
+ <script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %>
+ <% if #val.deps > 0 then %><% for j, d in ipairs(val.deps) do -%>
+ cbi_d_add("cbi-<%=self.config.."-"..section.."-"..val.option..d.add%>", {
+ <%-
+ for k,v in pairs(d.deps) do
+ -%>
+ <%-=string.format('"cbid.%s.%s.%s"', self.config, section, k) .. ":" .. string.format("%q", v)-%>
+ <%-if next(d.deps, k) then-%>,<%-end-%>
+ <%-
+ end
+ -%>
+ });
+ <%- end %><% end %>
+ <% end %></script>
+ <% end %>
+ <input type="submit" class="cbi-button cbi-button-fieldadd" value="<%:Add%>" />
+ </div>
+<% end %>