summaryrefslogtreecommitdiffstats
path: root/cron-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'cron-controller.lua')
-rw-r--r--cron-controller.lua32
1 files changed, 25 insertions, 7 deletions
diff --git a/cron-controller.lua b/cron-controller.lua
index 43a76d3..ae8abee 100644
--- a/cron-controller.lua
+++ b/cron-controller.lua
@@ -1,16 +1,34 @@
-- the cron controller
-
module (..., package.seeall)
--- Public methods
+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
-default_action = "read"
+function listjobs(self)
+ return self.model.listjobs()
+end
-read = function (self)
- return ({ crontab = self.model:get()} )
+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
-update = function (self)
- return ( {status = self.model:set() })
+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