From 9f186b02cb10036f234a965bfca6080186217c50 Mon Sep 17 00:00:00 2001 From: Andreas Brodmann Date: Mon, 12 Nov 2007 16:13:51 +0000 Subject: added global settings configuration to dhcp git-svn-id: svn://svn.alpinelinux.org/acf/dhcp/trunk@298 ab2d0c66-481e-0410-8bed-d214d4d58bed --- dhcp-controller.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'dhcp-controller.lua') diff --git a/dhcp-controller.lua b/dhcp-controller.lua index 0542150..cca9a98 100644 --- a/dhcp-controller.lua +++ b/dhcp-controller.lua @@ -49,6 +49,31 @@ dep = function ( self ) return ( cfe ({ msg = msg }) ) end +settings = function ( self ) + + if not self.clientdata.cmd then + list_redir(self) + end + + local settings = {} + local option = { script = ENV["SCRIPT_NAME"], + prefix = self.conf.prefix, + controller = self.conf.controller, + action = self.conf.action, + extra = "" + } + + if self.clientdata.cmd == "update" then + tmp = self.clientdata + settings = self.model.create_new_settings( tmp.defleasetime, tmp.maxleasetime, tmp.domainname ) + errcode, settings = self.model.update_settings( settings ) + return ( cfe ({ option = option, value = settings, errcode = errcode })) + else + settings = self.model.read_settings() + return ( cfe ({ option = option, value = settings, errcode = { msg = "", fields={} }}) ) + end +end + editnet = function ( self ) if not self.clientdata.cmd then -- cgit v1.2.3