blob: 5c474155a9a5332c59590a3823c098d7e9807b64 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
module(..., package.seeall)
default_action = "status"
function status(self)
return self.model.getlogging()
end
function config(self)
local config
if self.clientdata.save then
config = self.model.updateconfig(self.clientdata)
else
config = self.model.getconfig()
end
config.type = "form"
return config
end
function expert(self)
-- Save changes
local modifications = self.clientdata.filecontent or ""
if self.clientdata.save then
self.model:update_filecontent(modifications)
end
local config = self.model:get_filedetails()
config.type = "form"
if self.clientdata.save then
config.descr = "Saved File"
end
return config
end
function startstop(self)
local result
if self.clientdata.action then
result = self.model:startstop_service(self.clientdata.action)
self.sessiondata.syslogstartstopresult = result
self.redirect_to_referrer(self)
end
local status = self.model.getstatus()
if self.sessiondata.syslogstartstopresult then
result = self.sessiondata.syslogstartstopresult
self.sessiondata.syslogstartstopresult = nil
end
return cfe({ type="group", value={status=status, result=result} })
end
function basicstatus(self)
status = self.model.getstatus()
version = self.model.getversion()
return cfe({ type="group", value={status=status, version=version} })
end
|