summaryrefslogtreecommitdiffstats
path: root/apk-controller.lua
blob: 9876347308efa8a77f8a2b8bb4aa61f9d92e05e0 (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
-- the interfaces  controller
require("controllerfunctions")

module (..., package.seeall)

default_action = "loaded"

read = function(self)
	return self.model.get_packages()
end

loaded = function(self)
	return cfe({ type="group", value={loaded=self.model.get_loaded_packages()} })
end

available = function(self)
	return cfe({ type="group", value={available=self.model.get_available_packages()} })
end

delete = function(self)
	return self:redirect_to_referrer(self.model.delete_package(self.clientdata.package or "", self.sessiondata))
end

install = function(self)
	return self:redirect_to_referrer(self.model.install_package(self.clientdata.package or "", self.sessiondata))
end

config = function(self)
	return controllerfunctions.handle_form(self, self.model.get_config, self.model.set_config, self.clientdata, "Save", "Edit Configuration", "Configuration Saved")
end