summaryrefslogtreecommitdiffstats
path: root/openvpn-controller.lua
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2007-11-22 16:14:52 +0000
committerMika Havela <mika.havela@gmail.com>2007-11-22 16:14:52 +0000
commit21f9432147b05601bc323edbe6b0a4c0daa97089 (patch)
treedc38efad89a91e82dc438177bcacd52c5d8388cf /openvpn-controller.lua
parentcaca5e32230dd0237865d70eae4d6a18d942e1ba (diff)
downloadacf-openvpn-21f9432147b05601bc323edbe6b0a4c0daa97089.tar.bz2
acf-openvpn-21f9432147b05601bc323edbe6b0a4c0daa97089.tar.xz
OpenVPN Mainpage,Serverconfig,Connectedclients got more functionallity
git-svn-id: svn://svn.alpinelinux.org/acf/openvpn/trunk@355 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'openvpn-controller.lua')
-rw-r--r--openvpn-controller.lua104
1 files changed, 7 insertions, 97 deletions
diff --git a/openvpn-controller.lua b/openvpn-controller.lua
index a70782e..99a655b 100644
--- a/openvpn-controller.lua
+++ b/openvpn-controller.lua
@@ -22,103 +22,9 @@ mvc.on_load = function(self, parent)
end
-local function build_form ( model )
- local viewtable = {}
- local configform = {}
- local processform = {}
- local messageform = {}
--- local conflist = model.conflist()
- local conflist = "hej"
- local formwith = 60
- -- cf.self is a global variable specifiying this controller
- -- local url = cf.self or ""
-
---[[ table.insert ( messageform , {
- type = "label" ,
- value = "Logfile info" ,
- text = "Tail file <i><b>/var/log/messages</b></i><BR><font style='color:f00'>(Still working on this function)</font>"
- } )
-]]--
- table.insert ( processform , {
- type = "label" ,
- value = "Process information",
- text = "Information on if process is running."
- } )
- table.insert ( processform , {
- type = "formtext",
- label = "openvpn process status",
--- value = model.status("openvpn")
- value = "hej"
- } )
-
-
--- if table.maxn(conflist)==0 then
- if 0==0 then
- table.insert ( configform , {
- type = "label" ,
- value = "List of valid configurations" ,
- text = "No valid configurations could be found in <i><b>/etc/openvpn/</b></i><br>A valid config is called *.conf and has got at least the following parameters set: ca, cert, key, dev, proto (and for clients also parameter 'remote')"
- } )
- else
- -- Generate processlist
- configform[1] = {
- type = "label",
- value = "List of valid configurations" ,
- text = "List is based on all valid configuration files named <i><b>/etc/openvpn/*.conf</b></i>"
- }
- for i=1,table.maxn(conflist) do
- table.insert ( configform , {
- type = "formtext" ,
--- label = conflist[i].confname ,
- label = "hej" ,
--- value = conflist[i].conftype or ""
- value = "hej" or ""
- } )
- end
- end
-
- --- Define the main table used by the generic view renderer
- viewtable[1] = {
- type = "label",
- value = "GENERAL"
- }
- viewtable[2] = {
- type = "form",
- method = "post",
- action = "set",
- -- Put the 'form' table in the view table
- value = processform
- }
- viewtable[3] = {
- type = "form",
- method = "post",
- action = "set",
- --action = cf.self .. "/set",
- -- Put the 'form' table in the view table
- value = configform
- }
- viewtable[4] = {
- type = "form",
- method = "post",
- action = "set",
- --action = cf.self .. "/set",
- -- Put the 'form' table in the view table
- value = messageform
- }
- return viewtable
-end
-
--- Public methods
--- <prefix>/hostname/get
-
-
read = function (self)
- --local me = {}
- --me = cfe{name=conflistfilesaf, value="hej"}
+ -- FIXME: If return 1 rows go direct to that config-page
return ( {conflistfiles = self.model:get_conflist(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller, version = self.model:openvpn_version()} )
--- return ({conflistfiles = me})
--- return self.model:get()
--- return build_form(self)
end
@@ -135,12 +41,16 @@ pem_info = function (self)
end
status_info = function (self)
+ local configname = self.clientdata.name or ""
+ -- FIXME: If return 0 rows, goto read
+ return ( {clientlist = self.model:clientlist(configname), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end
unknown_config = function (self)
end
logfile = function (self)
+ local configname = self.clientdata.name or ""
+ -- FIXME: If return 0 rows, goto read
+ return ( {logfilecontent = self.model:get_logfile(configname), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end
-
-create = update