summaryrefslogtreecommitdiffstats
path: root/cron-controller.lua
blob: a420cc9d3eea45ce372495d29306282ccb808917 (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
-- 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.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 movejob(self)
	return controllerfunctions.handle_form(self, self.model.get_move_job, self.model.move_job, self.clientdata, "Move", "Move Job", "Job Moved")
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