From d4dc08dcb219a278a94e68aa87c13bca6361eeca Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 11 Jun 2014 14:00:09 +0000 Subject: Fix wrong directory in luci-base --- modules/base/luasrc/view/cbi/apply_xhr.htm | 43 ++++++ modules/base/luasrc/view/cbi/browser.htm | 7 + modules/base/luasrc/view/cbi/button.htm | 7 + modules/base/luasrc/view/cbi/cell_valuefooter.htm | 20 +++ modules/base/luasrc/view/cbi/cell_valueheader.htm | 2 + modules/base/luasrc/view/cbi/compound.htm | 1 + modules/base/luasrc/view/cbi/delegator.htm | 24 ++++ modules/base/luasrc/view/cbi/dvalue.htm | 13 ++ modules/base/luasrc/view/cbi/dynlist.htm | 26 ++++ modules/base/luasrc/view/cbi/filebrowser.htm | 108 +++++++++++++++ .../base/luasrc/view/cbi/firewall_zoneforwards.htm | 59 +++++++++ modules/base/luasrc/view/cbi/firewall_zonelist.htm | 89 +++++++++++++ modules/base/luasrc/view/cbi/footer.htm | 26 ++++ modules/base/luasrc/view/cbi/full_valuefooter.htm | 59 +++++++++ modules/base/luasrc/view/cbi/full_valueheader.htm | 9 ++ modules/base/luasrc/view/cbi/fvalue.htm | 9 ++ modules/base/luasrc/view/cbi/header.htm | 7 + modules/base/luasrc/view/cbi/lvalue.htm | 18 +++ modules/base/luasrc/view/cbi/map.htm | 13 ++ modules/base/luasrc/view/cbi/mvalue.htm | 19 +++ modules/base/luasrc/view/cbi/network_ifacelist.htm | 81 ++++++++++++ modules/base/luasrc/view/cbi/network_netinfo.htm | 27 ++++ modules/base/luasrc/view/cbi/network_netlist.htm | 81 ++++++++++++ modules/base/luasrc/view/cbi/nsection.htm | 31 +++++ modules/base/luasrc/view/cbi/nullsection.htm | 38 ++++++ modules/base/luasrc/view/cbi/simpleform.htm | 57 ++++++++ modules/base/luasrc/view/cbi/tabcontainer.htm | 7 + modules/base/luasrc/view/cbi/tabmenu.htm | 13 ++ modules/base/luasrc/view/cbi/tblsection.htm | 146 +++++++++++++++++++++ modules/base/luasrc/view/cbi/tsection.htm | 48 +++++++ modules/base/luasrc/view/cbi/tvalue.htm | 5 + modules/base/luasrc/view/cbi/ucisection.htm | 75 +++++++++++ modules/base/luasrc/view/cbi/upload.htm | 14 ++ modules/base/luasrc/view/cbi/value.htm | 35 +++++ modules/base/luasrc/view/cbi/valuefooter.htm | 1 + modules/base/luasrc/view/cbi/valueheader.htm | 1 + 36 files changed, 1219 insertions(+) create mode 100644 modules/base/luasrc/view/cbi/apply_xhr.htm create mode 100644 modules/base/luasrc/view/cbi/browser.htm create mode 100644 modules/base/luasrc/view/cbi/button.htm create mode 100644 modules/base/luasrc/view/cbi/cell_valuefooter.htm create mode 100644 modules/base/luasrc/view/cbi/cell_valueheader.htm create mode 100644 modules/base/luasrc/view/cbi/compound.htm create mode 100644 modules/base/luasrc/view/cbi/delegator.htm create mode 100644 modules/base/luasrc/view/cbi/dvalue.htm create mode 100644 modules/base/luasrc/view/cbi/dynlist.htm create mode 100644 modules/base/luasrc/view/cbi/filebrowser.htm create mode 100644 modules/base/luasrc/view/cbi/firewall_zoneforwards.htm create mode 100644 modules/base/luasrc/view/cbi/firewall_zonelist.htm create mode 100644 modules/base/luasrc/view/cbi/footer.htm create mode 100644 modules/base/luasrc/view/cbi/full_valuefooter.htm create mode 100644 modules/base/luasrc/view/cbi/full_valueheader.htm create mode 100644 modules/base/luasrc/view/cbi/fvalue.htm create mode 100644 modules/base/luasrc/view/cbi/header.htm create mode 100644 modules/base/luasrc/view/cbi/lvalue.htm create mode 100644 modules/base/luasrc/view/cbi/map.htm create mode 100644 modules/base/luasrc/view/cbi/mvalue.htm create mode 100644 modules/base/luasrc/view/cbi/network_ifacelist.htm create mode 100644 modules/base/luasrc/view/cbi/network_netinfo.htm create mode 100644 modules/base/luasrc/view/cbi/network_netlist.htm create mode 100644 modules/base/luasrc/view/cbi/nsection.htm create mode 100644 modules/base/luasrc/view/cbi/nullsection.htm create mode 100644 modules/base/luasrc/view/cbi/simpleform.htm create mode 100644 modules/base/luasrc/view/cbi/tabcontainer.htm create mode 100644 modules/base/luasrc/view/cbi/tabmenu.htm create mode 100644 modules/base/luasrc/view/cbi/tblsection.htm create mode 100644 modules/base/luasrc/view/cbi/tsection.htm create mode 100644 modules/base/luasrc/view/cbi/tvalue.htm create mode 100644 modules/base/luasrc/view/cbi/ucisection.htm create mode 100644 modules/base/luasrc/view/cbi/upload.htm create mode 100644 modules/base/luasrc/view/cbi/value.htm create mode 100644 modules/base/luasrc/view/cbi/valuefooter.htm create mode 100644 modules/base/luasrc/view/cbi/valueheader.htm (limited to 'modules/base/luasrc/view') diff --git a/modules/base/luasrc/view/cbi/apply_xhr.htm b/modules/base/luasrc/view/cbi/apply_xhr.htm new file mode 100644 index 0000000000..1814c9393b --- /dev/null +++ b/modules/base/luasrc/view/cbi/apply_xhr.htm @@ -0,0 +1,43 @@ +<% export("cbi_apply_xhr", function(id, configs, redirect) -%> +
+ <%:Applying changes%> + + + <%:Loading%> + <%:Waiting for changes to be applied...%> +
+<%- end) %> diff --git a/modules/base/luasrc/view/cbi/browser.htm b/modules/base/luasrc/view/cbi/browser.htm new file mode 100644 index 0000000000..e4a4077d55 --- /dev/null +++ b/modules/base/luasrc/view/cbi/browser.htm @@ -0,0 +1,7 @@ +<% local v = self:cfgvalue(section) -%> +<%+cbi/valueheader%> + /> + +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/button.htm b/modules/base/luasrc/view/cbi/button.htm new file mode 100644 index 0000000000..30f8ddfda5 --- /dev/null +++ b/modules/base/luasrc/view/cbi/button.htm @@ -0,0 +1,7 @@ +<%+cbi/valueheader%> + <% if self:cfgvalue(section) ~= false then %> + " type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> /> + <% else %> + - + <% end %> +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/cell_valuefooter.htm b/modules/base/luasrc/view/cbi/cell_valuefooter.htm new file mode 100644 index 0000000000..220ebd42ba --- /dev/null +++ b/modules/base/luasrc/view/cbi/cell_valuefooter.htm @@ -0,0 +1,20 @@ + +
">
+ + +<% if #self.deps > 0 then -%> + +<%- end %> diff --git a/modules/base/luasrc/view/cbi/cell_valueheader.htm b/modules/base/luasrc/view/cbi/cell_valueheader.htm new file mode 100644 index 0000000000..9e2e145ddb --- /dev/null +++ b/modules/base/luasrc/view/cbi/cell_valueheader.htm @@ -0,0 +1,2 @@ + +
"> diff --git a/modules/base/luasrc/view/cbi/compound.htm b/modules/base/luasrc/view/cbi/compound.htm new file mode 100644 index 0000000000..12d02bb1d8 --- /dev/null +++ b/modules/base/luasrc/view/cbi/compound.htm @@ -0,0 +1 @@ +<%- self:render_children() %> diff --git a/modules/base/luasrc/view/cbi/delegator.htm b/modules/base/luasrc/view/cbi/delegator.htm new file mode 100644 index 0000000000..4fd19265d8 --- /dev/null +++ b/modules/base/luasrc/view/cbi/delegator.htm @@ -0,0 +1,24 @@ +<%- self.active:render() %> +
+ +<% for _, x in ipairs(self.chain) do %> + +<% end %> +<% if not self.disallow_pageactions then %> +<% if self.allow_finish and not self:get_next(self.current) then %> + +<% elseif self:get_next(self.current) then %> + +<% end %> +<% if self.allow_cancel then %> + +<% end %> +<% if self.allow_reset then %> + +<% end %> +<% if self.allow_back and self:get_prev(self.current) then %> + +<% end %> +<% end %> + +
diff --git a/modules/base/luasrc/view/cbi/dvalue.htm b/modules/base/luasrc/view/cbi/dvalue.htm new file mode 100644 index 0000000000..78e6f323d7 --- /dev/null +++ b/modules/base/luasrc/view/cbi/dvalue.htm @@ -0,0 +1,13 @@ +<%+cbi/valueheader%> +<% if self.href then %><% end -%> + <% + local val = self:cfgvalue(section) or self.default or "" + if not self.rawhtml then + write(pcdata(val)) + else + write(val) + end + %> +<%- if self.href then %><%end%> +" /> +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/dynlist.htm b/modules/base/luasrc/view/cbi/dynlist.htm new file mode 100644 index 0000000000..fd626a4ecf --- /dev/null +++ b/modules/base/luasrc/view/cbi/dynlist.htm @@ -0,0 +1,26 @@ +<%+cbi/valueheader%> +
+<% + local vals = self:cfgvalue(section) or {} + for i=1, #vals + 1 do + local val = vals[i] + if (val and #val > 0) or (i == 1) then +%> + />
+<% end end %> +
+ +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/filebrowser.htm b/modules/base/luasrc/view/cbi/filebrowser.htm new file mode 100644 index 0000000000..a79beebba7 --- /dev/null +++ b/modules/base/luasrc/view/cbi/filebrowser.htm @@ -0,0 +1,108 @@ + + + + + Filebrowser - LuCI + + + + + + <% + require("nixio.fs") + require("nixio.util") + require("luci.http") + require("luci.dispatcher") + + local field = luci.http.formvalue('field') + local request = luci.dispatcher.context.args + local path = { '' } + + for i = 1, #request do + if request[i] ~= '..' and #request[i] > 0 then + path[#path+1] = request[i] + end + end + + local filepath = table.concat( path, '/' ) + local filestat = nixio.fs.stat( filepath ) + local baseurl = luci.dispatcher.build_url('admin', 'filebrowser') + + if filestat and filestat.type == "reg" then + table.remove( path, #path ) + filepath = table.concat( path, '/' ) .. '/' + elseif not ( filestat and filestat.type == "dir" ) then + path = { '' } + filepath = '/' + else + filepath = filepath .. '/' + end + + local entries = nixio.util.consume((nixio.fs.dir(filepath))) + -%> +
+ Location: + <% for i, dir in ipairs(path) do %> + <% if i == 1 then %> + (root) + <% elseif next(path, i) then %> + <% baseurl = baseurl .. '/' .. dir %> + / <%=dir%> + <% else %> + <% baseurl = baseurl .. '/' .. dir %> + / <%=dir%> + <% end %> + <% end %> +
+ +
+ +
+
    + <% for _, e in luci.util.vspairs(entries) do + local stat = nixio.fs.stat(filepath..e) + if stat and stat.type == 'dir' then + -%> +
  • + <%:Directory%> + <%=e%>/ +
  • + <% end end -%> + + <% for _, e in luci.util.vspairs(entries) do + local stat = nixio.fs.stat(filepath..e) + if stat and stat.type ~= 'dir' then + -%> +
  • + <%:File%> + <%=e%> +
  • + <% end end -%> +
+
+ + diff --git a/modules/base/luasrc/view/cbi/firewall_zoneforwards.htm b/modules/base/luasrc/view/cbi/firewall_zoneforwards.htm new file mode 100644 index 0000000000..2a433b5696 --- /dev/null +++ b/modules/base/luasrc/view/cbi/firewall_zoneforwards.htm @@ -0,0 +1,59 @@ +<%+cbi/valueheader%> + +<%- + local utl = require "luci.util" + local fwm = require "luci.model.firewall".init() + local nwm = require "luci.model.network".init() + + local zone, fwd, fz + local value = self:formvalue(section) + if not value or value == "-" then + value = self:cfgvalue(section) or self.default + end + + local def = fwm:get_defaults() + local zone = fwm:get_zone(value) + local empty = true +-%> + +<% if zone then %> +
+ +  ⇒  + <% for _, fwd in ipairs(zone:get_forwardings_by("src")) do + fz = fwd:dest_zone() + empty = false %> +   + <% end %> + <% if empty then %> + + <% end %> +
+<% end %> + +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/firewall_zonelist.htm b/modules/base/luasrc/view/cbi/firewall_zonelist.htm new file mode 100644 index 0000000000..7973437f40 --- /dev/null +++ b/modules/base/luasrc/view/cbi/firewall_zonelist.htm @@ -0,0 +1,89 @@ +<%+cbi/valueheader%> + +<%- + local utl = require "luci.util" + local fwm = require "luci.model.firewall".init() + local nwm = require "luci.model.network".init() + + local zone, net, iface + local zones = fwm:get_zones() + local value = self:formvalue(section) + if not value or value == "-" then + value = self:cfgvalue(section) or self.default + end + + local selected = false + local checked = { } + + for value in utl.imatch(value) do + checked[value] = true + end + + if not next(checked) then + checked[""] = true + end +-%> + + + +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/footer.htm b/modules/base/luasrc/view/cbi/footer.htm new file mode 100644 index 0000000000..2c34028e58 --- /dev/null +++ b/modules/base/luasrc/view/cbi/footer.htm @@ -0,0 +1,26 @@ + <%- if pageaction then -%> +
+ <% if redirect then %> +
+ +
+ <% end %> + + <% if flow.skip then %> + + <% end %> + <% if not autoapply and not flow.hideapplybtn then %> + + <% end %> + <% if not flow.hidesavebtn then %> + + <% end %> + <% if not flow.hideresetbtn then %> + + <% end %> + + +
+ <%- end -%> + +<%+footer%> diff --git a/modules/base/luasrc/view/cbi/full_valuefooter.htm b/modules/base/luasrc/view/cbi/full_valuefooter.htm new file mode 100644 index 0000000000..4876fbcc99 --- /dev/null +++ b/modules/base/luasrc/view/cbi/full_valuefooter.htm @@ -0,0 +1,59 @@ + <% if self.description and #self.description > 0 then -%> + <% if not luci.util.instanceof(self, luci.cbi.DynamicList) and (not luci.util.instanceof(self, luci.cbi.Flag) or self.orientation == "horizontal") then -%> +
+ <%- end %> +
+ <%:help%> + <%=self.description%> +
+ <%- end %> + <%- if self.title and #self.title > 0 then -%> +
+ <%- end -%> + + + +<% if #self.deps > 0 or #self.subdeps > 0 then -%> + +<%- end %> diff --git a/modules/base/luasrc/view/cbi/full_valueheader.htm b/modules/base/luasrc/view/cbi/full_valueheader.htm new file mode 100644 index 0000000000..aaf085473a --- /dev/null +++ b/modules/base/luasrc/view/cbi/full_valueheader.htm @@ -0,0 +1,9 @@ +
"> + <%- if self.title and #self.title > 0 then -%> + +
+ <%- end -%> diff --git a/modules/base/luasrc/view/cbi/fvalue.htm b/modules/base/luasrc/view/cbi/fvalue.htm new file mode 100644 index 0000000000..a1e0808e8d --- /dev/null +++ b/modules/base/luasrc/view/cbi/fvalue.htm @@ -0,0 +1,9 @@ +<%+cbi/valueheader%> + /> + /> +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/header.htm b/modules/base/luasrc/view/cbi/header.htm new file mode 100644 index 0000000000..2bddaba61a --- /dev/null +++ b/modules/base/luasrc/view/cbi/header.htm @@ -0,0 +1,7 @@ +<%+header%> +
+
+ + + +
diff --git a/modules/base/luasrc/view/cbi/lvalue.htm b/modules/base/luasrc/view/cbi/lvalue.htm new file mode 100644 index 0000000000..8cc086db42 --- /dev/null +++ b/modules/base/luasrc/view/cbi/lvalue.htm @@ -0,0 +1,18 @@ +<%+cbi/valueheader%> +<% if self.widget == "select" then %> + +<% elseif self.widget == "radio" then + local c = 0 + for i, key in pairs(self.keylist) do + c = c + 1 +%> + /> + ><%=self.vallist[i]%> +<% if c == self.size then c = 0 %><% if self.orientation == "horizontal" then %> <% else %>
<% end %> +<% end end %> +<% end %> +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/map.htm b/modules/base/luasrc/view/cbi/map.htm new file mode 100644 index 0000000000..053220d185 --- /dev/null +++ b/modules/base/luasrc/view/cbi/map.htm @@ -0,0 +1,13 @@ +<%- if firstmap and messages then local msg; for _, msg in ipairs(messages) do -%> +
<%=pcdata(msg)%>
+<%- end end -%> + +<%-+cbi/apply_xhr-%> + +
+ <% if self.title and #self.title > 0 then %>

<%=self.title%>

<% end %> + <% if self.description and #self.description > 0 then %>
<%=self.description%>
<% end %> + <%- if firstmap and applymap then cbi_apply_xhr(self.config, parsechain, redirect) end -%> + <%- self:render_children() %> +
+
diff --git a/modules/base/luasrc/view/cbi/mvalue.htm b/modules/base/luasrc/view/cbi/mvalue.htm new file mode 100644 index 0000000000..6a0b3881d0 --- /dev/null +++ b/modules/base/luasrc/view/cbi/mvalue.htm @@ -0,0 +1,19 @@ +<% local v = self:valuelist(section) or {} -%> +<%+cbi/valueheader%> +<% if self.widget == "select" then %> + +<% elseif self.widget == "checkbox" then + local c = 0; + for i, key in pairs(self.keylist) do + c = c + 1 +%> + /> + ><%=self.vallist[i]%>
+<% if c == self.size then c = 0 %>
+<% end end %> +<% end %> +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/network_ifacelist.htm b/modules/base/luasrc/view/cbi/network_ifacelist.htm new file mode 100644 index 0000000000..643d849a50 --- /dev/null +++ b/modules/base/luasrc/view/cbi/network_ifacelist.htm @@ -0,0 +1,81 @@ +<%+cbi/valueheader%> + +<%- + local utl = require "luci.util" + local net = require "luci.model.network".init() + local cbeid = luci.cbi.FEXIST_PREFIX .. self.config .. "." .. section .. "." .. self.option + + local iface + local ifaces = net:get_interfaces() + local value + + if self.map:formvalue(cbeid) == "1" then + value = self:formvalue(section) or self.default or "" + else + value = self:cfgvalue(section) or self.default + end + + local checked = { } + + if value then + for value in utl.imatch(value) do + checked[value] = true + end + else + local n = self.network and net:get_network(self.network) + if n then + local i + for _, i in ipairs(n:get_interfaces() or { n:get_interface() }) do + checked[i:name()] = true + end + end + end +-%> + + +
    + <% for _, iface in ipairs(ifaces) do + local link = iface:adminlink() + if (not self.nobridges or not iface:is_bridge()) and + (not self.noinactive or iface:is_up()) and + iface:name() ~= self.exclude + then %> +
  • + " onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%= + attr("type", self.widget or "radio") .. + attr("id", cbid .. "." .. iface:name()) .. + attr("name", cbid) .. attr("value", iface:name()) .. + ifattr(checked[iface:name()], "checked", "checked") + %> />   + > + <% if link then -%><% end -%> + style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" /> + <% if link then -%><% end -%> + <%=pcdata(iface:get_i18n())%> + <% local ns = iface:get_networks(); if #ns > 0 then %>( + <%- local i, n; for i, n in ipairs(ns) do -%> + <%-= (i>1) and ', ' -%> + <%=n:name()%> + <%- end -%> + )<% end %> + +
  • + <% end end %> + <% if not self.nocreate then %> +
  • + " onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%= + attr("type", self.widget or "radio") .. + attr("id", cbid .. "_custom") .. + attr("name", cbid) .. + attr("value", " ") + %> />   + > + + <%:Custom Interface%>: + + +
  • + <% end %> +
+ +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/network_netinfo.htm b/modules/base/luasrc/view/cbi/network_netinfo.htm new file mode 100644 index 0000000000..4fd84112a4 --- /dev/null +++ b/modules/base/luasrc/view/cbi/network_netinfo.htm @@ -0,0 +1,27 @@ +<%+cbi/valueheader%> + +<%- + local value = self:formvalue(section) + if not value or value == "-" then + value = self:cfgvalue(section) or self.default + end + + local nwm = require "luci.model.network".init() + local net = nwm:get_network(value) +-%> + +<% if net then %> +<%=net:name()%>: + <% + local empty = true + for _, iface in ipairs(net:get_interfaces() or { net:get_interface() }) do + if not iface:is_bridge() then + empty = false + %> + style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" /> + <% end end %> + <% if empty then %><%:(no interfaces attached)%><% end %> + +<% end %> + +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/network_netlist.htm b/modules/base/luasrc/view/cbi/network_netlist.htm new file mode 100644 index 0000000000..7e23d149a8 --- /dev/null +++ b/modules/base/luasrc/view/cbi/network_netlist.htm @@ -0,0 +1,81 @@ +<%+cbi/valueheader%> + +<%- + local utl = require "luci.util" + local nwm = require "luci.model.network".init() + + local net, iface + local networks = nwm:get_networks() + local value = self:formvalue(section) + + self.cast = nil + + if not value or value == "-" then + value = self:cfgvalue(section) or self.default + end + + local checked = { } + for value in utl.imatch(value) do + checked[value] = true + end +-%> + +
    + <% for _, net in ipairs(networks) do + if (net:name() ~= "loopback") and + (net:name() ~= self.exclude) and + (not self.novirtual or not net:is_virtual()) + then %> +
  • + " onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%= + attr("type", self.widget or "radio") .. + attr("id", cbid .. "." .. net:name()) .. + attr("name", cbid) .. attr("value", net:name()) .. + ifattr(checked[net:name()], "checked", "checked") + %> />   + > + <%=net:name()%>: + <% + local empty = true + for _, iface in ipairs(net:is_bridge() and net:get_interfaces() or { net:get_interface() }) do + if not iface:is_bridge() then + empty = false + %> + style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" /> + <% end end %> + <% if empty then %><%:(no interfaces attached)%><% end %> + + +
  • + <% end end %> + + <% if not self.nocreate then %> +
  • + " onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not value and self.widget ~= "checkbox", "checked", "checked")%> />   +
    + > + <%- if self.widget == "checkbox" then -%> + <%:create:%> + <%- else -%> + <%:unspecified -or- create:%> + <%- end -%>  + onfocus="document.getElementById('<%=cbid%>_new').checked=true" /> +
    +
  • + <% elseif self.widget ~= "checkbox" and self.unspecified then %> +
  • + " onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%= + attr("type", self.widget or "radio") .. + attr("id", cbid .. "_uns") .. + attr("name", cbid) .. + attr("value", "") .. + ifattr(not value or #value == 0, "checked", "checked") + %> />   +
    + ><%:unspecified%> +
    +
  • + <% end %> +
+ +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/nsection.htm b/modules/base/luasrc/view/cbi/nsection.htm new file mode 100644 index 0000000000..95e7658822 --- /dev/null +++ b/modules/base/luasrc/view/cbi/nsection.htm @@ -0,0 +1,31 @@ +<% if self:cfgvalue(self.section) then section = self.section %> +
+ <% if self.title and #self.title > 0 then -%> + <%=self.title%> + <%- end %> + <% if self.description and #self.description > 0 then -%> +
<%=self.description%>
+ <%- end %> + <% if self.addremove then -%> +
+ +
+ <%- end %> + <%+cbi/tabmenu%> +
+ <%+cbi/ucisection%> +
+
+
+<% elseif self.addremove then %> + <% if self.template_addremove then include(self.template_addremove) else -%> +
+ <% if self.title and #self.title > 0 then -%> + <%=self.title%> + <%- end %> +
<%=self.description%>
+ +
+ <%- end %> +<% end %> + diff --git a/modules/base/luasrc/view/cbi/nullsection.htm b/modules/base/luasrc/view/cbi/nullsection.htm new file mode 100644 index 0000000000..bd48950958 --- /dev/null +++ b/modules/base/luasrc/view/cbi/nullsection.htm @@ -0,0 +1,38 @@ +
+ <% if self.title and #self.title > 0 then -%> + <%=self.title%> + <%- end %> + <% if self.description and #self.description > 0 then -%> +
<%=self.description%>
+ <%- end %> +
+
+ <% self:render_children(1, scope or {}) %> +
+ <% if self.error and self.error[1] then -%> +
+
    <% for _, e in ipairs(self.error[1]) do -%> +
  • + <%- 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 -%> +
  • + <%- end %>
+
+ <%- end %> +
+
+
+<%- + if type(self.hidden) == "table" then + for k, v in pairs(self.hidden) do +-%> + +<%- + end + end +%> diff --git a/modules/base/luasrc/view/cbi/simpleform.htm b/modules/base/luasrc/view/cbi/simpleform.htm new file mode 100644 index 0000000000..5216cd50f1 --- /dev/null +++ b/modules/base/luasrc/view/cbi/simpleform.htm @@ -0,0 +1,57 @@ +<% if not self.embedded then %> + +
+ + +
+<% end %> +
+ <% if self.title and #self.title > 0 then %>

<%=self.title%>

<% end %> + <% if self.description and #self.description > 0 then %>
<%=self.description%>
<% end %> + <% self:render_children() %> +
+
+<%- if self.message then %> +
<%=self.message%>
+<%- end %> +<%- if self.errmessage then %> +
<%=self.errmessage%>
+<%- end %> +<% if not self.embedded then %> +
+<%- + if type(self.hidden) == "table" then + for k, v in pairs(self.hidden) do +-%> + +<%- + end + end +%> +<% if redirect then %> +
+ +
+<% end %> +<%- if self.flow and self.flow.skip then %> + +<% end %> +<%- if self.submit ~= false then %> + +<% end %> +<%- if self.reset ~= false then %> + +<% end %> +<%- if self.cancel ~= false and self.on_cancel then %> + +<% end %> + +
+ +<% end %> diff --git a/modules/base/luasrc/view/cbi/tabcontainer.htm b/modules/base/luasrc/view/cbi/tabcontainer.htm new file mode 100644 index 0000000000..38c435d6a1 --- /dev/null +++ b/modules/base/luasrc/view/cbi/tabcontainer.htm @@ -0,0 +1,7 @@ +<% for tab, data in pairs(self.tabs) do %> +
style="display:none"<% end %>> + <% if data.description then %>
<%=data.description%>
<% end %> + <% self:render_tab(tab, section, scope or {}) %> +
+ +<% end %> diff --git a/modules/base/luasrc/view/cbi/tabmenu.htm b/modules/base/luasrc/view/cbi/tabmenu.htm new file mode 100644 index 0000000000..b96ac9ce4b --- /dev/null +++ b/modules/base/luasrc/view/cbi/tabmenu.htm @@ -0,0 +1,13 @@ +<%- if self.tabs then %> +
    + <%- self.selected_tab = luci.http.formvalue("tab." .. self.config .. "." .. section) %> + <%- for _, tab in ipairs(self.tab_names) do if #self.tabs[tab].childs > 0 then %> + + <%- if not self.selected_tab then self.selected_tab = tab end %> +
  • + <%=self.tabs[tab].title%> + <% if tab == self.selected_tab then %><% end %> +
  • + <% end end -%> +
+<% end -%> diff --git a/modules/base/luasrc/view/cbi/tblsection.htm b/modules/base/luasrc/view/cbi/tblsection.htm new file mode 100644 index 0000000000..d928791167 --- /dev/null +++ b/modules/base/luasrc/view/cbi/tblsection.htm @@ -0,0 +1,146 @@ +<%- +local rowcnt = 1 +function rowstyle() + rowcnt = rowcnt + 1 + return (rowcnt % 2) + 1 +end + +function width(o) + if o.width then + if type(o.width) == 'number' then + return ' style="width:%dpx"' % o.width + end + return ' style="width:%s"' % o.width + end + return '' +end +-%> + + +
+ <% if self.title and #self.title > 0 then -%> + <%=self.title%> + <%- end %> + <%- if self.sortable then -%> + + <%- end -%> +
<%=self.description%>
+
+ <%- local count = 0 -%> + + + <%- if not self.anonymous then -%> + <%- if self.sectionhead then -%> + + <%- else -%> + + <%- end -%> + <%- end -%> + <%- for i, k in pairs(self.children) do if not k.optional then -%> + + <%- count = count + 1; end; end; if self.sortable then -%> + + <%- end; if self.extedit or self.addremove then -%> + + <%- count = count + 1; end -%> + + + <%- if not self.anonymous then -%> + <%- if self.sectiondesc then -%> + + <%- else -%> + + <%- end -%> + <%- end -%> + <%- for i, k in pairs(self.children) do if not k.optional then -%> + + <%- end; end; if self.sortable then -%> + + <%- end; if self.extedit or self.addremove then -%> + + <%- end -%> + + <%- local isempty = true + for i, k in ipairs(self:cfgsections()) do + section = k + isempty = false + scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" } + -%> + + <% if not self.anonymous then -%> + + <%- end %> + + + <%- + for k, node in ipairs(self.children) do + if not node.optional then + node:render(section, scope or {}) + end + end + -%> + + <%- if self.sortable then -%> + + <%- end -%> + + <%- if self.extedit or self.addremove then -%> + + <%- end -%> + + <%- end -%> + + <%- if isempty then -%> + + + + <%- end -%> +
<%=self.sectionhead%> > + <%- if k.titleref then -%><%- end -%> + <%-=k.title-%> + <%- if k.titleref then -%><%- end -%> + <%:Sort%> 
<%=self.sectiondesc%>><%=k.description%>

<%=(type(self.sectiontitle) == "function") and self:sectiontitle(section) or k%>

+ + + + <%- if self.extedit then -%> + onclick="location.href='<%=self.extedit:format(section)%>'" + <%- elseif type(self.extedit) == "function" then + %> onclick="location.href='<%=self:extedit(section)%>'" + <%- end + %> alt="<%:Edit%>" title="<%:Edit%>" /> + <%- end; if self.addremove then %> + + <%- end -%> +

<%:This section contains no values yet%>
+ + <% if self.error then %> +
+
    <% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%> +
  • <%=pcdata(e):gsub("\n","
    ")%>
  • + <%- end end %>
+
+ <% end %> + + <%- if self.addremove then -%> + <% if self.template_addremove then include(self.template_addremove) else -%> +
+ <% if self.anonymous then %> + + <% else %> + <% if self.invalid_cts then -%>
<% end %> + + + + <% if self.invalid_cts then -%> +
<%:Invalid%>
+ <%- end %> + <% end %> +
+ <%- end %> + <%- end -%> +
+
+ diff --git a/modules/base/luasrc/view/cbi/tsection.htm b/modules/base/luasrc/view/cbi/tsection.htm new file mode 100644 index 0000000000..087548bf28 --- /dev/null +++ b/modules/base/luasrc/view/cbi/tsection.htm @@ -0,0 +1,48 @@ +
+ <% if self.title and #self.title > 0 then -%> + <%=self.title%> + <%- end %> +
<%=self.description%>
+ <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%> + <% if self.addremove then -%> +
+ +
+ <%- end %> + + <%- section = k; isempty = false -%> + + <% if not self.anonymous then -%> +

<%=section:upper()%>

+ <%- end %> + + <%+cbi/tabmenu%> + +
+ <%+cbi/ucisection%> +
+
+ <%- end %> + + <% if isempty then -%> + <%:This section contains no values yet%>

+ <%- end %> + + <% if self.addremove then -%> + <% if self.template_addremove then include(self.template_addremove) else -%> +
+ <% if self.anonymous then -%> + + <%- else -%> + <% if self.invalid_cts then -%>
<% end %> + + + + <% if self.invalid_cts then -%> +
<%:Invalid%>
+ <%- end %> + <%- end %> +
+ <%- end %> + <%- end %> +
diff --git a/modules/base/luasrc/view/cbi/tvalue.htm b/modules/base/luasrc/view/cbi/tvalue.htm new file mode 100644 index 0000000000..fcf7a6c94c --- /dev/null +++ b/modules/base/luasrc/view/cbi/tvalue.htm @@ -0,0 +1,5 @@ +<%+cbi/valueheader%> + +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/ucisection.htm b/modules/base/luasrc/view/cbi/ucisection.htm new file mode 100644 index 0000000000..3b69f12f2e --- /dev/null +++ b/modules/base/luasrc/view/cbi/ucisection.htm @@ -0,0 +1,75 @@ +<%- + if type(self.hidden) == "table" then + for k, v in pairs(self.hidden) do +-%> + +<%- + end + end +%> + +<% if self.tabs then %> + <%+cbi/tabcontainer%> +<% else %> + <% self:render_children(section, scope or {}) %> +<% end %> + +<% if self.error and self.error[section] then -%> +
+
    <% for _, e in ipairs(self.error[section]) do -%> +
  • + <%- 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 -%> +
  • + <%- end %>
+
+<%- end %> + +<% if self.optionals[section] and #self.optionals[section] > 0 or self.dynamic then %> +
+ <% if self.dynamic then %> + + <% if self.optionals[section] and #self.optionals[section] > 0 then %> + + <% end %> + <% else %> + + + <% end %> + +
+<% end %> diff --git a/modules/base/luasrc/view/cbi/upload.htm b/modules/base/luasrc/view/cbi/upload.htm new file mode 100644 index 0000000000..7770934111 --- /dev/null +++ b/modules/base/luasrc/view/cbi/upload.htm @@ -0,0 +1,14 @@ +<% + local t = require("luci.tools.webadmin") + local v = self:cfgvalue(section) + local s = v and nixio.fs.stat(v) +-%> +<%+cbi/valueheader%> + <% if s then %> + <%:Uploaded File%> (<%=t.byte_format(s.size)%>) + /> + " alt="<%:Replace entry%>" title="<%:Replace entry%>" src="<%=resource%>/cbi/reload.gif" /> + <% else %> + /> + <% end %> +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/value.htm b/modules/base/luasrc/view/cbi/value.htm new file mode 100644 index 0000000000..d1a7bea5c6 --- /dev/null +++ b/modules/base/luasrc/view/cbi/value.htm @@ -0,0 +1,35 @@ +<%+cbi/valueheader%> + /> + <% if self.password then %><% end %> + <% if #self.keylist > 0 or self.datatype then -%> + + <% end -%> +<%+cbi/valuefooter%> diff --git a/modules/base/luasrc/view/cbi/valuefooter.htm b/modules/base/luasrc/view/cbi/valuefooter.htm new file mode 100644 index 0000000000..805312e451 --- /dev/null +++ b/modules/base/luasrc/view/cbi/valuefooter.htm @@ -0,0 +1 @@ +<% include( valuefooter or "cbi/full_valuefooter" ) %> diff --git a/modules/base/luasrc/view/cbi/valueheader.htm b/modules/base/luasrc/view/cbi/valueheader.htm new file mode 100644 index 0000000000..761a54aed0 --- /dev/null +++ b/modules/base/luasrc/view/cbi/valueheader.htm @@ -0,0 +1 @@ +<% include( valueheader or "cbi/full_valueheader" ) %> -- cgit v1.2.3