summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/view/cbi
diff options
context:
space:
mode:
Diffstat (limited to 'libs/web/luasrc/view/cbi')
-rw-r--r--libs/web/luasrc/view/cbi/browser.htm23
-rw-r--r--libs/web/luasrc/view/cbi/button.htm21
-rw-r--r--libs/web/luasrc/view/cbi/cell_valuefooter.htm34
-rw-r--r--libs/web/luasrc/view/cbi/cell_valueheader.htm17
-rw-r--r--libs/web/luasrc/view/cbi/compound.htm14
-rw-r--r--libs/web/luasrc/view/cbi/delegator.htm37
-rw-r--r--libs/web/luasrc/view/cbi/dvalue.htm22
-rw-r--r--libs/web/luasrc/view/cbi/dynlist.htm52
-rw-r--r--libs/web/luasrc/view/cbi/filebrowser.htm123
-rw-r--r--libs/web/luasrc/view/cbi/firewall_zonelist.htm89
-rw-r--r--libs/web/luasrc/view/cbi/footer.htm29
-rw-r--r--libs/web/luasrc/view/cbi/full_valuefooter.htm74
-rw-r--r--libs/web/luasrc/view/cbi/full_valueheader.htm24
-rw-r--r--libs/web/luasrc/view/cbi/fvalue.htm17
-rw-r--r--libs/web/luasrc/view/cbi/header.htm22
-rw-r--r--libs/web/luasrc/view/cbi/lvalue.htm32
-rw-r--r--libs/web/luasrc/view/cbi/map.htm63
-rw-r--r--libs/web/luasrc/view/cbi/mvalue.htm35
-rw-r--r--libs/web/luasrc/view/cbi/network_ifacelist.htm54
-rw-r--r--libs/web/luasrc/view/cbi/network_netlist.htm61
-rw-r--r--libs/web/luasrc/view/cbi/nsection.htm46
-rw-r--r--libs/web/luasrc/view/cbi/nullsection.htm32
-rw-r--r--libs/web/luasrc/view/cbi/simpleform.htm66
-rw-r--r--libs/web/luasrc/view/cbi/tabcontainer.htm21
-rw-r--r--libs/web/luasrc/view/cbi/tabmenu.htm27
-rw-r--r--libs/web/luasrc/view/cbi/tblsection.htm135
-rw-r--r--libs/web/luasrc/view/cbi/tsection.htm62
-rw-r--r--libs/web/luasrc/view/cbi/tvalue.htm19
-rw-r--r--libs/web/luasrc/view/cbi/ucisection.htm90
-rw-r--r--libs/web/luasrc/view/cbi/upload.htm29
-rw-r--r--libs/web/luasrc/view/cbi/value.htm44
-rw-r--r--libs/web/luasrc/view/cbi/valuefooter.htm16
-rw-r--r--libs/web/luasrc/view/cbi/valueheader.htm16
33 files changed, 1446 insertions, 0 deletions
diff --git a/libs/web/luasrc/view/cbi/browser.htm b/libs/web/luasrc/view/cbi/browser.htm
new file mode 100644
index 000000000..3b7b23f5d
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/browser.htm
@@ -0,0 +1,23 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<%
+ local t = require("luci.tools.webadmin")
+ local v = self:cfgvalue(section)
+-%>
+<%+cbi/valueheader%>
+ <input class="cbi-input-text" type="text"<%= attr("value", v) .. attr("name", cbid) .. attr("id", cbid) %> />
+ <input class="cbi-input-image" type="image" value="<%:Search file...%>" onclick="cbi_filebrowser('<%=cbid%>','<%=luci.dispatcher.build_url("admin", "filebrowser")%>'<%=self.default_path and ", '"..self.default_path.."'"%>);return false" alt="<%:Search file...%>" title="<%:Search file...%>" src="<%=resource%>/cbi/folder.png" style="vertical-align:bottom" />
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/button.htm b/libs/web/luasrc/view/cbi/button.htm
new file mode 100644
index 000000000..5a5189794
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/button.htm
@@ -0,0 +1,21 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+ <% if self:cfgvalue(section) ~= false then %>
+ <input class="cbi-input-<%=self.inputstyle or "button" %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.title)%> />
+ <% else %>
+ -
+ <% end %>
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/cell_valuefooter.htm b/libs/web/luasrc/view/cbi/cell_valuefooter.htm
new file mode 100644
index 000000000..c325e49cb
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/cell_valuefooter.htm
@@ -0,0 +1,34 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+</div>
+<div id="cbip-<%=self.config.."-"..section.."-"..self.option%>"></div>
+</td>
+
+<% if #self.deps > 0 then -%>
+ <script type="text/javascript">
+ <% for j, d in ipairs(self.deps) do -%>
+ cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.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
+ -%>
+ }, "cbip-<%=self.config.."-"..section.."-"..self.option%>");
+ <%- end %>
+ </script>
+<%- end %> \ No newline at end of file
diff --git a/libs/web/luasrc/view/cbi/cell_valueheader.htm b/libs/web/luasrc/view/cbi/cell_valueheader.htm
new file mode 100644
index 000000000..0f24f1f76
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/cell_valueheader.htm
@@ -0,0 +1,17 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<td class="cbi-value-field<% if self.error and self.error[section] then %> cbi-value-error<% end %>">
+<div id="cbi-<%=self.config.."-"..section.."-"..self.option%>">
diff --git a/libs/web/luasrc/view/cbi/compound.htm b/libs/web/luasrc/view/cbi/compound.htm
new file mode 100644
index 000000000..fbd5a0a07
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/compound.htm
@@ -0,0 +1,14 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2009 Steven Barth <steven@midlink.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%- self:render_children() %> \ No newline at end of file
diff --git a/libs/web/luasrc/view/cbi/delegator.htm b/libs/web/luasrc/view/cbi/delegator.htm
new file mode 100644
index 000000000..ed7c6b4ea
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/delegator.htm
@@ -0,0 +1,37 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2009 Steven Barth <steven@midlink.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%- self.active:render() %>
+ <div class="cbi-page-actions">
+ <input type="hidden" name="cbi.delg.current" value="<%=self.current%>" />
+<% for _, x in ipairs(self.chain) do %>
+ <input type="hidden" name="cbi.delg.path" value="<%=x%>" />
+<% end %>
+<% if not self.disallow_pageactions then %>
+<% if self.allow_finish and not self:get_next(self.current) then %>
+ <input class="cbi-button cbi-button-finish" type="submit" value="<%:Finish%>" />
+<% elseif self:get_next(self.current) then %>
+ <input class="cbi-button cbi-button-next" type="submit" value="<%:Next »%>" />
+<% end %>
+<% if self.allow_cancel then %>
+ <input class="cbi-button cbi-button-cancel" type="submit" name="cbi.cancel" value="<%:Cancel%>" />
+<% end %>
+<% if self.allow_reset then %>
+ <input class="cbi-button cbi-button-reset" type="reset" value="<%:Reset%>" />
+<% end %>
+<% if self.allow_back and self:get_prev(self.current) then %>
+ <input class="cbi-button cbi-button-back" type="submit" name="cbi.delg.back" value="<%:« Back%>" />
+<% end %>
+<% end %>
+ <script type="text/javascript">cbi_d_update();</script>
+ </div> \ No newline at end of file
diff --git a/libs/web/luasrc/view/cbi/dvalue.htm b/libs/web/luasrc/view/cbi/dvalue.htm
new file mode 100644
index 000000000..9745fff4c
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/dvalue.htm
@@ -0,0 +1,22 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<%+cbi/valueheader%>
+<% if self.href then %><a href="<%=self.href%>"><% end -%>
+ <%=pcdata(self:cfgvalue(section) or self.default or "")%>
+<%- if self.href then %></a><%end%>
+&#160;
+<input type="hidden" id="<%=cbid%>" value="<%=pcdata(self:cfgvalue(section) or self.default or "")%>" />
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/dynlist.htm b/libs/web/luasrc/view/cbi/dynlist.htm
new file mode 100644
index 000000000..826e2e698
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/dynlist.htm
@@ -0,0 +1,52 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+<%
+ local vals = self:cfgvalue(section) or {}
+ for i=1, #vals + 1 do
+ local val = vals[i]
+%>
+ <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")%> />
+ <% if i <= #vals then %>
+ <input class="cbi-input-image" type="image" value="<%:Delete%>" name="cbi.rle.<%=section .. "." .. self.option .. "." .. i%>" alt="<%:Delete%>" title="<%:Delete%>" src="<%=resource%>/cbi/remove.gif" />
+ <% else %>
+ <input class="cbi-input-image" type="image" value="<%:Add%>" name="cbi.ale.<%=section .. "." .. self.option%>" alt="<%:Add%>" title="<%:Add%>" src="<%=resource%>/cbi/add.gif" />
+ <% end %>
+ <% if #self.keylist > 0 then -%>
+ <script type="text/javascript">
+ cbi_combobox_init('<%=cbid .. "." .. i%>', {
+ <%-
+ for i, k in ipairs(self.keylist) do
+ -%>
+ <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
+ <%-if i<#self.keylist then-%>,<%-end-%>
+ <%-
+ end
+ -%>
+ }, '<%- if not self.rmempty and not self.optional then -%>
+ <%-:cbi_select-%>
+ <%- end -%>', '<%: -- custom -- %>');
+ </script>
+ <% end -%>
+<% if i <= #vals then %><br />
+<% end end %>
+<% if self.datatype then -%>
+ <script type="text/javascript">
+ <% for i=1, #vals + 1 do -%>
+ cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring(self.optional == true or i > #vals)%>, '<%=self.datatype%>');
+ <%- end %>
+ </script>
+<% end -%>
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/filebrowser.htm b/libs/web/luasrc/view/cbi/filebrowser.htm
new file mode 100644
index 000000000..f82957221
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/filebrowser.htm
@@ -0,0 +1,123 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Filebrowser - LuCI</title>
+ <style type="text/css">
+ #path, #listing {
+ font-size: 85%;
+ }
+
+ ul {
+ padding-left: 0;
+ list-style-type: none;
+ }
+
+ li img {
+ vertical-align: bottom;
+ margin-right: 0.2em;
+ }
+ </style>
+
+ <script type="text/javascript">
+ function callback(path) {
+ if( window.opener ) {
+ var input = window.opener.document.getElementById('<%=luci.http.formvalue('field')%>');
+ if( input ) {
+ input.value = path;
+ window.close();
+ }
+ }
+ }
+ </script>
+</head>
+<body>
+ <%
+ require("nixio.fs")
+ require("nixio.util")
+ require("luci.http")
+ require("luci.dispatcher")
+
+ local field = luci.http.formvalue('field')
+ local request = luci.dispatcher.context.path
+ local path = { '' }
+
+ for i = 3, #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)))
+ -%>
+ <div id="path">
+ Location:
+ <% for i, dir in ipairs(path) do %>
+ <% if i == 1 then %>
+ <a href="<%=baseurl%>?field=<%=field%>">(root)</a>
+ <% elseif next(path, i) then %>
+ <% baseurl = baseurl .. '/' .. dir %>
+ / <a href="<%=baseurl%>?field=<%=field%>"><%=dir%></a>
+ <% else %>
+ <% baseurl = baseurl .. '/' .. dir %>
+ / <%=dir%>
+ <% end %>
+ <% end %>
+ </div>
+
+ <hr />
+
+ <div id="listing">
+ <ul>
+ <% for _, e in luci.util.vspairs(entries) do
+ local stat = nixio.fs.stat(filepath..e)
+ if stat and stat.type == 'dir' then
+ -%>
+ <li class="dir">
+ <img src="/luci-static/resources/cbi/folder.png" alt="Directory" />
+ <a href="<%=baseurl%>/<%=e%>?field=<%=field%>"><%=e%>/</a>
+ </li>
+ <% end end -%>
+
+ <% for _, e in luci.util.vspairs(entries) do
+ local stat = nixio.fs.stat(filepath..e)
+ if stat and stat.type ~= 'dir' then
+ -%>
+ <li class="file">
+ <img src="/luci-static/resources/cbi/file.png" alt="File" />
+ <a href="#" onclick="callback('<%=filepath..e%>')"><%=e%></a>
+ </li>
+ <% end end -%>
+ </ul>
+ </div>
+</body>
+</html>
diff --git a/libs/web/luasrc/view/cbi/firewall_zonelist.htm b/libs/web/luasrc/view/cbi/firewall_zonelist.htm
new file mode 100644
index 000000000..4f4106b87
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/firewall_zonelist.htm
@@ -0,0 +1,89 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+
+<%-
+ local utl = require "luci.util"
+ local fwm = require "luci.model.firewall"
+ local nwm = require "luci.model.network"
+
+ 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 = { }
+
+ if value and #value == 0 then
+ value = nil
+ elseif type(value) == "table" then
+ for _, value in ipairs(value) do
+ checked[value] = true
+ end
+ elseif value then
+ checked[value] = true
+ end
+-%>
+
+<ul style="margin:0; list-style-type:none; text-align:left">
+ <%
+ for _, zone in utl.spairs(zones, function(a,b) return (zones[a]:name() < zones[b]:name()) end) do
+ if zone:name() ~= self.exclude then
+ selected = selected or (value == zone:name())
+ %>
+ <li style="padding:0.5em">
+ <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "." .. zone:name()) .. attr("name", cbid) .. attr("value", zone:name()) .. ifattr(checked[zone:name()], "checked", "checked")%> /> &nbsp;
+ <label<%=attr("for", cbid .. "." .. zone:name())%> style="background-color:<%=zone:get_color()%>; padding:0.5em">
+ <strong><%=zone:name()%>:</strong>
+ <%
+ local zempty = true
+ for _, net in ipairs(zone:get_networks()) do
+ net = nwm:get_network(net)
+ if net then
+ zempty = false
+ %>
+ &nbsp;
+ <%- if net:name() == self.network then -%>
+ <span style="background-color:#FFFFFF; border:1px solid #000000; padding:2px; font-weight:bold"><%=net:name()%>:
+ <%- else -%>
+ <span style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:2px"><%=net:name()%>:
+ <%- end -%>
+ <%
+ local nempty = true
+ for _, iface in ipairs(net and net:get_interfaces() or {}) do
+ nempty = false
+ %>
+ <img<%=attr("title", iface:get_i18n())%> style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
+ <% end %>
+ <% if nempty then %><em><%:(no interfaces attached)%></em><% end %>
+ </span>
+ <% end end %>
+ <% if zempty then %><em><%:(no interfaces attached)%></em><% end %>
+ </label>
+ </li>
+ <% end end %>
+
+ <% if self.widget ~= "checkbox" and not self.nocreate then %>
+ <li style="padding:0.5em">
+ <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%=attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not selected, "checked", "checked")%> /> &nbsp;
+ <div style="background-color:<%=fwm.zone.get_color()%>; padding:0.5em; display:inline">
+ <label<%=attr("for", cbid .. "_new")%>><em><%:unspecified -or- create:%>&nbsp;</em></label>
+ <input style="width:6em" type="text"<%=attr("name", cbid .. ".newzone") .. ifattr(not selected, "value", luci.http.formvalue(cbid .. ".newzone") or self.default)%> onfocus="document.getElementById('<%=cbid%>_new').checked=true" />
+ </div>
+ </li>
+ <% end %>
+</ul>
+
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/footer.htm b/libs/web/luasrc/view/cbi/footer.htm
new file mode 100644
index 000000000..fe5b6881c
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/footer.htm
@@ -0,0 +1,29 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+ <%- if pageaction then -%>
+ <div class="cbi-page-actions">
+ <% if flow.skip then %>
+ <input class="cbi-button cbi-button-skip" type="submit" name="cbi.skip" value="<%:Skip%>" />
+ <% end %>
+ <% if not autoapply then%>
+ <input class="cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:Save & Apply%>" />
+ <% end %>
+ <input class="cbi-button cbi-button-save" type="submit" value="<%:Save%>" />
+ <input class="cbi-button cbi-button-reset" type="reset" value="<%:Reset%>" />
+ <script type="text/javascript">cbi_d_update();</script>
+ </div>
+ <%- end -%>
+</form>
+<%+footer%>
diff --git a/libs/web/luasrc/view/cbi/full_valuefooter.htm b/libs/web/luasrc/view/cbi/full_valuefooter.htm
new file mode 100644
index 000000000..c069b7f92
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/full_valuefooter.htm
@@ -0,0 +1,74 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+ <% if self.description and #self.description > 0 then -%>
+ <% if not luci.util.instanceof( self, luci.cbi.Flag ) or self.orientation == "horizontal" then -%>
+ <br />
+ <%- end %>
+ <div class="cbi-value-description">
+ <span class="cbi-value-helpicon"><img src="<%=resource%>/cbi/help.gif" alt="<%:help%>" /></span>
+ <%=self.description%>
+ </div>
+ <%- end %>
+ <%- if self.title and #self.title > 0 then -%>
+ </div>
+ <%- end -%>
+</div>
+
+
+<% if #self.deps > 0 or #self.subdeps > 0 then -%>
+ <script type="text/javascript" id="cbip-<%=self.config.."-"..section.."-"..self.option%>">
+ <% for j, d in ipairs(self.subdeps) do -%>
+ cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option..d.add%>", {
+ <%-
+ for k,v in pairs(d.deps) do
+ local depk
+ if k:find("!", 1, true) then
+ depk = string.format('"%s"', k)
+ elseif k:find(".", 1, true) then
+ depk = string.format('"cbid.%s"', k)
+ else
+ depk = string.format('"cbid.%s.%s.%s"', self.config, section, k)
+ end
+ -%>
+ <%-= depk .. ":" .. string.format("%q", v)-%>
+ <%-if next(d.deps, k) then-%>,<%-end-%>
+ <%-
+ end
+ -%>
+ }, "cbip-<%=self.config.."-"..section.."-"..self.option..d.add%>");
+ <%- end %>
+ <% for j, d in ipairs(self.deps) do -%>
+ cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option..d.add%>", {
+ <%-
+ for k,v in pairs(d.deps) do
+ local depk
+ if k:find("!", 1, true) then
+ depk = string.format('"%s"', k)
+ elseif k:find(".", 1, true) then
+ depk = string.format('"cbid.%s"', k)
+ else
+ depk = string.format('"cbid.%s.%s.%s"', self.config, section, k)
+ end
+ -%>
+ <%-= depk .. ":" .. string.format("%q", v)-%>
+ <%-if next(d.deps, k) then-%>,<%-end-%>
+ <%-
+ end
+ -%>
+ }, "cbip-<%=self.config.."-"..section.."-"..self.option..d.add%>");
+ <%- end %>
+ </script>
+<%- end %>
diff --git a/libs/web/luasrc/view/cbi/full_valueheader.htm b/libs/web/luasrc/view/cbi/full_valueheader.htm
new file mode 100644
index 000000000..ecd401498
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/full_valueheader.htm
@@ -0,0 +1,24 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<div class="cbi-value<% if self.error and self.error[section] then %> cbi-value-error<% end %>" id="cbi-<%=self.config.."-"..section.."-"..self.option%>">
+ <%- if self.title and #self.title > 0 then -%>
+ <label class="cbi-value-title"<%= attr("for", cbid) %>>
+ <%- if self.titleref then -%><a title="<%=self.titledesc or translate('Go to relevant configuration page')%>" class="cbi-title-ref" href="<%=self.titleref%>"><%- end -%>
+ <%-=self.title-%>
+ <%- if self.titleref then -%></a><%- end -%>
+ </label>
+ <div class="cbi-value-field">
+ <%- end -%>
diff --git a/libs/web/luasrc/view/cbi/fvalue.htm b/libs/web/luasrc/view/cbi/fvalue.htm
new file mode 100644
index 000000000..35ebac6e1
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/fvalue.htm
@@ -0,0 +1,17 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+ <input class="cbi-input-checkbox" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="checkbox"<%= attr("id", cbid) .. attr("name", cbid) .. ifattr((self:cfgvalue(section) or self.default) == self.enabled, "checked", "checked") %> value="1" />
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/header.htm b/libs/web/luasrc/view/cbi/header.htm
new file mode 100644
index 000000000..fd1ab8bd1
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/header.htm
@@ -0,0 +1,22 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<%+header%>
+<form method="post" name="cbi" action="<%=REQUEST_URI%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, '<%:Some fields are invalid, cannot save values!%>')">
+ <div>
+ <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+ <input type="hidden" name="cbi.submit" value="1" />
+ <input type="submit" value="<%:Save%>" class="hidden" />
+ </div>
diff --git a/libs/web/luasrc/view/cbi/lvalue.htm b/libs/web/luasrc/view/cbi/lvalue.htm
new file mode 100644
index 000000000..8c7581a2c
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/lvalue.htm
@@ -0,0 +1,32 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+<% if self.widget == "select" then %>
+ <select class="cbi-input-select" onchange="cbi_d_update(this.id)"<%= attr("id", cbid) .. attr("name", cbid) .. ifattr(self.size, "size") %>>
+ <% for i, key in pairs(self.keylist) do -%>
+ <option id="cbi-<%=self.config.."-"..section.."-"..self.option.."-"..key%>"<%= attr("value", key) .. ifattr((self:cfgvalue(section) or self.default) == key, "selected", "selected") %>><%=striptags(self.vallist[i])%></option>
+ <%- end %>
+ </select>
+<% elseif self.widget == "radio" then
+ local c = 0
+ for i, key in pairs(self.keylist) do
+ c = c + 1
+%>
+ <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%= attr("id", cbid..c) .. attr("name", cbid) .. attr("value", key) .. ifattr((self:cfgvalue(section) or self.default) == key, "checked", "checked") %> />
+ <label<%= attr("for", cbid..c) %>><%=self.vallist[i]%></label>
+<% if c == self.size then c = 0 %><% if self.orientation == "horizontal" then %>&nbsp;<% else %><br /><% end %>
+<% end end %>
+<% end %>
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/map.htm b/libs/web/luasrc/view/cbi/map.htm
new file mode 100644
index 000000000..be0c37aa7
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/map.htm
@@ -0,0 +1,63 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<div class="cbi-map" id="cbi-<%=self.config%>">
+ <% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
+ <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
+ <%- if self._apply then -%>
+ <fieldset class="cbi-section" id="cbi-apply-<%=self.config%>">
+ <legend><%:Applying changes%></legend>
+ <script type="text/javascript"><![CDATA[
+ var apply_xhr = new XHR();
+
+ apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "restart", table.concat(self.parsechain, ","))%>', null,
+ function() {
+ var intv = window.setInterval(
+ function() {
+ apply_xhr.abort();
+ apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "status")%>', null,
+ function(x) {
+ if( x.responseText == 'finish' )
+ {
+ window.clearInterval(intv);
+
+ var e = document.getElementById('cbi-apply-<%=self.config%>-status');
+ if( e )
+ {
+ e.innerHTML = '<%:Configuration applied.%>';
+ window.setTimeout(function() { e.parentNode.style.display = 'none' }, 1000);
+ }
+ }
+ else
+ {
+ var e = document.getElementById('cbi-apply-<%=self.config%>-status');
+ if( e && x.responseText ) e.innerHTML = x.responseText;
+
+ }
+ }
+ );
+ }, 1000
+ )
+ }
+ );
+ ]]></script>
+
+ <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
+ <span id="cbi-apply-<%=self.config%>-status"><%:Waiting for router...%></span>
+ </fieldset>
+ <%- end -%>
+ <%- self:render_children() %>
+ <br />
+</div>
diff --git a/libs/web/luasrc/view/cbi/mvalue.htm b/libs/web/luasrc/view/cbi/mvalue.htm
new file mode 100644
index 000000000..3812a3f7e
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/mvalue.htm
@@ -0,0 +1,35 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%
+local v = self:valuelist(section) or {}
+%>
+<%+cbi/valueheader%>
+<% if self.widget == "select" then %>
+ <select class="cbi-input-select" multiple="multiple"<%= attr("name", cbid) .. ifattr(self.size, "size") %>>
+ <% for i, key in pairs(self.keylist) do -%>
+ <option<%= attr("value", key) .. ifattr(luci.util.contains(v, key), "selected", "selected") %>><%=striptags(self.vallist[i])%></option>
+ <%- end %>
+ </select>
+<% elseif self.widget == "checkbox" then
+ local c = 0;
+ for i, key in pairs(self.keylist) do
+ c = c + 1
+%>
+ <input class="cbi-input-checkbox" type="checkbox"<%= attr("id", cbid..c) .. attr("name", cbid) .. attr("value", key) .. ifattr(luci.util.contains(v, key), "checked", "checked") %> />
+ <label<%= attr("for", cbid..c) %>><%=self.vallist[i]%></label><br />
+<% if c == self.size then c = 0 %><br />
+<% end end %>
+<% end %>
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/network_ifacelist.htm b/libs/web/luasrc/view/cbi/network_ifacelist.htm
new file mode 100644
index 000000000..2f9821817
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/network_ifacelist.htm
@@ -0,0 +1,54 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+
+<%-
+ local utl = require "luci.util"
+ local net = require "luci.model.network"
+
+ local iface
+ local ifaces = net:get_interfaces()
+ local value = (self:formvalue(section) or self.default or "")
+ local checked = { }
+
+ if value and #value > 0 then
+ if type(value) == "table" then value = table.concat(value, " ") end
+ for value in value:gmatch("%S+") 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()) do
+ checked[i:name()] = true
+ end
+ end
+ end
+-%>
+
+<ul style="margin:0; list-style-type:none">
+ <% for _, iface in utl.spairs(ifaces, function(a,b) return (ifaces[a]:type() < ifaces[b]:type()) end) do
+ if not self.nobridges or not iface:is_bridge() then %>
+ <li>
+ <input class="cbi-input-<%=self.widget or "radio"%>" 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")%> /> &nbsp;
+ <label<%=attr("for", cbid .. "." .. iface:name())%>>
+ <img title="<%=iface:get_type_i18n()%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
+ <%=iface:get_i18n()%><% local n = iface:get_network(); if n then %> (<%=n:name()%>)<% end %>
+ </label>
+ </li>
+ <% end end %>
+</ul>
+
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/network_netlist.htm b/libs/web/luasrc/view/cbi/network_netlist.htm
new file mode 100644
index 000000000..c47b3a70e
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/network_netlist.htm
@@ -0,0 +1,61 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+
+<%-
+ local utl = require "luci.util"
+ local nwm = require "luci.model.network"
+
+ local net, iface
+ local networks = nwm:get_networks()
+ local value = self:formvalue(section)
+
+ if not value or value == "-" then
+ value = self:cfgvalue(section) or self.default
+ end
+-%>
+
+<ul style="margin:0; list-style-type:none; text-align:left">
+ <% for _, net in utl.spairs(networks, function(a,b) return (networks[a]:name() < networks[b]:name()) end) do
+ if net:name() ~= "loopback" then %>
+ <li style="padding:0.25em 0">
+ <input class="cbi-input-radio" 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(value == net:name(), "checked", "checked")%> /> &nbsp;
+ <label<%=attr("for", cbid .. "." .. net:name())%>>
+ &nbsp;<span style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:2px"><%=net:name()%>:
+ <%
+ local empty = true
+ for _, iface in ipairs(net:get_interfaces()) do
+ if not iface:is_bridge() then
+ empty = false
+ %>
+ <img<%=attr("title", iface:get_i18n())%> 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 %><em><%:(no interfaces attached)%></em><% end %>
+ </span>
+ </label>
+ </li>
+ <% end end %>
+
+ <% if self.widget ~= "checkbox" and not self.nocreate then %>
+ <li style="padding:0.25em 0">
+ <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%=attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not value, "checked", "checked")%> /> &nbsp;
+ <div style="padding:0.5em; display:inline">
+ <label<%=attr("for", cbid .. "_new")%>><em><%:unspecified -or- create:%>&nbsp;</em></label>
+ <input style="width:6em" type="text"<%=attr("name", cbid .. ".newnet")%> onfocus="document.getElementById('<%=cbid%>_new').checked=true" />
+ </div>
+ </li>
+ <% end %>
+</ul>
+
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/nsection.htm b/libs/web/luasrc/view/cbi/nsection.htm
new file mode 100644
index 000000000..1d231c542
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/nsection.htm
@@ -0,0 +1,46 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<% if self:cfgvalue(self.section) then section = self.section %>
+ <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=section%>">
+ <% if self.title and #self.title > 0 then -%>
+ <legend><%=self.title%></legend>
+ <%- end %>
+ <% if self.description and #self.description > 0 then -%>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <%- end %>
+ <% if self.addremove then -%>
+ <div class="cbi-section-remove right">
+ <input type="submit" name="cbi.rns.<%=self.config%>.<%=section%>" value="<%:Delete%>" />
+ </div>
+ <%- end %>
+ <%+cbi/tabmenu%>
+ <div class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
+ <%+cbi/ucisection%>
+ </div>
+ <br />
+ </fieldset>
+<% elseif self.addremove then %>
+ <% if self.template_addremove then include(self.template_addremove) else -%>
+ <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.section%>">
+ <% if self.title and #self.title > 0 then -%>
+ <legend><%=self.title%></legend>
+ <%- end %>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <input type="submit" class="cbi-button-add" name="cbi.cns.<%=self.config%>.<%=self.section%>" value="<%:Add%>" />
+ </fieldset>
+ <%- end %>
+<% end %>
+<!-- /nsection -->
diff --git a/libs/web/luasrc/view/cbi/nullsection.htm b/libs/web/luasrc/view/cbi/nullsection.htm
new file mode 100644
index 000000000..f1c715b40
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/nullsection.htm
@@ -0,0 +1,32 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+ <fieldset class="cbi-section">
+ <% if self.title and #self.title > 0 then -%>
+ <legend><%=self.title%></legend>
+ <%- end %>
+ <div class="cbi-section-node" id="cbi-<%=self.config%>-<%=tostring(self):sub(8)%>">
+ <% self:render_children(1, scope or {}) %>
+ </div>
+ <br />
+ </fieldset>
+ <%-
+ 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
+ %>
diff --git a/libs/web/luasrc/view/cbi/simpleform.htm b/libs/web/luasrc/view/cbi/simpleform.htm
new file mode 100644
index 000000000..9c40f8290
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/simpleform.htm
@@ -0,0 +1,66 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<% if not self.embedded then %>
+<form method="post" action="<%=REQUEST_URI%>">
+ <div>
+ <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+ <input type="hidden" name="cbi.submit" value="1" />
+ </div>
+<% end %>
+ <div class="cbi-map" id="cbi-<%=self.config%>">
+ <% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
+ <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
+ <% self:render_children() %>
+ <br />
+ </div>
+<%- if self.message then %>
+ <div><%=self.message%></div>
+<%- end %>
+<%- if self.errmessage then %>
+ <div class="error"><%=self.errmessage%></div>
+<%- end %>
+<% if not self.embedded then %>
+ <div>
+<%-
+ 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.flow and self.flow.skip then %>
+ <input class="cbi-button cbi-button-skip" type="submit" name="cbi.skip" value="<%:Skip%>" />
+<% end %>
+<%- if self.submit ~= false then %>
+ <input class="cbi-button-save" type="submit" value="
+ <%- if not self.submit then -%><%-:Submit-%><%-else-%><%=self.submit%><%end-%>
+ " />
+<% end %>
+<%- if self.reset ~= false then %>
+ <input class="cbi-button-reset" type="reset" value="
+ <%- if not self.reset then -%><%-:Reset-%><%-else-%><%=self.reset%><%end-%>
+ " />
+<% end %>
+<%- if self.cancel ~= false and self.on_cancel then %>
+ <input class="cbi-button-reset" type="submit" name="cbi.cancel" value="
+ <%- if not self.cancel then -%><%-:Cancel-%><%-else-%><%=self.cancel%><%end-%>
+ " />
+<% end %>
+ <script type="text/javascript">cbi_d_update();</script>
+ </div>
+</form>
+<% end %>
diff --git a/libs/web/luasrc/view/cbi/tabcontainer.htm b/libs/web/luasrc/view/cbi/tabcontainer.htm
new file mode 100644
index 000000000..9b2c7980a
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/tabcontainer.htm
@@ -0,0 +1,21 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<% for tab, data in pairs(self.tabs) do %>
+ <div id="container.<%=self.config%>.<%=section%>.<%=tab%>"<% if tab ~= self.selected_tab then %> style="display:none"<% end %>>
+ <% if data.description then %><div class="cbi-tab-descr"><%=data.description%></div><% end %>
+ <% self:render_tab(tab, section, scope or {}) %>
+ </div>
+ <script type="text/javascript">cbi_t_add('<%=self.config%>.<%=section%>', '<%=tab%>')</script>
+<% end %>
diff --git a/libs/web/luasrc/view/cbi/tabmenu.htm b/libs/web/luasrc/view/cbi/tabmenu.htm
new file mode 100644
index 000000000..7648fe011
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/tabmenu.htm
@@ -0,0 +1,27 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<%- if self.tabs then %>
+ <ul class="cbi-tabmenu">
+ <%- 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 %>
+ <script type="text/javascript">cbi_c['container.<%=self.config%>.<%=section%>.<%=tab%>'] = <%=#self.tabs[tab].childs%>;</script>
+ <%- if not self.selected_tab then self.selected_tab = tab end %>
+ <li id="tab.<%=self.config%>.<%=section%>.<%=tab%>" class="cbi-tab<%=(tab == self.selected_tab) and '' or '-disabled'%>">
+ <a onclick="this.blur(); return cbi_t_switch('<%=self.config%>.<%=section%>', '<%=tab%>')" href="<%=REQUEST_URI%>?tab.<%=self.config%>.<%=section%>=<%=tab%>"><%=self.tabs[tab].title%></a>
+ <% if tab == self.selected_tab then %><input type="hidden" id="tab.<%=self.config%>.<%=section%>" name="tab.<%=self.config%>.<%=section%>" value="<%=tab%>" /><% end %>
+ </li>
+ <% end end -%>
+ </ul>
+<% end -%>
diff --git a/libs/web/luasrc/view/cbi/tblsection.htm b/libs/web/luasrc/view/cbi/tblsection.htm
new file mode 100644
index 000000000..022461067
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/tblsection.htm
@@ -0,0 +1,135 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%-
+local rowcnt = 1
+function rowstyle()
+ rowcnt = rowcnt + 1
+ return (rowcnt % 2) + 1
+end
+-%>
+
+<!-- tblsection -->
+<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+ <% if self.title and #self.title > 0 then -%>
+ <legend><%=self.title%></legend>
+ <%- end %>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <div class="cbi-section-node">
+ <%- local count = 0 -%>
+ <table class="cbi-section-table">
+ <tr class="cbi-section-table-titles">
+ <%- if not self.anonymous then -%>
+ <%- if self.sectionhead then -%>
+ <th class="cbi-section-table-cell"><%=self.sectionhead%></th>
+ <%- else -%>
+ <th>&#160;</th>
+ <%- end -%>
+ <%- end -%>
+ <%- for i, k in pairs(self.children) do if not k.optional then -%>
+ <th class="cbi-section-table-cell">
+ <%- if k.titleref then -%><a title="<%=self.titledesc or translate('Go to relevant configuration page')%>" class="cbi-title-ref" href="<%=k.titleref%>"><%- end -%>
+ <%-=k.title-%>
+ <%- if k.titleref then -%></a><%- end -%>
+ </th>
+ <%- count = count + 1; end; end; if self.extedit or self.addremove then -%>
+ <th class="cbi-section-table-cell">&#160;</th>
+ <%- count = count + 1; end -%>
+ </tr>
+ <tr class="cbi-section-table-descr">
+ <%- if not self.anonymous then -%>
+ <%- if self.sectiondesc then -%>
+ <th class="cbi-section-table-cell"><%=self.sectiondesc%></th>
+ <%- else -%>
+ <th></th>
+ <%- end -%>
+ <%- end -%>
+ <%- for i, k in pairs(self.children) do if not k.optional then -%>
+ <th class="cbi-section-table-cell"><%=k.description%></th>
+ <%- end; end; if self.extedit or self.addremove then -%>
+ <th class="cbi-section-table-cell"></th>
+ <%- end -%>
+ </tr>
+ <%- local isempty = true
+ for i, k in ipairs(self:cfgsections()) do
+ section = k
+ isempty = false
+ scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
+ -%>
+ <tr class="cbi-section-table-row<% if self.extedit or self.rowcolors then %> cbi-rowstyle-<%=rowstyle()%><% end %>" id="cbi-<%=self.config%>-<%=section%>">
+ <% if not self.anonymous then -%>
+ <th><h3><%=(type(self.sectiontitle) == "function") and self:sectiontitle(section) or k%></h3></th>
+ <%- end %>
+
+
+ <%-
+ for k, node in ipairs(self.children) do
+ if not node.optional then
+ node:render(section, scope or {})
+ end
+ end
+ -%>
+
+ <%- if self.extedit or self.addremove then -%>
+ <td class="cbi-section-table-cell">
+ <%- if self.extedit then -%>
+ <a href="
+ <%- if type(self.extedit) == "string" then -%>
+ <%=self.extedit:format(section)%>
+ <%- elseif type(self.extedit) == "function" then -%>
+ <%=self:extedit(section)%>
+ <%- end -%>
+ " title="<%:Edit%>"><img style="border: none" src="<%=resource%>/cbi/edit.gif" alt="<%:Edit%>" /></a>
+ <%- end; if self.addremove then %>
+ <input type="image" value="<%:Delete%>" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:Delete%>" title="<%:Delete%>" src="<%=resource%>/cbi/remove.gif" />
+ <%- end -%>
+ </td>
+ <%- end -%>
+ </tr>
+ <%- end -%>
+
+ <%- if isempty then -%>
+ <tr class="cbi-section-table-row">
+ <td colspan="<%=count%>"><em><br /><%:This section contains no values yet%></em></td>
+ </tr>
+ <%- end -%>
+ </table>
+
+ <% if self.error then %>
+ <div class="cbi-section-error">
+ <ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%>
+ <li><%=pcdata(e):gsub("\n","<br />")%></li>
+ <%- end end %></ul>
+ </div>
+ <% end %>
+
+ <%- if self.addremove then -%>
+ <% if self.template_addremove then include(self.template_addremove) else -%>
+ <div class="cbi-section-create cbi-tblsection-create">
+ <% if self.anonymous then %>
+ <input class="cbi-button cbi-button-add" type="submit" value="<%:Add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" title="<%:Add%>" />
+ <% else %>
+ <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
+ <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <input class="cbi-button cbi-button-add" type="submit" value="<%:Add%>" title="<%:Add%>" />
+ <% if self.invalid_cts then -%>
+ <br /><%:Invalid%></div>
+ <%- end %>
+ <% end %>
+ </div>
+ <%- end %>
+ <%- end -%>
+ </div>
+</fieldset>
+<!-- /tblsection -->
diff --git a/libs/web/luasrc/view/cbi/tsection.htm b/libs/web/luasrc/view/cbi/tsection.htm
new file mode 100644
index 000000000..0fa285c16
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/tsection.htm
@@ -0,0 +1,62 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+ <% if self.title and #self.title > 0 then -%>
+ <legend><%=self.title%></legend>
+ <%- end %>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
+ <% if self.addremove then -%>
+ <div class="cbi-section-remove right">
+ <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:Delete%>" />
+ </div>
+ <%- end %>
+
+ <%- section = k; isempty = false -%>
+
+ <% if not self.anonymous then -%>
+ <h3><%=section:upper()%></h3>
+ <%- end %>
+
+ <%+cbi/tabmenu%>
+
+ <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
+ <%+cbi/ucisection%>
+ </fieldset>
+ <br />
+ <%- end %>
+
+ <% if isempty then -%>
+ <em><%:This section contains no values yet%><br /><br /></em>
+ <%- end %>
+
+ <% if self.addremove then -%>
+ <% if self.template_addremove then include(self.template_addremove) else -%>
+ <div class="cbi-section-create">
+ <% if self.anonymous then -%>
+ <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:Add%>" />
+ <%- else -%>
+ <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
+ <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <input type="submit" class="cbi-button cbi-button-add" value="<%:Add%>" />
+ <% if self.invalid_cts then -%>
+ <br /><%:Invalid%></div>
+ <%- end %>
+ <%- end %>
+ </div>
+ <%- end %>
+ <%- end %>
+</fieldset>
diff --git a/libs/web/luasrc/view/cbi/tvalue.htm b/libs/web/luasrc/view/cbi/tvalue.htm
new file mode 100644
index 000000000..b628c5c52
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/tvalue.htm
@@ -0,0 +1,19 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+ <textarea class="cbi-input-textarea" <% if not self.size then %> style="width: 100%"<% else %> cols="<%=self.size%>"<% end %> onchange="cbi_d_update(this.id)"<%= attr("name", cbid) .. attr("id", cbid) .. ifattr(self.rows, "rows") .. ifattr(self.wrap, "wrap") %>>
+ <%-=pcdata(self:cfgvalue(section))-%>
+ </textarea>
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/ucisection.htm b/libs/web/luasrc/view/cbi/ucisection.htm
new file mode 100644
index 000000000..db32c9043
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/ucisection.htm
@@ -0,0 +1,90 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<%-
+ 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 %>
diff --git a/libs/web/luasrc/view/cbi/upload.htm b/libs/web/luasrc/view/cbi/upload.htm
new file mode 100644
index 000000000..f5baa33fe
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/upload.htm
@@ -0,0 +1,29 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<%
+ 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)%>)
+ <input type="hidden"<%= attr("value", v) .. attr("name", cbid) .. attr("id", cbid) %> />
+ <input class="cbi-input-image" type="image" value="<%:Replace entry%>" name="cbi.rlf.<%=section .. "." .. self.option%>" alt="<%:Replace entry%>" title="<%:Replace entry%>" src="<%=resource%>/cbi/reload.gif" />
+ <% else %>
+ <input class="cbi-input-file" type="file"<%= attr("name", cbid) .. attr("id", cbid) %> />
+ <% end %>
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/value.htm b/libs/web/luasrc/view/cbi/value.htm
new file mode 100644
index 000000000..a7b49de7f
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/value.htm
@@ -0,0 +1,44 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%+cbi/valueheader%>
+ <input type="<%=self.password and 'password" class="cbi-input-password' or 'text" class="cbi-input-text' %>" onchange="cbi_d_update(this.id)"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section) or self.default) .. ifattr(self.size, "size")%> />
+ <% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
+ <% if #self.keylist > 0 or self.datatype then -%>
+ <script type="text/javascript">
+ <% if #self.keylist > 0 then -%>
+ cbi_combobox_init('<%=cbid%>', {
+ <%-
+ for i, k in ipairs(self.keylist) do
+ -%>
+ <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
+ <%-if i<#self.keylist then-%>,<%-end-%>
+ <%-
+ end
+ -%>
+ }, '<%- if not self.rmempty and not self.optional then -%>
+ <%-: -- Please choose -- -%>
+ <%- end -%>', '
+ <%- if self.combobox_manual then -%>
+ <%-=self.combobox_manual-%>
+ <%- else -%>
+ <%-: -- custom -- -%>
+ <%- end -%>');
+ <%- end %>
+ <% if self.datatype then -%>
+ cbi_validate_field('<%=cbid%>', <%=tostring(self.optional == true)%>, '<%=self.datatype%>');
+ <%- end %>
+ </script>
+ <% end -%>
+<%+cbi/valuefooter%>
diff --git a/libs/web/luasrc/view/cbi/valuefooter.htm b/libs/web/luasrc/view/cbi/valuefooter.htm
new file mode 100644
index 000000000..a65c7a387
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/valuefooter.htm
@@ -0,0 +1,16 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<% include( valuefooter or "cbi/full_valuefooter" ) %>
diff --git a/libs/web/luasrc/view/cbi/valueheader.htm b/libs/web/luasrc/view/cbi/valueheader.htm
new file mode 100644
index 000000000..f3da909e6
--- /dev/null
+++ b/libs/web/luasrc/view/cbi/valueheader.htm
@@ -0,0 +1,16 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+
+<% include( valueheader or "cbi/full_valueheader" ) %>