mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Update luci and theme
This commit is contained in:
parent
fe03553aae
commit
4d7962337f
165 changed files with 74180 additions and 13802 deletions
137
luci-mod-network/luasrc/view/admin_network/diagnostics.htm
Normal file
137
luci-mod-network/luasrc/view/admin_network/diagnostics.htm
Normal file
|
@ -0,0 +1,137 @@
|
|||
<%#
|
||||
Copyright 2010 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
|
||||
local has_traceroute6 = fs.access("/bin/traceroute6") or fs.access("/usr/bin/traceroute6")
|
||||
local has_speedtest = fs.access("/usr/sbin/speedtestc")
|
||||
local has_curl = fs.access("/usr/bin/curl")
|
||||
local has_netstat = fs.access("/bin/netstat")
|
||||
|
||||
local dns_host = luci.config.diag and luci.config.diag.dns or "dev.openwrt.org"
|
||||
local ping_host = luci.config.diag and luci.config.diag.ping or "dev.openwrt.org"
|
||||
local route_host = luci.config.diag and luci.config.diag.route or "dev.openwrt.org"
|
||||
local getip_host = luci.config.diag and luci.config.diag.getip or "ifconfig.co"
|
||||
%>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var stxhr = new XHR();
|
||||
|
||||
function update_status(field, proto)
|
||||
{
|
||||
var tool = field.name;
|
||||
var addr = field.value;
|
||||
var protocol = proto ? "6" : "";
|
||||
|
||||
var legend = document.getElementById('diag-rc-legend');
|
||||
var output = document.getElementById('diag-rc-output');
|
||||
|
||||
if (legend && output)
|
||||
{
|
||||
output.innerHTML =
|
||||
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
|
||||
'<%:Waiting for command to complete...%>'
|
||||
;
|
||||
|
||||
legend.parentNode.style.display = 'block';
|
||||
legend.style.display = 'inline';
|
||||
|
||||
stxhr.post('<%=url('admin/network')%>/diag_' + tool + protocol + '/' + addr, { token: '<%=token%>' },
|
||||
function(x)
|
||||
{
|
||||
if (x.responseText)
|
||||
{
|
||||
legend.style.display = 'none';
|
||||
output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
|
||||
}
|
||||
else
|
||||
{
|
||||
legend.style.display = 'none';
|
||||
output.innerHTML = '<span class="error"><%:Bad address specified!%></span>';
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
//]]></script>
|
||||
|
||||
<form method="post" action="<%=url('admin/network/diagnostics')%>">
|
||||
<div class="cbi-map">
|
||||
<h2 name="content"><%:Diagnostics%></h2>
|
||||
|
||||
<div class="cbi-section">
|
||||
<legend><%:Network Utilities%></legend>
|
||||
|
||||
<div class="table">
|
||||
<div class="tr">
|
||||
<div class="td left">
|
||||
<input style="margin: 5px 0" type="text" value="<%=ping_host%>" name="ping" /><br />
|
||||
<% if has_ping6 then %>
|
||||
<select name="ping_proto" style="width:auto">
|
||||
<option value="" selected="selected"><%:IPv4%></option>
|
||||
<option value="6"><%:IPv6%></option>
|
||||
</select>
|
||||
<input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping, this.form.ping_proto.selectedIndex)" />
|
||||
<% else %>
|
||||
<input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping)" />
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="td left">
|
||||
<input style="margin: 5px 0" type="text" value="<%=route_host%>" name="traceroute" /><br />
|
||||
<% if has_traceroute6 then %>
|
||||
<select name="traceroute_proto" style="width:auto">
|
||||
<option value="" selected="selected"><%:IPv4%></option>
|
||||
<option value="6"><%:IPv6%></option>
|
||||
</select>
|
||||
<input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute, this.form.traceroute_proto.selectedIndex)" />
|
||||
<% else %>
|
||||
<input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute)" />
|
||||
<% end %>
|
||||
<% if not has_traceroute6 then %>
|
||||
<p> </p>
|
||||
<p><%:Install iputils-traceroute6 for IPv6 traceroute%></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="td left">
|
||||
<input style="margin: 5px 0" type="text" value="<%=dns_host%>" name="nslookup" /><br />
|
||||
<input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
|
||||
</div>
|
||||
<% if has_speedtest and false then %>
|
||||
<div class="td left">
|
||||
<input style="margin: 5px 0" type="text" value="" name="speedtest" placeholder="alternate server" /><br />
|
||||
<input type="button" value="<%:Speedtest%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.speedtest)" />
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if has_curl then %>
|
||||
<div class="td left">
|
||||
<input style="margin: 5px 0" type="hidden" value="<%=getip_host%>" name="getip" /><br />
|
||||
<input type="button" value="<%:Get public IP%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.getip)" />
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if has_netstat then %>
|
||||
<div class="td left">
|
||||
<input style="margin: 5px 0" type="hidden" value="" name="netstat" /><br />
|
||||
<input type="button" value="<%:Netstat%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.netstat)" />
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cbi-section" style="display:none">
|
||||
<strong id="diag-rc-legend"></strong>
|
||||
<span id="diag-rc-output"></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<%+footer%>
|
|
@ -0,0 +1,53 @@
|
|||
<div class="cbi-section-node">
|
||||
<div class="table">
|
||||
<%
|
||||
for i, net in ipairs(self.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")
|
||||
local disabled = (net[4]:get("auto") == "0")
|
||||
local dynamic = net[4]:is_dynamic()
|
||||
%>
|
||||
<div class="tr cbi-rowstyle-<%=i % 2 + 1%>">
|
||||
<div class="td col-3 center middle">
|
||||
<div class="ifacebox">
|
||||
<div class="ifacebox-head" style="background-color:<%=c%>" title="<%=pcdata(t)%>">
|
||||
<strong><%=net[1]:upper()%></strong>
|
||||
</div>
|
||||
<div class="ifacebox-body" id="<%=net[1]%>-ifc-devices" data-network="<%=net[1]%>">
|
||||
<img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
|
||||
<small>?</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="td col-5 left middle" id="<%=net[1]%>-ifc-description">
|
||||
<em><%:Collecting data...%></em>
|
||||
</div>
|
||||
<div class="td cbi-section-actions">
|
||||
<div>
|
||||
<input type="button" class="cbi-button cbi-button-neutral" onclick="iface_reconnect('<%=net[1]%>')" title="<%:Reconnect this interface%>" value="<%:Restart%>"<%=ifattr(disabled or dynamic, "disabled", "disabled")%> />
|
||||
|
||||
<% if disabled then %>
|
||||
<input type="hidden" name="cbid.network.<%=net[1]%>.__disable__" value="1" />
|
||||
<input type="submit" name="cbi.apply" class="cbi-button cbi-button-neutral" onclick="this.previousElementSibling.value='0'" title="<%:Reconnect this interface%>" value="<%:Connect%>"<%=ifattr(dynamic, "disabled", "disabled")%> />
|
||||
<% else %>
|
||||
<input type="hidden" name="cbid.network.<%=net[1]%>.__disable__" value="0" />
|
||||
<input type="submit" name="cbi.apply" class="cbi-button cbi-button-neutral" onclick="this.previousElementSibling.value='1'" title="<%:Shutdown this interface%>" value="<%:Stop%>"<%=ifattr(dynamic, "disabled", "disabled")%> />
|
||||
<% end %>
|
||||
|
||||
<input type="button" class="cbi-button cbi-button-action important" onclick="location.href='<%=url("admin/network/network", net[1])%>'" title="<%:Edit this interface%>" value="<%:Edit%>" id="<%=net[1]%>-ifc-edit"<%=ifattr(dynamic, "disabled", "disabled")%> />
|
||||
|
||||
<input type="hidden" name="cbid.network.<%=net[1]%>.__delete__" value="" />
|
||||
<input type="submit" name="cbi.apply" class="cbi-button cbi-button-negative" onclick="iface_delete(event)" value="<%:Delete%>"<%=ifattr(dynamic, "disabled", "disabled")%> />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cbi-section-create">
|
||||
<input type="button" class="cbi-button cbi-button-add" value="<%:Add new interface...%>" onclick="location.href='<%=url("admin/network/iface_add")%>'" />
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/view/network/network.js"></script>
|
12
luci-mod-network/luasrc/view/admin_network/iface_status.htm
Normal file
12
luci-mod-network/luasrc/view/admin_network/iface_status.htm
Normal file
|
@ -0,0 +1,12 @@
|
|||
<%+cbi/valueheader%>
|
||||
|
||||
<span class="ifacebadge large"<%=attr("data-iface-status", self.network)%>>
|
||||
<img src="<%=resource%>/icons/ethernet_disabled.png" />
|
||||
<span>
|
||||
<em class="spinning"><%:Collecting data...%></em>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/view/network/iface_status.js"></script>
|
||||
|
||||
<%+cbi/valuefooter%>
|
62
luci-mod-network/luasrc/view/admin_network/switch_status.htm
Normal file
62
luci-mod-network/luasrc/view/admin_network/switch_status.htm
Normal file
|
@ -0,0 +1,62 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
var switches = [ '<%=table.concat(self.switches, "', '")%>' ],
|
||||
tables = document.querySelectorAll('.cbi-section-table');
|
||||
|
||||
function add_status_row(table) {
|
||||
var first_row = table.querySelector('.cbi-section-table-row');
|
||||
if (first_row.classList.contains('port-status'))
|
||||
return first_row;
|
||||
|
||||
var status_row = first_row.parentNode.insertBefore(
|
||||
E('div', { 'class': first_row.className }), first_row);
|
||||
|
||||
first_row.querySelectorAll('.td').forEach(function(td) {
|
||||
status_row.appendChild(td.cloneNode(false));
|
||||
status_row.lastElementChild.removeAttribute('data-title');
|
||||
});
|
||||
|
||||
status_row.firstElementChild.innerHTML = '<%:Port status:%>';
|
||||
status_row.classList.add('port-status') ;
|
||||
|
||||
return status_row;
|
||||
}
|
||||
|
||||
XHR.poll(-1, '<%=url('admin/network/switch_status')%>/' + switches.join(','), null,
|
||||
function(x, st)
|
||||
{
|
||||
for (var i = 0; i < switches.length; i++)
|
||||
{
|
||||
var ports = st[switches[i]];
|
||||
var tr = add_status_row(tables[i]);
|
||||
|
||||
if (tr && ports && ports.length)
|
||||
{
|
||||
for (var j = 0; j < ports.length; j++)
|
||||
{
|
||||
var th = tr.querySelector('[data-name="%d"]'.format(j));
|
||||
|
||||
if (!th)
|
||||
continue;
|
||||
|
||||
if (ports[j].link)
|
||||
{
|
||||
th.innerHTML = String.format(
|
||||
'<small><img src="<%=resource%>/icons/port_up.png" />' +
|
||||
'<br />%d<%:baseT%><br />%s</small>',
|
||||
ports[j].speed, ports[j].duplex
|
||||
? '<%:full-duplex%>' : '<%:half-duplex%>'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
th.innerHTML = String.format(
|
||||
'<small><img src="<%=resource%>/icons/port_down.png" />' +
|
||||
'<br /><%:no link%></small>'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]></script>
|
59
luci-mod-network/luasrc/view/admin_network/wifi_join.htm
Normal file
59
luci-mod-network/luasrc/view/admin_network/wifi_join.htm
Normal file
|
@ -0,0 +1,59 @@
|
|||
<%#
|
||||
Copyright 2009-2015 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-%>
|
||||
|
||||
<%-
|
||||
|
||||
local sys = require "luci.sys"
|
||||
local utl = require "luci.util"
|
||||
|
||||
local dev = luci.http.formvalue("device")
|
||||
local iw = luci.sys.wifi.getiwinfo(dev)
|
||||
|
||||
if not iw then
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless"))
|
||||
return
|
||||
end
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<h2 name="content"><%:Join Network: Wireless Scan%></h2>
|
||||
|
||||
<div class="cbi-map">
|
||||
<div class="cbi-section">
|
||||
<div class="table"<%=attr("data-wifi-scan", dev) .. attr("data-wifi-type", iw.type)%>>
|
||||
<div class="tr table-titles">
|
||||
<div class="th col-2 middle center"><%:Signal%></div>
|
||||
<div class="th col-4 middle left"><%:SSID%></div>
|
||||
<div class="th col-2 middle center hide-xs"><%:Channel%></div>
|
||||
<div class="th col-2 middle left hide-xs"><%:Mode%></div>
|
||||
<div class="th col-3 middle left hide-xs"><%:BSSID%></div>
|
||||
<div class="th col-3 middle left"><%:Encryption%></div>
|
||||
<div class="th cbi-section-actions"> </div>
|
||||
</div>
|
||||
|
||||
<div class="tr placeholder">
|
||||
<div class="td">
|
||||
<img src="<%=resource%>/icons/loading.gif" class="middle" />
|
||||
<em><%:Collecting data...%></em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-page-actions right">
|
||||
<form class="inline" action="<%=url("admin/network/wireless")%>" method="get">
|
||||
<input class="cbi-button cbi-button-neutral" type="submit" value="<%:Back to overview%>" />
|
||||
</form>
|
||||
<form class="inline" action="<%=url('admin/network/wireless_join')%>" method="post">
|
||||
<input type="hidden" name="token" value="<%=token%>" />
|
||||
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>" />
|
||||
<input type="button" class="cbi-button cbi-button-action" value="<%:Repeat scan%>" onclick="flush()" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/view/network/wifi_join.js"></script>
|
||||
|
||||
<%+footer%>
|
61
luci-mod-network/luasrc/view/admin_network/wifi_overview.htm
Normal file
61
luci-mod-network/luasrc/view/admin_network/wifi_overview.htm
Normal file
|
@ -0,0 +1,61 @@
|
|||
<div class="cbi-section-node">
|
||||
<div class="table">
|
||||
<!-- physical device -->
|
||||
<div class="tr cbi-rowstyle-2">
|
||||
<div class="td col-2 center middle">
|
||||
<span class="ifacebadge"><img src="<%=resource%>/icons/wifi_disabled.png" id="<%=self.dev:name()%>-iw-upstate" /> <%=self.dev:name()%></span>
|
||||
</div>
|
||||
<div class="td col-7 left middle">
|
||||
<big><strong><%=self.hw%></strong></big><br />
|
||||
<span id="<%=self.dev:name()%>-iw-devinfo"></span>
|
||||
</div>
|
||||
<div class="td middle cbi-section-actions">
|
||||
<div>
|
||||
<input type="button" class="cbi-button cbi-button-neutral" title="<%:Restart radio interface%>" value="<%:Restart%>" data-radio="<%=self.dev:name()%>" onclick="wifi_restart(event)" />
|
||||
<input type="button" class="cbi-button cbi-button-action important" title="<%:Find and join network%>" value="<%:Scan%>" onclick="cbi_submit(this, 'device', '<%=self.dev:name()%>', '<%=url('admin/network/wireless_join')%>')" />
|
||||
<input type="button" class="cbi-button cbi-button-add" title="<%:Provide new network%>" value="<%:Add%>" onclick="cbi_submit(this, 'device', '<%=self.dev:name()%>', '<%=url('admin/network/wireless_add')%>')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /physical device -->
|
||||
|
||||
<!-- network list -->
|
||||
<% if #self.wnets > 0 then %>
|
||||
<% for i, net in ipairs(self.wnets) do local disabled = (self.dev:get("disabled") == "1" or net:get("disabled") == "1") %>
|
||||
<div class="tr cbi-rowstyle-<%=1 + ((i-1) % 2)%>">
|
||||
<div class="td col-2 center middle" id="<%=net:id()%>-iw-signal">
|
||||
<span class="ifacebadge" title="<%:Not associated%>"><img src="<%=resource%>/icons/signal-<%= disabled and "none" or "0" %>.png" /> 0%</span>
|
||||
</div>
|
||||
<div class="td col-7 left middle" id="<%=net:id()%>-iw-status" data-network="<%=net:id()%>" data-disabled="<%= disabled and "true" or "false" %>">
|
||||
<em><%= disabled and translate("Wireless is disabled") or translate("Collecting data...") %></em>
|
||||
</div>
|
||||
<div class="td middle cbi-section-actions">
|
||||
<div>
|
||||
<% if disabled then %>
|
||||
<input name="cbid.wireless.<%=net:name()%>.__disable__" type="hidden" value="1" />
|
||||
<input name="cbi.apply" type="submit" class="cbi-button cbi-button-neutral" title="<%:Enable this network%>" value="<%:Enable%>" onclick="this.previousElementSibling.value='0'" />
|
||||
<% else %>
|
||||
<input name="cbid.wireless.<%=net:name()%>.__disable__" type="hidden" value="0" />
|
||||
<input name="cbi.apply" type="submit" class="cbi-button cbi-button-neutral" title="<%:Disable this network%>" value="<%:Disable%>" onclick="this.previousElementSibling.value='1'" />
|
||||
<% end %>
|
||||
|
||||
<input type="button" class="cbi-button cbi-button-action important" onclick="location.href='<%=net:adminlink()%>'" title="<%:Edit this network%>" value="<%:Edit%>" />
|
||||
|
||||
<input name="cbid.wireless.<%=net:name()%>.__delete__" type="hidden" value="" />
|
||||
<input name="cbi.apply" type="submit" class="cbi-button cbi-button-negative" title="<%:Delete this network%>" value="<%:Remove%>" onclick="wifi_delete(event)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="tr placeholder">
|
||||
<div class="td">
|
||||
<em><%:No network configured on this device%></em>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- /network list -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/view/network/wireless.js"></script>
|
14
luci-mod-network/luasrc/view/admin_network/wifi_status.htm
Normal file
14
luci-mod-network/luasrc/view/admin_network/wifi_status.htm
Normal file
|
@ -0,0 +1,14 @@
|
|||
<%+cbi/valueheader%>
|
||||
|
||||
<span class="ifacebadge large"<%=attr("data-wifi-status", self.ifname)%>>
|
||||
<small>
|
||||
<img src="<%=resource%>/icons/signal-none.png" title="<%:Not associated%>" /> 
|
||||
</small>
|
||||
<span>
|
||||
<em class="spinning"><%:Collecting data...%></em>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/view/network/wifi_status.js"></script>
|
||||
|
||||
<%+cbi/valuefooter%>
|
Loading…
Add table
Add a link
Reference in a new issue