2 LuCI - Lua Configuration Interface
3 Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
18 local fs = require "nixio.fs"
19 local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
20 local has_traceroute6 = fs.access("/usr/bin/traceroute6")
23 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
24 <script type="text/javascript">//<![CDATA[
25 var stxhr = new XHR();
27 function update_status(field,proto)
29 var tool = field.name;
30 var addr = field.value;
33 var legend = document.getElementById('diag-rc-legend');
34 var output = document.getElementById('diag-rc-output');
36 if (typeof proto != 'undefined') {
37 for(var i = 0; i < proto.length; i++) {
38 if(proto[i].checked) {
39 protocol = proto[i].value;
47 '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
48 '<%:Waiting for command to complete...%>'
51 legend.parentNode.style.display = 'block';
52 legend.style.display = 'inline';
54 stxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/diag_' + tool + protocol + '/' + addr, null,
59 legend.style.display = 'none';
60 output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
64 legend.style.display = 'none';
65 output.innerHTML = '<span class="error"><%:Bad address specified!%></span>';
73 <form method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
75 <h2><a id="content" name="content"><%:Diagnostics%></a></h2>
77 <fieldset class="cbi-section">
78 <legend><%:Network Utilities%></legend>
82 <div style="width:30%; float:left">
83 <input style="width: 50%" type="text" value="openwrt.org" name="ping" />
84 <input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping,this.form.proto)" />
85 <% if has_ping6 then %>
86 <div style="width:100%; margin-top: 10px;">
87 <input type="radio" name="proto" value="" checked="checked" /> <%:IPv4%>
88 <input type="radio" name="proto" value="6" /> <%:IPv6%>
93 <div style="width:33%; float:left">
94 <input style="width: 50%" type="text" value="openwrt.org" name="traceroute" />
95 <input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute,this.form.trproto)" />
96 <% if has_traceroute6 then %>
97 <div style="width:100%; margin-top: 10px;">
98 <input type="radio" name="trproto" value="" checked="checked" /> <%:IPv4%>
99 <input type="radio" name="trproto" value="6" /> <%:IPv6%>
104 <div style="width:33%; float:left;">
105 <input style="width: 50%" type="text" value="openwrt.org" name="nslookup" />
106 <input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
109 <br style="clear:both" /><br />
114 <fieldset class="cbi-section" style="display:none">
115 <legend id="diag-rc-legend"><%:Collecting data...%></legend>
116 <span id="diag-rc-output"></span>