You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
2.9 KiB
HTML
109 lines
2.9 KiB
HTML
<%#
|
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
|
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
|
Licensed to the public under the Apache License 2.0.
|
|
-%>
|
|
<%
|
|
|
|
local fs = require("nixio.fs")
|
|
local http = require("luci.http")
|
|
local util = require("luci.util")
|
|
local sys = require("luci.sys")
|
|
|
|
local dir = '/var/spool/sms/incoming/'
|
|
msg = {}
|
|
|
|
function directory(dir)
|
|
local p = io.popen('find "'..dir..'" -type f -iname [0-9]* | sort -r')
|
|
for file in p:lines() do
|
|
table.insert(msg, file)
|
|
msg[#msg + 1] = sms
|
|
end
|
|
end
|
|
|
|
|
|
start_string = '<div class="td left" width="25%">'
|
|
end_string = '</div>'
|
|
foot = '</div>'
|
|
button = [[
|
|
<input class="cbi-button cbi-button-remove" type="submit" value="Remove" />
|
|
]]
|
|
|
|
function exist(dir)
|
|
directory(dir)
|
|
for k,v in pairs(msg) do
|
|
msg[k] = v
|
|
if (k%2==0) then
|
|
head = '<div class="tr cbi-rowstyle-2">'
|
|
else
|
|
head = '<div class="tr cbi-rowstyle-1">'
|
|
end
|
|
local f = io.open(v, "rb")
|
|
if f then
|
|
f:close()
|
|
end
|
|
lines = {}
|
|
for r in io.lines(v) do
|
|
lines[#lines + 1] = r
|
|
end
|
|
if (lines[1] ~= nil) then
|
|
for fr in lines[1]:gmatch("%w+") do
|
|
if (tonumber(fr)) and (#fr >= 7 ) then
|
|
fromto = fr
|
|
fromto = ('+'..fromto..'')
|
|
else
|
|
fromto = fr
|
|
end
|
|
end
|
|
send = {}
|
|
for sn in lines[4]:gmatch("%S+") do
|
|
send[#send + 1] = sn
|
|
end
|
|
recieved ={}
|
|
for res in lines[5]:gmatch("%S+") do
|
|
recieved[#recieved + 1] = res
|
|
end
|
|
text = {}
|
|
for t in table.concat(lines,"<br />",14,r):gmatch("%S+") do
|
|
text[#text + 1] = t
|
|
end
|
|
print(head, start_string, fromto,
|
|
end_string, start_string,
|
|
send[2], send[3], end_string,
|
|
start_string, recieved[2], recieved[3],
|
|
end_string, start_string,
|
|
table.concat(text, " "), end_string, foot)
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
%>
|
|
|
|
<script type="text/javascript">//<![CDATA[
|
|
function erase_in_sms(){
|
|
XHR.get('<%=luci.dispatcher.build_url("admin", "modem", "erase_in_sms")%>');
|
|
alert("<%:Delete all incoming messages!%>");
|
|
location.reload();
|
|
}
|
|
//]]></script>
|
|
|
|
<%+header%>
|
|
<h2 name="content"><%:Smstools3: Incoming Messages%></h2>
|
|
<fieldset class="cbi-section">
|
|
<div class="table" width="100%">
|
|
<div class="tr cbi-rowstyle-2">
|
|
<div class="td left" width="25%"><b><%:From%></b></div>
|
|
<div class="td left" width="25%"><b><%:Send%></b></div>
|
|
<div class="td left" width="25%"><b><%:Recieve%></b></div>
|
|
<div class="td left" width="25%"><b><%:Message%></b></div>
|
|
</div>
|
|
<% exist(dir)
|
|
luci.sys.exec('/usr/share/luci-app-smstools3/led.sh off') %>
|
|
</div>
|
|
<div class="table" width="100%">
|
|
<div class="td left" width="100%"><input class="cbi-button cbi-button-remove" type="submit" value="<%:Remove All%>" title="<%:Delete All incoming Messages%>" onclick="return erase_in_sms()"/></div>
|
|
</div>
|
|
</fieldset>
|
|
<%+footer%>
|