2 Copyright
2010 Jo-Philipp Wich
<jow@openwrt.org
>
3 Licensed to the public under the Apache License
2.0.
9 local fs = require
"nixio.fs"
10 local has_ping6 = fs.access(
"/bin/ping6") or fs.access(
"/usr/bin/ping6")
11 local has_traceroute6 = fs.access(
"/usr/bin/traceroute6")
14 <script type=
"text/javascript">//<![CDATA[
15 var stxhr = new XHR();
17 function update_status(field, proto)
19 var tool = field.name;
20 var addr = field.value;
21 var protocol = proto ?
"6" :
"";
23 var legend = document.getElementById('diag-rc-legend');
24 var output = document.getElementById('diag-rc-output');
29 '
<img src=
"<%=resource%>/icons/loading.gif" alt=
"<%:Loading%>" style=
"vertical-align:middle" /> ' +
30 '<%:Waiting for command to complete...%
>'
33 legend.parentNode.style.display = 'block';
34 legend.style.display = 'inline';
36 stxhr.get('<%=url('freifunk/status')%
>/diag_' + tool + protocol + '/' + addr, null,
41 legend.style.display = 'none';
42 output.innerHTML = String.format('
<pre>%h
</pre>', x.responseText);
46 legend.style.display = 'none';
47 output.innerHTML = '
<span class=
"error"><%:Bad address specified!%
></span>';
55 <form method=
"post" action=
"<%=pcdata(FULL_REQUEST_URI)%>">
57 <h2 name=
"content"><%:Diagnostics%
></h2>
59 <fieldset class=
"cbi-section">
60 <legend><%:Network Utilities%
></legend>
64 <div style=
"width:30%; float:left">
65 <input style=
"margin: 5px 0" type=
"text" value=
"dev.openwrt.org" name=
"ping" /><br />
66 <% if has_ping6 then %
>
67 <select name=
"ping_proto" style=
"width:auto">
68 <option value=
"" selected=
"selected"><%:IPv4%
></option>
69 <option value=
"6"><%:IPv6%
></option>
71 <input type=
"button" value=
"<%:Ping%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.ping, this.form.ping_proto.selectedIndex)" />
73 <input type=
"button" value=
"<%:Ping%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.ping)" />
77 <div style=
"width:33%; float:left">
78 <input style=
"margin: 5px 0" type=
"text" value=
"dev.openwrt.org" name=
"traceroute" /><br />
79 <% if has_traceroute6 then %
>
80 <select name=
"traceroute_proto" style=
"width:auto">
81 <option value=
"" selected=
"selected"><%:IPv4%
></option>
82 <option value=
"6"><%:IPv6%
></option>
84 <input type=
"button" value=
"<%:Traceroute%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.traceroute, this.form.traceroute_proto.selectedIndex)" />
86 <input type=
"button" value=
"<%:Traceroute%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.traceroute)" />
88 <% if not has_traceroute6 then %
>
90 <p><%:Install iputils-traceroute6 for IPv6 traceroute%
></p>
94 <div style=
"width:33%; float:left;">
95 <input style=
"margin: 5px 0" type=
"text" value=
"openwrt.org" name=
"nslookup" /><br />
96 <input type=
"button" value=
"<%:Nslookup%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.nslookup)" />
99 <br style=
"clear:both" /><br />
104 <fieldset class=
"cbi-section" style=
"display:none">
105 <legend id=
"diag-rc-legend"><%:Collecting data...%
></legend>
106 <span id=
"diag-rc-output"></span>