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

-- ################################################################################
-- LOCAL FUNCTIONS

local function list_redir (self)
	self.conf.action = "read"
	self.conf.type = "redir"
	error (self.conf)
end

-- ################################################################################
-- PUBLIC FUNCTIONS

mvc={}
function mvc.on_load(self, parent)
	if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then
		self.worker[self.conf.action] = list_redir(self)
	end
end


function read (self )
	return ({projects = self.model:get(), 
		url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end

function update (self )
	return ({projects = self.model:get(),
		updates = self.model:update(), 
		url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end

function diff (self )
	return ({projects = self.model:get(),
		updates = self.model:diffs(), 
		url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end

function status (self )
	return ({projects = self.model:get(),
		updates = self.model:status(), 
		url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end

function log (self )
	return ({projects = self.model:get(),
		updates = self.model:log(), 
		url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end