资源管理
]]
local globle = require "cgilua.globle"
if(cgi.action==nil) then
local resource = globle.get("RESOURCES") or {}
ap.rputs [[
]]
elseif(cgi.action=="查看" and cgi.name) then
local resource = globle.get("RESOURCES") or {}
res = resource[cgi.name] or {}
for k,v in pairs(res) do
print (string.format ("%s=%s ", k, tostring(v)))
end
elseif(cgi.action=="删除" and cgi.name) then
local resource = globle.get("RESOURCES") or {}
resource[cgi.name] = nil
print (cgi.name.."成功删除")
globle.set("RESOURCES",resource);
elseif(cgi.action=="提交" and cgi.name~=nil) then
local resource = globle.get("RESOURCES") or {}
if(resource[cgi.name]~= nil) then
print ("同名资源 "..cgi.name.."已经存在将会比覆盖")
end
print (cgi.name.."资源添加成功")
cgi.action=nil
resource[cgi.name]=cgi
globle.set("RESOURCES",resource);
else
ap.rputs [[
Web资源
文件共享
端口转发
主机
网络
]]
end
ap.rputs [[
]]