summaryrefslogtreecommitdiffstats
path: root/cron-controller.lua
blob: ae8abeefb87378e04e847e6ab5afbb826534c3c2 (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
-- the cron controller
module (..., package.seeall)

require("controllerfunctions")

default_action = "status"

function status(self)
	return self.model.getstatus()
end

function startstop(self)
	return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata)
end

function listjobs(self)
	return self.model.listjobs()
end

function editjob(self)
	return controllerfunctions.handle_form(self, function() return self.model.read_job(self.clientdata.name) end, self.model.update_job, self.clientdata, "Save", "Edit Job", "Job Saved")
end

function deletejob(self)
	return self:redirect_to_referrer(self.model.delete_job(self.clientdata.name))
end

function createjob(self)
	return controllerfunctions.handle_form(self, self.model.create_new_job, self.model.create_job, self.clientdata, "Create", "Create New Job", "New Job Created")
end

function expert(self)
	return controllerfunctions.handle_form(self, self.model.read_configfile, self.model.update_configfile, self.clientdata, "Save", "Edit Config File", "Configuration Set")
end