1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update theme

This commit is contained in:
Ycarus 2018-05-31 15:44:12 +02:00
parent 33bfcb84f9
commit 61d58cab65
18 changed files with 973 additions and 1207 deletions

View file

@ -164,7 +164,7 @@
ifc.ip6addrs[i]
);
}
if (ifc.ip6prefix)
{
html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix);
@ -212,20 +212,20 @@
<fieldset class="cbi-section">
<legend><%:Interface Overview%></legend>
<table class="cbi-section-table" style="margin:10px; empty-cells:hide">
<tr class="cbi-section-table-titles">
<th class="cbi-section-table-cell"><%:Network%></th>
<th class="cbi-section-table-cell" style="text-align:left"><%:Status%></th>
<th class="cbi-section-table-cell"><%:Actions%></th>
</tr>
<div class="table cbi-section-table" style="margin:10px; empty-cells:hide">
<div class="tr cbi-section-table-titles">
<div class="th"><%:Network%></div>
<div class="th left"><%:Status%></div>
<div class="th"><%:Actions%></div>
</div>
<%
for i, net in ipairs(netlist) do
local z = net[3]
local c = z and z:get_color() or "#EEEEEE"
local t = z and translate("Part of zone %q" % z:name()) or translate("No zone assigned")
%>
<tr class="cbi-section-table-row cbi-rowstyle-<%=i % 2 + 1%>">
<td class="cbi-value-field" style="padding:3px">
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i % 2 + 1%>">
<div class="td">
<div class="ifacebox">
<div class="ifacebox-head" style="background-color:<%=c%>" title="<%=pcdata(t)%>">
<strong><%=net[1]:upper()%></strong>
@ -235,19 +235,19 @@
<small>?</small>
</div>
</div>
</td>
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=net[1]%>-ifc-description">
</div>
<div class="td left" id="<%=net[1]%>-ifc-description">
<em><%:Collecting data...%></em>
</td>
<td style="width:420px">
</div>
<div class="td">
<input type="button" class="cbi-button cbi-button-reload" style="width:100px" onclick="iface_shutdown('<%=net[1]%>', true)" title="<%:Reconnect this interface%>" value="<%:Connect%>" />
<input type="button" class="cbi-button cbi-button-reset" style="width:100px" onclick="iface_shutdown('<%=net[1]%>', false)" title="<%:Shutdown this interface%>" value="<%:Stop%>" />
<input type="button" class="cbi-button cbi-button-edit" style="width:100px" onclick="location.href='<%=url("admin/network/network", net[1])%>'" title="<%:Edit this interface%>" value="<%:Edit%>" id="<%=net[1]%>-ifc-edit" />
<input type="button" class="cbi-button cbi-button-remove" style="width:100px" onclick="iface_delete('<%=net[1]%>')" value="<%:Delete%>" />
</td>
</tr>
</div>
</div>
<% end %>
</table>
</div>
<input type="button" class="cbi-button cbi-button-add" value="<%:Add new interface...%>" onclick="location.href='<%=url("admin/network/iface_add")%>'" />
</fieldset>

View file

@ -71,17 +71,17 @@
);
//]]></script>
<table>
<tr class="cbi-section-table">
<td></td>
<td class="cbi-value-field" style="min-width:16px; padding:3px; text-align:center" id="<%=self.option%>-ifc-signal">
<div class="table">
<div class="tr cbi-section-table">
<div class="td"></div>
<div class="td cbi-value-field" style="min-width:16px; padding:3px; text-align:center" id="<%=self.option%>-ifc-signal">
<img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
<small>?</small>
</td>
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-ifc-description">
</div>
<div class="td cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-ifc-description">
<em><%:Collecting data...%></em>
</td>
</tr>
</table>
</div>
</div>
</div>
<%+cbi/valuefooter%>

View file

@ -20,10 +20,10 @@
if (st && st[0] && tb)
{
/* clear all rows */
while( tb.rows.length > 1 )
tb.deleteRow(1);
while (tb.firstElementChild !== tb.lastElementChild)
tb.removeChild(tb.lastElementChild);
for( var i = 0; i < st[0].length; i++ )
for (var i = 0; i < st[0].length; i++)
{
var timestr;
@ -34,24 +34,16 @@
else
timestr = String.format('%t', st[0][i].expires);
var tr = tb.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
tr.insertCell(-1).innerHTML = st[0][i].hostname ? st[0][i].hostname : '?';
tr.insertCell(-1).innerHTML = st[0][i].ipaddr;
tr.insertCell(-1).innerHTML = st[0][i].macaddr;
tr.insertCell(-1).innerHTML = timestr;
tb.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format((i % 2) + 1), [
E('<div class="td">', st[0][i].hostname || '?'),
E('<div class="td">', st[0][i].ipaddr),
E('<div class="td">', st[0][i].macaddr),
E('<div class="td">', timestr)
]));
}
if( tb.rows.length == 1 )
{
var tr = tb.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 4;
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
}
if (tb.firstElementChild === tb.lastElementChild)
tb.appendChild(E('<div class="tr cbi-section-table-row"><div class="td"><em><br /><%:There are no active leases.%></em></div></div>'));
}
var tb6 = document.getElementById('lease6_status_table');
@ -60,10 +52,10 @@
tb6.parentNode.style.display = 'block';
/* clear all rows */
while( tb6.rows.length > 1 )
tb6.deleteRow(1);
while (tb6.firstElementChild !== tb6.lastElementChild)
tb6.removeChild(tb6.lastElementChild);
for( var i = 0; i < st[1].length; i++ )
for (var i = 0; i < st[1].length; i++)
{
var timestr;
@ -74,35 +66,29 @@
else
timestr = String.format('%t', st[1][i].expires);
var tr = tb6.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
var host = hosts[duid2mac(st[1][i].duid)],
name = st[1][i].hostname,
hint = null;
var host = hosts[duid2mac(st[1][i].duid)];
if (!st[1][i].hostname)
tr.insertCell(-1).innerHTML =
(host && (host.name || host.ipv4 || host.ipv6))
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
: '?';
else
tr.insertCell(-1).innerHTML =
(host && host.name && st[1][i].hostname != host.name)
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(st[1][i].hostname, host.name)
: st[1][i].hostname;
if (!name) {
if (host)
hint = host.name || host.ipv4 || host.ipv6;
}
else {
if (host && host.name && st[1][i].hostname != host.name)
hint = host.name;
}
tr.insertCell(-1).innerHTML = st[1][i].ip6addr;
tr.insertCell(-1).innerHTML = st[1][i].duid;
tr.insertCell(-1).innerHTML = timestr;
tb6.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d" style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">'.format((i % 2) + 1), [
E('<div class="td">', hint ? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(name || '?', hint) : (name || '?')),
E('<div class="td">', st[1][i].ip6addr),
E('<div class="td">', st[1][i].duid),
E('<div class="td">', timestr)
]));
}
if( tb6.rows.length == 1 )
{
var tr = tb6.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 4;
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
}
if (tb6.firstElementChild === tb6.lastElementChild)
tb6.appendChild(E('<div class="tr cbi-section-table-row"><div class="td"><em><br /><%:There are no active leases.%></em></div></div>'));
}
}
);
@ -110,30 +96,30 @@
<fieldset class="cbi-section">
<legend><%:Active DHCP Leases%></legend>
<table class="cbi-section-table" id="lease_status_table">
<tr class="cbi-section-table-titles">
<th class="cbi-section-table-cell"><%:Hostname%></th>
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
</tr>
<tr class="cbi-section-table-row">
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
</tr>
</table>
<div class="table cbi-section-table" id="lease_status_table">
<div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Hostname%></div>
<div class="th cbi-section-table-cell"><%:IPv4-Address%></div>
<div class="th cbi-section-table-cell"><%:MAC-Address%></div>
<div class="th cbi-section-table-cell"><%:Leasetime remaining%></div>
</div>
<div class="tr cbi-section-table-row">
<div class="td" colspan="4"><em><br /><%:Collecting data...%></em></div>
</div>
</div>
</fieldset>
<fieldset class="cbi-section" style="display:none">
<legend><%:Active DHCPv6 Leases%></legend>
<table class="cbi-section-table" id="lease6_status_table">
<tr class="cbi-section-table-titles">
<th class="cbi-section-table-cell"><%:Host%></th>
<th class="cbi-section-table-cell"><%:IPv6-Address%></th>
<th class="cbi-section-table-cell"><%:DUID%></th>
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
</tr>
<tr class="cbi-section-table-row">
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
</tr>
</table>
<div class="table cbi-section-table" id="lease6_status_table">
<div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Host%></div>
<div class="th cbi-section-table-cell"><%:IPv6-Address%></div>
<div class="th cbi-section-table-cell"><%:DUID%></div>
<div class="th cbi-section-table-cell"><%:Leasetime remaining%></div>
</div>
<div class="tr cbi-section-table-row">
<div class="td" colspan="4"><em><br /><%:Collecting data...%></em></div>
</div>
</div>
</fieldset>

View file

@ -91,24 +91,24 @@
<div class="cbi-map">
<fieldset class="cbi-section">
<table class="cbi-section-table" style="empty-cells:hide">
<div class="table cbi-section-table" style="empty-cells:hide">
<!-- scan list -->
<% for i, net in ipairs(scanlist(3)) do net.encryption = net.encryption or { } %>
<tr class="cbi-section-table-row cbi-rowstyle-<%=1 + ((i-1) % 2)%>">
<td class="cbi-value-field" style="width:16px; padding:3px">
<div class="tr cbi-section-table-row cbi-rowstyle-<%=1 + ((i-1) % 2)%>">
<div class="td cbi-value-field" style="width:16px; padding:3px">
<abbr title="<%:Signal%>: <%=net.signal%> <%:dB%> / <%:Quality%>: <%=net.quality%>/<%=net.quality_max%>">
<img src="<%=guess_wifi_signal(net)%>" /><br />
<small><%=percent_wifi_signal(net)%>%</small>
</abbr>
</td>
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px">
</div>
<div class="td cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px">
<big><strong><%=net.ssid and utl.pcdata(net.ssid) or "<em>%s</em>" % translate("hidden")%></strong></big><br />
<strong>Channel:</strong> <%=net.channel%> |
<strong>Mode:</strong> <%=net.mode%> |
<strong>BSSID:</strong> <%=net.bssid%> |
<strong>Encryption:</strong> <%=format_wifi_encryption(net.encryption)%>
</td>
<td class="cbi-value-field" style="width:40px">
</div>
<div class="td cbi-value-field" style="width:40px">
<form action="<%=url('admin/network/wireless_join')%>" method="post">
<input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>" />
@ -128,11 +128,11 @@
<input class="cbi-button cbi-button-apply" type="submit" value="<%:Join Network%>" />
</form>
</td>
</tr>
</div>
</div>
<% end %>
<!-- /scan list -->
</table>
</div>
</fieldset>
</div>
<div class="cbi-page-actions right">

View file

@ -195,8 +195,8 @@
{
var assoctable = document.getElementById('iw-assoclist');
if (assoctable)
while (assoctable.rows.length > 1)
assoctable.rows[1].parentNode.removeChild(assoctable.rows[1]);
while (assoctable.firstElementChild !== assoctable.lastElementChild)
assoctable.removeChild(assoctable.lastElementChild);
var devup = { };
var rowstyle = 1;
@ -293,7 +293,7 @@
if (assoctable)
{
var assoclist = [ ];
for( var bssid in iw.assoclist )
for (var bssid in iw.assoclist)
{
assoclist.push(iw.assoclist[bssid]);
assoclist[assoclist.length-1].bssid = bssid;
@ -301,11 +301,8 @@
assoclist.sort(function(a, b) { a.bssid < b.bssid });
for( var j = 0; j < assoclist.length; j++ )
for (var j = 0; j < assoclist.length; j++)
{
var tr = assoctable.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + rowstyle;
var icon;
var q = (-1 * (assoclist[j].noise - assoclist[j].signal)) / 5;
if (q < 1)
@ -319,48 +316,35 @@
else
icon = "<%=resource%>/icons/signal-75-100.png";
tr.insertCell(-1).innerHTML = String.format(
'<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span>',
iw.device.name, iw.ifname
);
var host = hosts[assoclist[j].bssid],
name = host ? (host.name || host.ipv4 || host.ipv6) : null,
hint = (host && host.name && (host.ipv4 || host.ipv6)) ? (host.ipv4 || host.ipv6) : null;
tr.insertCell(-1).innerHTML = nowrap(String.format('%h', iw.ssid ? iw.ssid : '?'));
tr.insertCell(-1).innerHTML = assoclist[j].bssid;
var host = hosts[assoclist[j].bssid];
if (host)
tr.insertCell(-1).innerHTML = String.format(
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
((host.name && (host.ipv4 || host.ipv6))
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
);
else
tr.insertCell(-1).innerHTML = '?';
tr.insertCell(-1).innerHTML = String.format(
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>',
assoclist[j].signal, assoclist[j].noise, assoclist[j].signal - assoclist[j].noise,
icon,
assoclist[j].signal, assoclist[j].noise
);
tr.insertCell(-1).innerHTML = nowrap(wifirate(assoclist[j], true)) + '<br />' + nowrap(wifirate(assoclist[j], false));
assoctable.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format(rowstyle), [
E('<div class="td"><span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span></div>'
.format(iw.device.name, iw.ifname)),
E('<div class="td" style="white-space:nowrap">%h</div>'
.format(iw.ssid || '?')),
E('<div class="td">%h</div>'
.format(assoclist[j].bssid)),
E('<div class="td">', hint ? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%h (%h)</div>'
.format(name || '?', hint) : (name || '?')),
E('<div class="td"><span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span></div>'
.format(assoclist[j].signal, assoclist[j].noise, assoclist[j].signal - assoclist[j].noise, icon, assoclist[j].signal, assoclist[j].noise)),
E('<div class="td">', [
E('<span style="white-space:nowrap">', wifirate(assoclist[j], true)),
E('<br />'),
E('<span style="white-space:nowrap">', wifirate(assoclist[j], false))
])
]));
rowstyle = (rowstyle == 1) ? 2 : 1;
}
}
}
if (assoctable && assoctable.rows.length == 1)
{
var tr = assoctable.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 8;
td.innerHTML = '<br /><em><%:No information available%></em>';
}
if (assoctable && assoctable.firstElementChild === assoctable.lastElementChild)
assoctable.appendChild(E('<div class="tr cbi-section-table-row"><div class="td"><em><br /><%:No information available%></em></div></div>'));
for (var dev in devup)
{
@ -386,15 +370,17 @@
<% for _, dev in ipairs(devices) do local nets = dev:get_wifinets() %>
<!-- device <%=dev:name()%> -->
<fieldset class="cbi-section">
<table class="cbi-section-table" style="margin:10px; empty-cells:hide">
<div class="table cbi-section-table" style="margin:10px; empty-cells:hide">
<!-- physical device -->
<tr>
<td style="width:34px"><img src="<%=resource%>/icons/wifi_big_disabled.png" style="float:left; margin-right:10px" id="<%=dev:name()%>-iw-upstate" /></td>
<td colspan="2" style="text-align:left">
<div class="tr">
<div class="td">
<img src="<%=resource%>/icons/wifi_big_disabled.png" id="<%=dev:name()%>-iw-upstate" />
</div>
<div class="td left">
<big><strong><%=guess_wifi_hw(dev)%> (<%=dev:name()%>)</strong></big><br />
<span id="<%=dev:name()%>-iw-devinfo"></span>
</td>
<td style="width:310px;text-align:right">
</div>
<div class="td right">
<form action="<%=url('admin/network/wireless_join')%>" method="post" class="inline">
<input type="hidden" name="device" value="<%=dev:name()%>" />
<input type="hidden" name="token" value="<%=token%>" />
@ -405,38 +391,36 @@
<input type="hidden" name="token" value="<%=token%>" />
<input type="submit" class="cbi-button cbi-button-add" style="width:100px" title="<%:Provide new network%>" value="<%:Add%>" />
</form>
</td>
</tr>
</div>
</div>
<!-- /physical device -->
<!-- network list -->
<% if #nets > 0 then %>
<% for i, net in ipairs(nets) do %>
<tr class="cbi-section-table-row cbi-rowstyle-<%=1 + ((i-1) % 2)%>">
<td></td>
<td class="cbi-value-field" style="vertical-align:middle; padding:3px" id="<%=net:id()%>-iw-signal">
<div class="tr cbi-section-table-row cbi-rowstyle-<%=1 + ((i-1) % 2)%>">
<div class="td" id="<%=net:id()%>-iw-signal">
<span class="ifacebadge" title="<%:Not associated%>"><img src="<%=resource%>/icons/signal-none.png" /> 0%</span>
</td>
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=net:id()%>-iw-status">
</div>
<div class="td left" id="<%=net:id()%>-iw-status">
<em><%:Collecting data...%></em>
</td>
<td class="cbi-value-field" style="width:310px;text-align:right">
</div>
<div class="td right">
<input id="<%=net:id()%>-iw-toggle" type="button" class="cbi-button cbi-button-reload" style="width:100px" onclick="wifi_shutdown('<%=net:id()%>', this)" title="<%:Delete this network%>" value="<%:Enable%>" />
<input type="button" class="cbi-button cbi-button-edit" style="width:100px" onclick="location.href='<%=net:adminlink()%>'" title="<%:Edit this network%>" value="<%:Edit%>" />
<input type="button" class="cbi-button cbi-button-remove" style="width:100px" onclick="wifi_delete('<%=net:id()%>')" title="<%:Delete this network%>" value="<%:Remove%>" />
</td>
</tr>
</div>
</div>
<% end %>
<% else %>
<tr class="cbi-section-table-row cbi-rowstyle-2">
<td></td>
<td colspan="3" class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px">
<div class="tr cbi-section-table-row cbi-rowstyle-2">
<div class="td left">
<em><%:No network configured on this device%></em>
</td>
</tr>
</div>
</div>
<% end %>
<!-- /network list -->
</table>
</div>
</fieldset>
<!-- /device <%=dev:name()%> -->
<% end %>
@ -445,21 +429,21 @@
<h2><%:Associated Stations%></h2>
<fieldset class="cbi-section">
<table class="cbi-section-table valign-middle" style="margin:10px" id="iw-assoclist">
<tr class="cbi-section-table-titles">
<th class="cbi-section-table-cell"></th>
<th class="cbi-section-table-cell"><%:SSID%></th>
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
<th class="cbi-section-table-cell"><%:Host%></th>
<th class="cbi-section-table-cell"><%:Signal%> / <%:Noise%></th>
<th class="cbi-section-table-cell"><%:RX Rate%> / <%:TX Rate%></th>
</tr>
<tr class="cbi-section-table-row cbi-rowstyle-2">
<td class="cbi-value-field" colspan="6">
<div class="table cbi-section-table valign-middle" style="margin:10px" id="iw-assoclist">
<div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"></div>
<div class="th cbi-section-table-cell"><%:SSID%></div>
<div class="th cbi-section-table-cell"><%:MAC-Address%></div>
<div class="th cbi-section-table-cell"><%:Host%></div>
<div class="th cbi-section-table-cell"><%:Signal%> / <%:Noise%></div>
<div class="th cbi-section-table-cell"><%:RX Rate%> / <%:TX Rate%></div>
</div>
<div class="tr cbi-section-table-row cbi-rowstyle-2">
<div class="td">
<em><%:Collecting data...%></em>
</td>
</tr>
</table>
</div>
</div>
</div>
</fieldset>
</div>

View file

@ -62,17 +62,17 @@
);
//]]></script>
<table>
<tr class="cbi-section-table">
<td></td>
<td class="cbi-value-field" style="width:16px; padding:3px" id="<%=self.option%>-iw-signal">
<div class="table">
<div class="tr cbi-section-table">
<div class="td"></div>
<div class="td cbi-value-field" style="width:16px; padding:3px" id="<%=self.option%>-iw-signal">
<img src="<%=resource%>/icons/signal-none.png" title="<%:Not associated%>" /><br />
<small>0%</small>
</td>
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-iw-description">
</div>
<div class="td cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-iw-description">
<em><%:Collecting data...%></em>
</td>
</tr>
</table>
</div>
</div>
</div>
<%+cbi/valuefooter%>