diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-04-02 11:43:27 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-04-02 11:43:27 +0000 |
commit | 15f432dd230df053f861e97638aed42befab24f9 (patch) | |
tree | e73223e039cd3f8448fb448ea5fae680f006cc08 | |
parent | bfbd3a922f57bded604819b2bd6d0703fabf985b (diff) | |
download | acf-ipsec-tools-15f432dd230df053f861e97638aed42befab24f9.tar.bz2 acf-ipsec-tools-15f432dd230df053f861e97638aed42befab24f9.tar.xz |
Added /etc/ipsec.conf to the expert-tab.v0.2.0
git-svn-id: svn://svn.alpinelinux.org/acf/ipsec-tools/trunk@893 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | ipsectools-controller.lua | 17 | ||||
-rw-r--r-- | ipsectools-expert-html.lsp | 30 | ||||
-rw-r--r-- | ipsectools-model.lua | 33 |
3 files changed, 78 insertions, 2 deletions
diff --git a/ipsectools-controller.lua b/ipsectools-controller.lua index 11d597d..1689b36 100644 --- a/ipsectools-controller.lua +++ b/ipsectools-controller.lua @@ -55,6 +55,12 @@ expert = function (self) if ( self.clientdata.cmdsave ) then modifications = self.model:update_filecontent(modifications) end + + local modifications2 = self.clientdata.filecontent2 or "" + if ( self.clientdata.cmdsave2 ) then + modifications2 = self.model:update_filecontent2(modifications2) + end + local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller -- Start/Stop/Restart process @@ -85,6 +91,17 @@ expert = function (self) file.cmdsave.descr="* Changes has been saved!" end + -- Add buttons + file.cmdsave2 = cfe ({ + name="cmdsave2", + label="Apply settings", + value="Apply", + type="submit", + }) + if (self.clientdata.cmdsave2) then + file.cmdsave2.descr="* Changes has been saved!" + end + -- Management buttons local disablestart,disablestop,disablerestart diff --git a/ipsectools-expert-html.lsp b/ipsectools-expert-html.lsp index cf70091..604a276 100644 --- a/ipsectools-expert-html.lsp +++ b/ipsectools-expert-html.lsp @@ -52,7 +52,7 @@ displayinfo(myform,tags,"viewonly") <form name="myform" action="" method="POST"> <h1>CONFIGURATION</h1> -<H2>Expert config</H2> +<H2>Expert config - Config</H2> <h3>File details</h3> <DL> <? @@ -68,7 +68,7 @@ local myform = form.file io.write(html.form[myform.filecontent.type](myform.filecontent)) ?> -<H2>SAVE AND APPLY ABOVE SETTINGS</H2> +<H3>SAVE AND APPLY ABOVE SETTINGS</H3> <DL> <? local tags = { "cmdsave", } @@ -78,6 +78,32 @@ displayinfo(myform,tags) </form> +<form name="myform" action="" method="POST"> +<H2>Expert config - Policy</H2> +<h3>File details</h3> +<DL> +<? +local myform = form.file +local tags = { "filename2", "filesize2", "mtime2", "sumerrors2", } +displayinfo(myform,tags,"viewonly") +?> +</DL> + +<H3>FILE CONTENT</H3> +<? +local myform = form.file +io.write(html.form[myform.filecontent2.type](myform.filecontent2)) +?> + +<H3>SAVE AND APPLY ABOVE SETTINGS</H3> +<DL> +<? +local tags = { "cmdsave2", } +displayinfo(myform,tags) +?> +</DL> + +</form> <? -- MANAGEMENT BUTTONS local cmdform = form.management local cmdresult = form.cmdmanagement diff --git a/ipsectools-model.lua b/ipsectools-model.lua index 3582900..6eed873 100644 --- a/ipsectools-model.lua +++ b/ipsectools-model.lua @@ -8,6 +8,7 @@ require("daemoncontrol") require("validator") local configfile = "/etc/racoon/racoon.conf" +local configfile2 = "/etc/ipsec.conf" local processname = "racoon" local pkgname = "ipsec-tools" local baseurl = "/etc/racoon/" @@ -215,10 +216,42 @@ function get_filedetails() label="File content", value=fs.read_file(path), }) + + path = configfile2 + filedetails = fs.stat(path) + file["filename2"] = cfe({ + name="filename2", + label="File name", + value=path, + }) + file["filesize2"] = cfe({ + name="filesize2", + label="File size", + value=filedetails.size or 0, + }) + file["mtime2"] = cfe({ + name="mtime2", + label="File date", + value=filedetails.mtime or "---", + }) + file["filecontent2"] = cfe({ + type="longtext", + name="filecontent2", + label="File content", + value=fs.read_file(path), + }) + + return file end + function update_filecontent (self, modifications) local path = configfile local file_result,err = fs.write_file(path, format.dostounix(modifications)) return file_result end +function update_filecontent2 (self, modifications) + local path = configfile2 + local file_result,err = fs.write_file(path, format.dostounix(modifications)) + return file_result +end |