summaryrefslogtreecommitdiffstats
path: root/tinydns-controller.lua
blob: b6840d1c22620f5e3be1939d787bc81f338aac17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module(..., package.seeall)

local list_redir = function (self)
	self.conf.action = "status"
	self.conf.type = "redir"
	error (self.conf)
end

mvc = {}
mvc.on_load = function(self, parent)
	if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then
		self.worker[self.conf.action] = list_redir(self)
	end
end

local function getstatus(self)
	local status = self.model.getstatus()
	if (#status.status.value > 0) then
		status.status.value = "Enabled"
	else
		status.status.value = "Disabled"
	end
	return status
end

function status(self)
	return { status=getstatus(self) }
end