summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base')
-rw-r--r--modules/luci-base/Makefile15
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js129
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/xhr.js3
-rw-r--r--modules/luci-base/luasrc/tools/status.lua86
-rw-r--r--modules/luci-base/luasrc/view/cbi/apply_widget.htm2
-rw-r--r--modules/luci-base/luasrc/view/cbi/button.htm2
-rw-r--r--modules/luci-base/luasrc/view/cbi/cell_valueheader.htm10
-rw-r--r--modules/luci-base/luasrc/view/cbi/dropdown.htm12
-rw-r--r--modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm79
-rw-r--r--modules/luci-base/luasrc/view/cbi/footer.htm2
-rw-r--r--modules/luci-base/luasrc/view/cbi/full_valuefooter.htm1
-rw-r--r--modules/luci-base/luasrc/view/cbi/map.htm3
-rw-r--r--modules/luci-base/luasrc/view/cbi/nsection.htm9
-rw-r--r--modules/luci-base/luasrc/view/cbi/nullsection.htm5
-rw-r--r--modules/luci-base/luasrc/view/cbi/simpleform.htm15
-rw-r--r--modules/luci-base/luasrc/view/cbi/tblsection.htm208
-rw-r--r--modules/luci-base/luasrc/view/cbi/tsection.htm18
-rw-r--r--modules/luci-base/luasrc/view/cbi/upload.htm2
-rw-r--r--modules/luci-base/luasrc/view/sysauth.htm10
19 files changed, 394 insertions, 217 deletions
diff --git a/modules/luci-base/Makefile b/modules/luci-base/Makefile
index 7f7d7e772f..5c38d99c58 100644
--- a/modules/luci-base/Makefile
+++ b/modules/luci-base/Makefile
@@ -14,12 +14,13 @@ LUCI_BASENAME:=base
LUCI_TITLE:=LuCI core libraries
LUCI_DEPENDS:=+lua +luci-lib-nixio +luci-lib-ip +rpcd +libubus-lua +luci-lib-jsonc +liblucihttp-lua
-PKG_SOURCE:=LuaSrcDiet-0.12.1.tar.bz2
-PKG_SOURCE_URL:=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/luasrcdiet
-PKG_HASH:=ed7680f2896269ae8633756e7edcf09050812f78c8f49e280e63c30d14f35aea
-PKG_LICENSE:=Apache-2.0
-HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/LuaSrcDiet-0.12.1
+PKG_SOURCE:=v1.0.0.tar.gz
+PKG_SOURCE_URL:=https://github.com/jirutka/luasrcdiet/archive/
+PKG_HASH:=48162e63e77d009f5848f18a5cabffbdfc867d0e5e73c6d407f6af5d6880151b
+PKG_LICENSE:=MIT
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/luasrcdiet-1.0.0
include $(INCLUDE_DIR)/host-build.mk
@@ -36,13 +37,13 @@ endef
define Host/Compile
$(MAKE) -C src/ clean po2lmo
- $(MAKE) -C $(HOST_BUILD_DIR) bin/LuaSrcDiet.lua
+ $(MAKE) -C $(HOST_BUILD_DIR) bin/luasrcdiet
endef
define Host/Install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) src/po2lmo $(1)/bin/po2lmo
- $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/LuaSrcDiet.lua $(1)/bin/LuaSrcDiet
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/luasrcdiet $(1)/bin/luasrcdiet
endef
$(eval $(call HostBuild))
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index a7f999d876..6a487366f8 100644
--- a/modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js
@@ -620,7 +620,11 @@ function cbi_init() {
}
document.querySelectorAll('.cbi-dropdown').forEach(function(s) {
- cbi_dropdown_init(s);
+ cbi_dropdown_init(s);
+ });
+
+ document.querySelectorAll('.cbi-tooltip:not(:empty)').forEach(function(s) {
+ s.parentNode.classList.add('cbi-tooltip-container');
});
cbi_d_update();
@@ -1232,14 +1236,13 @@ function cbi_validate_field(cbid, optional, type)
function cbi_row_swap(elem, up, store)
{
- var tr = elem.parentNode;
-
- while (tr && !tr.classList.contains('cbi-section-table-row'))
- tr = tr.parentNode;
+ var tr = findParent(elem.parentNode, '.cbi-section-table-row');
if (!tr)
return false;
+ tr.classList.remove('flash');
+
if (up) {
var prev = tr.previousElementSibling;
@@ -1277,6 +1280,9 @@ function cbi_row_swap(elem, up, store)
if (input)
input.value = ids.join(' ');
+ window.scrollTo(0, tr.offsetTop);
+ window.setTimeout(function() { tr.classList.add('flash'); }, 1);
+
return false;
}
@@ -1522,6 +1528,19 @@ function toElem(s)
return elem || null;
}
+function findParent(node, selector)
+{
+ while (node)
+ if (node.msMatchesSelector && node.msMatchesSelector(selector))
+ return node;
+ else if (node.matches && node.matches(selector))
+ return node;
+ else
+ node = node.parentNode;
+
+ return null;
+}
+
function E()
{
var html = arguments[0],
@@ -1541,7 +1560,7 @@ function E()
if (attr)
for (var key in attr)
- if (attr.hasOwnProperty(key))
+ if (attr.hasOwnProperty(key) && attr[key] !== null && attr[key] !== undefined)
elem.setAttribute(key, attr[key]);
if (typeof(data) === 'function')
@@ -1818,18 +1837,6 @@ CBIDropdown = {
document.querySelectorAll('.cbi-dropdown[open]').forEach(function(s) {
s.dispatchEvent(new CustomEvent('cbi-dropdown-close', {}));
});
- },
-
- findParent: function(node, selector) {
- while (node)
- if (node.msMatchesSelector && node.msMatchesSelector(selector))
- return node;
- else if (node.matches && node.matches(selector))
- return node;
- else
- node = node.parentNode;
-
- return null;
}
};
@@ -1908,7 +1915,7 @@ function cbi_dropdown_init(sb) {
sbox.openDropdown(this);
}
else {
- var li = sbox.findParent(ev.target, 'li');
+ var li = findParent(ev.target, 'li');
if (li && li.parentNode.classList.contains('dropdown'))
sbox.toggleItem(this, li);
}
@@ -1933,7 +1940,7 @@ function cbi_dropdown_init(sb) {
}
else
{
- var active = sbox.findParent(document.activeElement, 'li');
+ var active = findParent(document.activeElement, 'li');
switch (ev.keyCode) {
case 27:
@@ -1986,7 +1993,7 @@ function cbi_dropdown_init(sb) {
if (!this.hasAttribute('open'))
return;
- var li = sbox.findParent(ev.target, 'li');
+ var li = findParent(ev.target, 'li');
if (li) {
if (li.parentNode.classList.contains('dropdown'))
sbox.setFocus(this, li);
@@ -2023,18 +2030,18 @@ function cbi_dropdown_init(sb) {
});
create.addEventListener('focus', function(ev) {
- var cbox = sbox.findParent(this, 'li').querySelector('input[type="checkbox"]');
+ var cbox = findParent(this, 'li').querySelector('input[type="checkbox"]');
if (cbox) cbox.checked = true;
sb.setAttribute('locked-in', '');
});
create.addEventListener('blur', function(ev) {
- var cbox = sbox.findParent(this, 'li').querySelector('input[type="checkbox"]');
+ var cbox = findParent(this, 'li').querySelector('input[type="checkbox"]');
if (cbox) cbox.checked = false;
sb.removeAttribute('locked-in');
});
- var li = sbox.findParent(create, 'li');
+ var li = findParent(create, 'li');
li.setAttribute('unselectable', '');
li.addEventListener('click', function(ev) {
@@ -2044,3 +2051,77 @@ function cbi_dropdown_init(sb) {
}
cbi_dropdown_init.prototype = CBIDropdown;
+
+function cbi_update_table(table, data, placeholder) {
+ target = isElem(table) ? table : document.querySelector(table);
+
+ if (!isElem(target))
+ return;
+
+ target.querySelectorAll('.tr.table-titles, .cbi-section-table-titles').forEach(function(thead) {
+ var titles = [];
+
+ thead.querySelectorAll('.th').forEach(function(th) {
+ titles.push(th);
+ });
+
+ if (Array.isArray(data)) {
+ var n = 0, rows = target.querySelectorAll('.tr');
+
+ data.forEach(function(row) {
+ var trow = E('div', { 'class': 'tr' });
+
+ for (var i = 0; i < titles.length; i++) {
+ var text = titles[i].innerText;
+ var td = trow.appendChild(E('div', {
+ 'class': titles[i].className,
+ 'data-title': text ? text.trim() : null
+ }, row[i] || ''));
+
+ td.classList.remove('th');
+ td.classList.add('td');
+ }
+
+ trow.classList.add('cbi-rowstyle-%d'.format((n++ % 2) ? 2 : 1));
+
+ if (rows[n])
+ target.replaceChild(trow, rows[n]);
+ else
+ target.appendChild(trow);
+ });
+
+ while (rows[++n])
+ target.removeChild(rows[n]);
+
+ if (placeholder && target.firstElementChild === target.lastElementChild) {
+ var trow = target.appendChild(E('div', { 'class': 'tr placeholder' }));
+ var td = trow.appendChild(E('div', { 'class': titles[0].className }, placeholder));
+
+ td.classList.remove('th');
+ td.classList.add('td');
+ }
+ }
+ else {
+ thead.parentNode.style.display = 'none';
+
+ thead.parentNode.querySelectorAll('.tr, .cbi-section-table-row').forEach(function(trow) {
+ if (trow !== thead) {
+ var n = 0;
+ trow.querySelectorAll('.th, .td').forEach(function(td) {
+ if (n < titles.length) {
+ var text = (titles[n++].innerText || '').trim();
+ if (text !== '')
+ td.setAttribute('data-title', text);
+ }
+ });
+ }
+ });
+
+ thead.parentNode.style.display = '';
+ }
+ });
+}
+
+document.addEventListener('DOMContentLoaded', function() {
+ document.querySelectorAll('.table').forEach(cbi_update_table);
+});
diff --git a/modules/luci-base/htdocs/luci-static/resources/xhr.js b/modules/luci-base/htdocs/luci-static/resources/xhr.js
index de4476cdd3..f1537a4481 100644
--- a/modules/luci-base/htdocs/luci-static/resources/xhr.js
+++ b/modules/luci-base/htdocs/luci-static/resources/xhr.js
@@ -204,7 +204,6 @@ XHR.poll = function(interval, url, data, callback, post)
};
XHR._q.push(e);
- XHR.run();
return e;
}
@@ -260,3 +259,5 @@ XHR.running = function()
{
return !!(XHR._r && XHR._i);
}
+
+document.addEventListener('DOMContentLoaded', XHR.run);
diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua
index 06a9ad4154..635995310f 100644
--- a/modules/luci-base/luasrc/tools/status.lua
+++ b/modules/luci-base/luasrc/tools/status.lua
@@ -6,9 +6,25 @@ module("luci.tools.status", package.seeall)
local uci = require "luci.model.uci".cursor()
local ipc = require "luci.ip"
+local function duid_to_mac(duid)
+ local b1, b2, b3, b4, b5, b6
+
+ -- DUID-LLT / Ethernet
+ if type(duid) == "string" and #duid == 28 then
+ b1, b2, b3, b4, b5, b6 = duid:match("^00010001(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)%x%x%x%x%x%x%x%x$")
+
+ -- DUID-LL / Ethernet
+ elseif type(duid) == "string" and #duid == 20 then
+ b1, b2, b3, b4, b5, b6 = duid:match("^00030001(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)$")
+ end
+
+ return b1 and ipc.checkmac(table.concat({ b1, b2, b3, b4, b5, b6 }, ":"))
+end
+
local function dhcp_leases_common(family)
local rv = { }
local nfs = require "nixio.fs"
+ local sys = require "luci.sys"
local leasefile = "/tmp/dhcp.leases"
uci:foreach("dhcp", "dnsmasq",
@@ -87,6 +103,22 @@ local function dhcp_leases_common(family)
fd:close()
end
+ if family == 6 then
+ local _, lease
+ local hosts = sys.net.host_hints()
+ for _, lease in ipairs(rv) do
+ local mac = duid_to_mac(lease.duid)
+ local host = mac and hosts[mac]
+ if host then
+ if not lease.name then
+ lease.host_hint = host.name or host.ipv4 or host.ipv6
+ elseif host.name and lease.hostname ~= host.name then
+ lease.host_hint = host.name
+ end
+ end
+ end
+ end
+
return rv
end
@@ -113,6 +145,11 @@ function wifi_networks()
local net
for _, net in ipairs(dev:get_wifinets()) do
+ local a, an = nil, 0
+ for _, a in pairs(net:assoclist() or {}) do
+ an = an + 1
+ end
+
rd.networks[#rd.networks+1] = {
name = net:shortname(),
link = net:adminlink(),
@@ -128,10 +165,10 @@ function wifi_networks()
noise = net:noise(),
bitrate = net:bitrate(),
ifname = net:ifname(),
- assoclist = net:assoclist(),
country = net:country(),
txpower = net:txpower(),
txpoweroff = net:txpower_offset(),
+ num_assoc = an,
disabled = (dev:get("disabled") == "1" or
net:get("disabled") == "1")
}
@@ -165,7 +202,6 @@ function wifi_network(id)
noise = net:noise(),
bitrate = net:bitrate(),
ifname = net:ifname(),
- assoclist = net:assoclist(),
country = net:country(),
txpower = net:txpower(),
txpoweroff = net:txpower_offset(),
@@ -182,6 +218,52 @@ function wifi_network(id)
return { }
end
+function wifi_assoclist()
+ local sys = require "luci.sys"
+ local ntm = require "luci.model.network".init()
+ local hosts = sys.net.host_hints()
+
+ local assoc = {}
+ local _, dev, net, bss
+
+ for _, dev in ipairs(ntm:get_wifidevs()) do
+ local radioname = dev:get_i18n()
+
+ for _, net in ipairs(dev:get_wifinets()) do
+ local netname = net:shortname()
+ local netlink = net:adminlink()
+ local ifname = net:ifname()
+
+ for _, bss in pairs(net:assoclist() or {}) do
+ local host = hosts[_]
+
+ bss.bssid = _
+ bss.ifname = ifname
+ bss.radio = radioname
+ bss.name = netname
+ bss.link = netlink
+
+ bss.host_name = (host) and (host.name or host.ipv4 or host.ipv6)
+ bss.host_hint = (host and host.name and (host.ipv4 or host.ipv6)) and (host.ipv4 or host.ipv6)
+
+ assoc[#assoc+1] = bss
+ end
+ end
+ end
+
+ table.sort(assoc, function(a, b)
+ if a.radio ~= b.radio then
+ return a.radio < b.radio
+ elseif a.ifname ~= b.ifname then
+ return a.ifname < b.ifname
+ else
+ return a.bssid < b.bssid
+ end
+ end)
+
+ return assoc
+end
+
function switch_status(devs)
local dev
local switches = { }
diff --git a/modules/luci-base/luasrc/view/cbi/apply_widget.htm b/modules/luci-base/luasrc/view/cbi/apply_widget.htm
index 702512f495..e3090da656 100644
--- a/modules/luci-base/luasrc/view/cbi/apply_widget.htm
+++ b/modules/luci-base/luasrc/view/cbi/apply_widget.htm
@@ -47,7 +47,7 @@
}
</style>
-<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-18.138.59467-72fe5dd"></script>
+<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var xhr = new XHR(),
uci_apply_auth = { sid: '<%=luci.dispatcher.context.authsession%>', token: '<%=token%>' },
diff --git a/modules/luci-base/luasrc/view/cbi/button.htm b/modules/luci-base/luasrc/view/cbi/button.htm
index 30f8ddfda5..6ccba58f23 100644
--- a/modules/luci-base/luasrc/view/cbi/button.htm
+++ b/modules/luci-base/luasrc/view/cbi/button.htm
@@ -1,6 +1,6 @@
<%+cbi/valueheader%>
<% if self:cfgvalue(section) ~= false then %>
- <input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
+ <input class="cbi-button cbi-button-<%=self.inputstyle or "button" %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
<% else %>
-
<% end %>
diff --git a/modules/luci-base/luasrc/view/cbi/cell_valueheader.htm b/modules/luci-base/luasrc/view/cbi/cell_valueheader.htm
index a4b68cda72..dbb0e1120b 100644
--- a/modules/luci-base/luasrc/view/cbi/cell_valueheader.htm
+++ b/modules/luci-base/luasrc/view/cbi/cell_valueheader.htm
@@ -1,2 +1,10 @@
-<div class="td cbi-value-field<% if self.error and self.error[section] then %> cbi-value-error<% end %>">
+<%-
+ local title = luci.util.trim(striptags(self.title))
+ local ftype = self.template and self.template:gsub("^.+/", "")
+-%>
+<div class="td cbi-value-field<% if self.error and self.error[section] then %> cbi-value-error<% end %>"<%=
+ attr("data-name", self.option) ..
+ ifattr(ftype and #ftype > 0, "data-type", ftype) ..
+ ifattr(title and #title > 0, "data-title", title)
+%>>
<div id="cbi-<%=self.config.."-"..section.."-"..self.option%>" data-index="<%=self.index%>" data-depends="<%=pcdata(self:deplist2json(section))%>">
diff --git a/modules/luci-base/luasrc/view/cbi/dropdown.htm b/modules/luci-base/luasrc/view/cbi/dropdown.htm
index bdf7248375..cf8c03d22c 100644
--- a/modules/luci-base/luasrc/view/cbi/dropdown.htm
+++ b/modules/luci-base/luasrc/view/cbi/dropdown.htm
@@ -36,6 +36,18 @@
<%=pcdata(self.vallist[i])%>
</li>
<% end %>
+ <% if self.custom then %>
+ <li>
+ <input type="password" style="display:none" />
+ <input class="create-item-input" type="text"<%=
+ attr("placeholder", self.custom ~= true and
+ self.custom or
+ (self.multiple and
+ translate("Enter custom values") or
+ translate("Enter custom value")))
+ %> />
+ </li>
+ <% end %>
</ul>
</div>
diff --git a/modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm b/modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm
index 546fd8e85a..b38e4b13db 100644
--- a/modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm
+++ b/modules/luci-base/luasrc/view/cbi/firewall_zoneforwards.htm
@@ -14,46 +14,59 @@
local def = fwm:get_defaults()
local zone = fwm:get_zone(value)
local empty = true
+
+ local function render_zone(zone)
+-%>
+ <label class="zonebadge" style="background-color:<%=zone:get_color()%>">
+ <strong><%=zone:name()%></strong>
+ <div class="cbi-tooltip">
+ <%-
+ local zempty = true
+ for _, net in ipairs(zone:get_networks()) do
+ net = nwm:get_network(net)
+ if net then
+ zempty = false
+ -%>
+ <span class="ifacebadge<% if net:name() == self.network then %> ifacebadge-active<% end %>"><%=net:name()%>:&#160;
+ <%
+ local nempty = true
+ for _, iface in ipairs(net:is_bridge() and net:get_interfaces() or { net:get_interface() }) do
+ nempty = false
+ %>
+ <img<%=attr("title", iface:get_i18n())%> src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
+ <% end %>
+ <% if nempty then %><em><%:(empty)%></em><% end %>
+ </span>
+ <%- end end -%>
+ <% if zempty then %><span class="ifacebadge"><em><%:(empty)%></em></span><% end %>
+ </div>
+ </label>
+<%-
+ end
-%>
<% if zone then %>
-<div style="white-space:nowrap">
- <label class="zonebadge" style="background-color:<%=zone:get_color()%>">
- <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
- -%>
- <span class="ifacebadge<% if net:name() == self.network then %> ifacebadge-active<% end %>"><%=net:name()%>:
- <%
- local nempty = true
- for _, iface in ipairs(net:is_bridge() and net:get_interfaces() or { net:get_interface() }) 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><%:(empty)%></em><% end %>
- </span>
- <%- end end -%>
- <%- if zempty then %><em><%:(empty)%></em><% end -%>
- </label>
- &#160;&#8658;&#160;
- <% for _, fwd in ipairs(zone:get_forwardings_by("src")) do
- fz = fwd:dest_zone()
- if fz then
- empty = false %>
- <label class="zonebadge" style="background-color:<%=fz:get_color()%>">
- <strong><%=fz:name()%></strong>
- </label>&#160;
- <% end end %>
- <% if empty then %>
+<div class="zone-forwards">
+ <div class="zone-src">
+ <%=render_zone(zone)%>
+ </div>
+ <span>&#8658;</span>
+ <div class="zone-dest">
+ <%
+ for _, fwd in ipairs(zone:get_forwardings_by("src")) do
+ fz = fwd:dest_zone()
+ if fz then
+ empty = false
+ render_zone(fz)
+ end
+ end
+ if empty then
+ %>
<label class="zonebadge zonebadge-empty">
<strong><%=zone:forward():upper()%></strong>
</label>
<% end %>
+ </div>
</div>
<% end %>
diff --git a/modules/luci-base/luasrc/view/cbi/footer.htm b/modules/luci-base/luasrc/view/cbi/footer.htm
index e6acfb0697..5f939b6469 100644
--- a/modules/luci-base/luasrc/view/cbi/footer.htm
+++ b/modules/luci-base/luasrc/view/cbi/footer.htm
@@ -1,9 +1,7 @@
<%- if pageaction then -%>
<div class="cbi-page-actions">
<% if redirect and not flow.hidebackbtn then %>
- <div style="float:left">
<input class="cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" />
- </div>
<% end %>
<% if flow.skip then %>
diff --git a/modules/luci-base/luasrc/view/cbi/full_valuefooter.htm b/modules/luci-base/luasrc/view/cbi/full_valuefooter.htm
index f780936766..d4ad093efa 100644
--- a/modules/luci-base/luasrc/view/cbi/full_valuefooter.htm
+++ b/modules/luci-base/luasrc/view/cbi/full_valuefooter.htm
@@ -3,7 +3,6 @@
<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 %>
diff --git a/modules/luci-base/luasrc/view/cbi/map.htm b/modules/luci-base/luasrc/view/cbi/map.htm
index 02b47f5455..83c3cb2170 100644
--- a/modules/luci-base/luasrc/view/cbi/map.htm
+++ b/modules/luci-base/luasrc/view/cbi/map.htm
@@ -31,7 +31,6 @@
</li>
<% end %>
</ul>
- <br />
<% for i, section in ipairs(self.children) do %>
<div class="cbi-tabcontainer" id="container.m-<%=self.config%>.<%=section.section or section.sectiontype%>"<% if section.sectiontype ~= self.selected_tab then %> style="display:none"<% end %>>
<% section:render() %>
@@ -53,6 +52,4 @@
<% else %>
<%- self:render_children() %>
<% end %>
-
- <br />
</div>
diff --git a/modules/luci-base/luasrc/view/cbi/nsection.htm b/modules/luci-base/luasrc/view/cbi/nsection.htm
index abf67596f0..63abc57734 100644
--- a/modules/luci-base/luasrc/view/cbi/nsection.htm
+++ b/modules/luci-base/luasrc/view/cbi/nsection.htm
@@ -1,5 +1,5 @@
<% if self:cfgvalue(self.section) then section = self.section %>
- <fieldset class="cbi-section">
+ <div class="cbi-section">
<% if self.title and #self.title > 0 then -%>
<legend><%=self.title%></legend>
<%- end %>
@@ -15,17 +15,16 @@
<div class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>">
<%+cbi/ucisection%>
</div>
- <br />
- </fieldset>
+ </div>
<% elseif self.addremove then %>
<% if self.template_addremove then include(self.template_addremove) else -%>
- <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.section%>">
+ <div 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 cbi-button-add" name="cbi.cns.<%=self.config%>.<%=self.section%>" value="<%:Add%>" />
- </fieldset>
+ </div>
<%- end %>
<% end %>
<!-- /nsection -->
diff --git a/modules/luci-base/luasrc/view/cbi/nullsection.htm b/modules/luci-base/luasrc/view/cbi/nullsection.htm
index ef169593af..7230719d19 100644
--- a/modules/luci-base/luasrc/view/cbi/nullsection.htm
+++ b/modules/luci-base/luasrc/view/cbi/nullsection.htm
@@ -1,4 +1,4 @@
-<fieldset class="cbi-section">
+<div class="cbi-section">
<% if self.title and #self.title > 0 then -%>
<legend><%=self.title%></legend>
<%- end %>
@@ -25,8 +25,7 @@
</div>
<%- end %>
</div>
- <br />
-</fieldset>
+</div>
<%-
if type(self.hidden) == "table" then
for k, v in pairs(self.hidden) do
diff --git a/modules/luci-base/luasrc/view/cbi/simpleform.htm b/modules/luci-base/luasrc/view/cbi/simpleform.htm
index 3b758d70ee..c6000d22b3 100644
--- a/modules/luci-base/luasrc/view/cbi/simpleform.htm
+++ b/modules/luci-base/luasrc/view/cbi/simpleform.htm
@@ -10,7 +10,6 @@
<% if self.title and #self.title > 0 then %><h2 name="content"><%=self.title%></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>
@@ -30,9 +29,12 @@
end
%>
<% if redirect then %>
- <div style="float:left">
- <input class="cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" />
- </div>
+ <input class="cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" />
+<% end %>
+<%- if self.cancel ~= false and self.on_cancel then %>
+ <input class="cbi-button cbi-button-link" type="submit" name="cbi.cancel" value="
+ <%- if not self.cancel then -%><%-:Cancel-%><%-else-%><%=self.cancel%><%end-%>
+ " />
<% end %>
<%- if self.flow and self.flow.skip then %>
<input class="cbi-button cbi-button-skip" type="submit" name="cbi.skip" value="<%:Skip%>" />
@@ -47,11 +49,6 @@
<%- if not self.reset then -%><%-:Reset-%><%-else-%><%=self.reset%><%end-%>
" />
<% end %>
-<%- if self.cancel ~= false and self.on_cancel then %>
- <input class="cbi-button cbi-button-reset" type="submit" name="cbi.cancel" value="
- <%- if not self.cancel then -%><%-:Cancel-%><%-else-%><%=self.cancel%><%end-%>
- " />
-<% end %>
</div>
</form>
<% end %>
diff --git a/modules/luci-base/luasrc/view/cbi/tblsection.htm b/modules/luci-base/luasrc/view/cbi/tblsection.htm
index bb11cf1c06..ab13922040 100644
--- a/modules/luci-base/luasrc/view/cbi/tblsection.htm
+++ b/modules/luci-base/luasrc/view/cbi/tblsection.htm
@@ -14,10 +14,14 @@ function width(o)
end
return ''
end
+
+local anonclass = (not self.anonymous or self.sectiontitle) and "named" or "anonymous"
+local titlename = ifattr(not self.anonymous or self.sectiontitle, "data-title", translate("Name"))
+
-%>
<!-- tblsection -->
-<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+<div class="cbi-section cbi-tblsection" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
<% if self.title and #self.title > 0 then -%>
<legend><%=self.title%></legend>
<%- end %>
@@ -25,121 +29,107 @@ end
<input type="hidden" id="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" name="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" value="" />
<%- end -%>
<div class="cbi-section-descr"><%=self.description%></div>
- <div class="cbi-section-node">
- <%- local count = 0 -%>
- <div class="table cbi-section-table">
- <div class="tr cbi-section-table-titles">
- <%- if not self.anonymous then -%>
- <%- if self.sectionhead then -%>
- <div class="th cbi-section-table-cell"><%=self.sectionhead%></div>
- <%- else -%>
- <div class="th">&#160;</div>
- <%- end -%>
- <%- count = count +1; end -%>
- <%- for i, k in pairs(self.children) do if not k.optional then -%>
- <div class="th cbi-section-table-cell"<%=width(k)%>>
- <%- 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 -%>
- </div>
- <%- count = count + 1; end; end; if self.sortable then -%>
- <div class="th cbi-section-table-cell"><%:Sort%></div>
- <%- count = count + 1; end; if self.extedit or self.addremove then -%>
- <div class="th cbi-section-table-cell">&#160;</div>
- <%- count = count + 1; end -%>
- </div>
- <div class="tr cbi-section-table-descr">
- <%- if not self.anonymous then -%>
- <%- if self.sectiondesc then -%>
- <div class="th cbi-section-table-cell"><%=self.sectiondesc%></div>
- <%- else -%>
- <div class="th"></div>
- <%- end -%>
- <%- end -%>
- <%- for i, k in pairs(self.children) do if not k.optional then -%>
- <div class="th cbi-section-table-cell"<%=width(k)%>><%=k.description%></div>
- <%- end; end; if self.sortable then -%>
- <div class="th cbi-section-table-cell"></div>
- <%- end; if self.extedit or self.addremove then -%>
- <div class="th cbi-section-table-cell"></div>
- <%- end -%>
+ <%- local count = 0 -%>
+ <div class="table cbi-section-table">
+ <div class="tr cbi-section-table-titles <%=anonclass%>"<%=titlename%>>
+ <%- for i, k in pairs(self.children) do if not k.optional then -%>
+ <div class="th cbi-section-table-cell"<%=
+ width(k) ..
+ attr("data-type", k.template and k.template:gsub("^.+/", "") or "")
+ %>>
+ <%- 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 -%>
</div>
- <%- local isempty = true
- for i, k in ipairs(self:cfgsections()) do
- section = k
- isempty = false
- scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
- -%>
- <div class="tr 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 -%>
- <div class="th"><h3><%=(type(self.sectiontitle) == "function") and self:sectiontitle(section) or k%></h3></div>
- <%- end %>
-
+ <%- count = count + 1; end; end; if self.sortable or self.extedit or self.addremove then -%>
+ <div class="th cbi-section-table-cell cbi-section-actions"></div>
+ <%- count = count + 1; end -%>
+ </div>
+ <div class="tr cbi-section-table-descr <%=anonclass%>">
+ <%- for i, k in pairs(self.children) do if not k.optional then -%>
+ <div class="th cbi-section-table-cell"<%=
+ width(k) ..
+ attr("data-type", k.template and k.template:gsub("^.+/", "") or "")
+ %>><%=k.description%></div>
+ <%- end; end; if self.sortable or self.extedit or self.addremove then -%>
+ <div class="th cbi-section-table-cell cbi-section-actions"></div>
+ <%- end -%>
+ </div>
+ <%- local isempty, i, k = true, nil, nil
+ for i, k in ipairs(self:cfgsections()) do
+ isempty = false
- <%-
- for k, node in ipairs(self.children) do
- if not node.optional then
- node:render(section, scope or {})
- end
+ local section = k
+ local sectionname = striptags((type(self.sectiontitle) == "function") and self:sectiontitle(section) or k)
+ local sectiontitle = ifattr(sectionname and (not self.anonymous or self.sectiontitle), "data-title", sectionname)
+ local colorclass = (self.extedit or self.rowcolors) and " cbi-rowstyle-%d" % rowstyle() or ""
+ local scope = {
+ valueheader = "cbi/cell_valueheader",
+ valuefooter = "cbi/cell_valuefooter"
+ }
+ -%>
+ <div class="tr cbi-section-table-row<%=colorclass%>" id="cbi-<%=self.config%>-<%=section%>"<%=sectiontitle%>>
+ <%-
+ local node
+ for k, node in ipairs(self.children) do
+ if not node.optional then
+ node:render(section, scope or {})
end
- -%>
-
- <%- if self.sortable then -%>
- <div class="td cbi-section-table-cell">
- <input class="cbi-button cbi-button-up" type="button" value="" onclick="return cbi_row_swap(this, true, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" alt="<%:Move up%>" title="<%:Move up%>" />
- <input class="cbi-button cbi-button-down" type="button" value="" onclick="return cbi_row_swap(this, false, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" alt="<%:Move down%>" title="<%:Move down%>" />
- </div>
- <%- end -%>
-
- <%- if self.extedit or self.addremove then -%>
- <div class="td cbi-section-table-cell">
- <%- if self.extedit then -%>
- <input class="cbi-button cbi-button-edit" type="button" value="<%:Edit%>"
- <%- if type(self.extedit) == "string" 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 %>
- <input class="cbi-button cbi-button-remove" type="submit" value="<%:Delete%>" onclick="this.form.cbi_state='del-section'; return true" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:Delete%>" title="<%:Delete%>" />
- <%- end -%>
- </div>
- <%- end -%>
- </div>
- <%- end -%>
+ end
+ -%>
- <%- if isempty then -%>
- <div class="tr cbi-section-table-row">
- <div class="td" colspan="<%=count%>"><em><br /><%:This section contains no values yet%></em></div>
- </div>
+ <%- if self.sortable or self.extedit or self.addremove then -%>
+ <div class="td cbi-section-table-cell nowrap cbi-section-actions">
+ <%- if self.sortable then -%>
+ <input class="cbi-button cbi-button-up" type="button" value="<%:Up%>" onclick="return cbi_row_swap(this, true, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" title="<%:Move up%>" />
+ <input class="cbi-button cbi-button-down" type="button" value="<%:Down%>" onclick="return cbi_row_swap(this, false, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" title="<%:Move down%>" />
+ <% end; if self.extedit then -%>
+ <input class="cbi-button cbi-button-edit" type="button" value="<%:Edit%>"
+ <%- if type(self.extedit) == "string" 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 %>
+ <input class="cbi-button cbi-button-remove" type="submit" value="<%:Delete%>" onclick="this.form.cbi_state='del-section'; return true" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:Delete%>" title="<%:Delete%>" />
+ <%- end -%>
+ </div>
<%- end -%>
</div>
+ <%- end -%>
- <% 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%>.<%=section%>" title="<%:Add%>" />
- <% else %>
- <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
- <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" />
- <input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
- <% if self.invalid_cts then -%>
- <br /><%:Invalid%></div>
- <%- end %>
- <% end %>
- </div>
- <%- end %>
+ <%- if isempty then -%>
+ <div class="tr cbi-section-table-row placeholder">
+ <div class="td"><em><%:This section contains no values yet%></em></div>
+ </div>
<%- end -%>
</div>
-</fieldset>
+
+ <% 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%>.<%=section%>" title="<%:Add%>" />
+ <% else %>
+ <% if self.invalid_cts then -%>
+ <div class="cbi-section-error"><%:Invalid%></div>
+ <%- end %>
+ <div>
+ <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." data-type="uciname" data-optional="true" />
+ </div>
+ <input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
+ <% end %>
+ </div>
+ <%- end %>
+ <%- end -%>
+</div>
<!-- /tblsection -->
diff --git a/modules/luci-base/luasrc/view/cbi/tsection.htm b/modules/luci-base/luasrc/view/cbi/tsection.htm
index 726521ae3f..1a13df0c04 100644
--- a/modules/luci-base/luasrc/view/cbi/tsection.htm
+++ b/modules/luci-base/luasrc/view/cbi/tsection.htm
@@ -1,4 +1,4 @@
-<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
<% if self.title and #self.title > 0 then -%>
<legend><%=self.title%></legend>
<%- end %>
@@ -20,10 +20,9 @@
<%+cbi/tabmenu%>
- <fieldset class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>">
+ <div class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>">
<%+cbi/ucisection%>
- </fieldset>
- <br />
+ </div>
<%- end %>
<% if isempty then -%>
@@ -36,14 +35,15 @@
<% if self.anonymous then -%>
<input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
<%- else -%>
- <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
- <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" />
- <input type="submit" class="cbi-button cbi-button-add" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" />
<% if self.invalid_cts then -%>
- <br /><%:Invalid%></div>
+ <div class="cbi-section-error"><%:Invalid%></div>
<%- end %>
+ <div>
+ <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." data-type="uciname" data-optional="true" />
+ </div>
+ <input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
<%- end %>
</div>
<%- end %>
<%- end %>
-</fieldset>
+</div>
diff --git a/modules/luci-base/luasrc/view/cbi/upload.htm b/modules/luci-base/luasrc/view/cbi/upload.htm
index 4fb5201aac..3c3d82b653 100644
--- a/modules/luci-base/luasrc/view/cbi/upload.htm
+++ b/modules/luci-base/luasrc/view/cbi/upload.htm
@@ -8,7 +8,7 @@
<%:Uploaded File%> (<%=t.byte_format(s.size)%>)
<% if self.unsafeupload then %>
<input type="hidden"<%= attr("value", v) .. attr("name", cbid) .. attr("id", cbid) %> />
- <input class="cbi-button 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" />
+ <input class="cbi-button cbi-button-image" type="image" value="<%:Replace entry%>" name="cbi.rlf.<%=section .. "." .. self.option%>" alt="<%:Replace entry%>" title="<%:Replace entry%>" src="<%=resource%>/cbi/reload.gif" />
<% end %>
<% end %>
diff --git a/modules/luci-base/luasrc/view/sysauth.htm b/modules/luci-base/luasrc/view/sysauth.htm
index e7a741aaab..9b0e2de780 100644
--- a/modules/luci-base/luasrc/view/sysauth.htm
+++ b/modules/luci-base/luasrc/view/sysauth.htm
@@ -18,23 +18,23 @@
<div class="cbi-map-descr">
<%:Please enter your username and password.%>
</div>
- <fieldset class="cbi-section"><fieldset class="cbi-section-node">
+ <div class="cbi-section"><div class="cbi-section-node">
<div class="cbi-value">
<label class="cbi-value-title"><%:Username%></label>
<div class="cbi-value-field">
- <input class="cbi-input-user" type="text" name="luci_username" value="<%=duser%>" />
+ <input class="cbi-input-text" type="text" name="luci_username" value="<%=duser%>" />
</div>
</div>
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title"><%:Password%></label>
<div class="cbi-value-field">
- <input class="cbi-input-password" type="password" name="luci_password" />
+ <input class="cbi-input-text" type="password" name="luci_password" />
</div>
</div>
- </fieldset></fieldset>
+ </div></div>
</div>
- <div>
+ <div class="cbi-page-actions">
<input type="submit" value="<%:Login%>" class="cbi-button cbi-button-apply" />
<input type="reset" value="<%:Reset%>" class="cbi-button cbi-button-reset" />
</div>