luci/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_networkconfig.lua
danrl a25c71f556 luci-app-mwan3: initial commit
Moved over here from the packages repository.

Signed-off-by: Dan Luedtke <mail@danrl.com>
2017-02-17 11:22:01 +01:00

32 lines
733 B
Lua

-- ------ network configuration ------ --
ut = require "luci.util"
networkConfig = "/etc/config/network"
m5 = SimpleForm("networkconf", nil)
m5:append(Template("mwan/advanced_networkconfig")) -- highlight current tab
f = m5:section(SimpleSection, nil,
translate("This section allows you to modify the contents of /etc/config/network"))
t = f:option(TextValue, "lines")
t.rmempty = true
t.rows = 20
function t.cfgvalue()
return nixio.fs.readfile(networkConfig) or ""
end
function t.write(self, section, data) -- format and write new data to script
return nixio.fs.writefile(networkConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n")
end
function f.handle(self, state, data)
return true
end
return m5