2023-11-09 19:03:28 +08:00

153 lines
3.8 KiB
HTML

<%+header%>
<%
local sys = require "luci.sys"
local utl = require "luci.util"
local fs = require "nixio.fs"
local uci = require "luci.model.uci".cursor()
local s = uci:get("custom", "bandlock", "enabled")
local a = uci:get("custom", "atcmd", "enabled")
local multilock = uci:get("custom", "multiuser", "multi") or "0"
local rootlock = uci:get("custom", "multiuser", "root") or "0"
nomulti=1
if (multilock == "0") or (multilock == "1" and rootlock == "1") then
nosms = 1
if a == "1" then
nosms = 0
end
else
nosms = 1
nomulti = 0
end
block = 1
if s == "1" then
block = 0
end
function showicon(lck)
end
-%>
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
<script type="text/javascript">//<![CDATA[
function sendcmd(event)
{
var v = document.getElementById("drop1").value;
var s = document.getElementById("atcmd").value;
var r =document.getElementById("attxt").value;
if ( s.length == 0 )
{
document.getElementById("attxt").value= '<%:请输入AT命令!%>\r' + r;
return false;
}
XHR.get('<%=luci.dispatcher.build_url("admin", "modem", "send_atcmd")%>',
{ set: s , p: v},
function(x, rv)
{
var pd = rv.result;
document.getElementById("attxt").value=pd + r;
}
);
}
function sendclean(event)
{
document.getElementById("attxt").value='';
}
//]]></script>
<div class="cbi-map" id="cbi-misc">
<h2><a id="content" name="content"><%:AT命令工具%></a></h2>
<div class="cbi-map-descr"><%:AT命令工具%></div>
<head>
<style>
input {
vertical-align: bottom;
}
#popup {
width:560px;
height:190px;
padding:20px;
background-color:gainsboro;
border-style : solid;
position:fixed;
top : 40%;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
text-align: center;
display:none;
}
textarea{
background:#373737;
border:none;
color:#FFF;
}
</style>
</head>
<fieldset class="cbi-section" id="cbi-term">
<legend><%:AT命令终端%></legend>
<div id="popup">
<table width="500" border="0">
<tr>
<td width="50px"><div><%:Enter Password to Unlock Full Terminal%></div></td>
</tr>
<tr>
<td width="200px"><input id="pass" type="password"/></td>
</tr>
<tr>
<td><input type="image" src="<%=showicon(0)%>" style="width:48px;height:48px;" onclick="return done()" /></td>
</tr>
</table>
</div>
<table width="700" border="0" id="droptxt">
<tr>
<td width="10%"><div align="right"><%:模块端口 : %></div></td>
<td width="15%">
<select style="width:200px" name="atdrop" id="drop1">
<option value="0">ttyUSB0</option>
<option value="1">ttyUSB1</option>
<option value="2" selected>ttyUSB2</option>
<option value="3">ttyUSB3</option>
<option value="4">ttyUSB4</option>
<option value="5">ttyUSB5</option>
<option value="6">ttyUSB6</option>
<option value="7">ttyUSB7</option>
<option value="8">ttyUSB8</option>
<option value="9">ttyUSB9</option>
<option value="10">ttyUSB10</option>
<option value="11">ttyUSB11</option>
<option value="12">ttyUSB12</option>
</select>
</td>
<td width="10%"><div align="right"><%:AT命令 : %></div></td>
<td width="15%"><input style="visibility:visible;width: 500px;maxlength="200" type="text" name="atcmdlck" id="atcmd" class="cbi-input-text"></input></td>
<td width="10%">
<input style="visibility:visible" type="submit" id="sendat" class="cbi-button cbi-button-apply" value="<%:发送%>" onclick="return sendcmd()" />
<input style="visibility:visible" type="submit" id="sendclean" class="cbi-button cbi-button-reset" value="<%:清除%>" onclick="return sendclean()" />
</td>
<td width="47%">&nbsp;</td>
</tr>
</table>
<textarea readonly="readonly" name="attxt" id="attxt" rows="50" style="width: 100%;" maxlength="160"></textarea>
</div>
</fieldset>
</div>
<%+footer%>