Commit 15f432dd authored by Mika Havela's avatar Mika Havela
Browse files

Added /etc/ipsec.conf to the expert-tab.

git-svn-id: svn://svn.alpinelinux.org/acf/ipsec-tools/trunk@893 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent bfbd3a92
......@@ -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
......
......@@ -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
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment