From ea416afe39d2b4d796ccbfe0a7819968ef2d6f63 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Fri, 4 Apr 2008 20:25:46 +0000 Subject: Now you can view/edit all files in /etc/tinydns/. You shouldn't be able to view/edit other files than in /etc/tinydns (and it's subfolders). git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@948 ab2d0c66-481e-0410-8bed-d214d4d58bed --- tinydns-controller.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'tinydns-controller.lua') diff --git a/tinydns-controller.lua b/tinydns-controller.lua index f6c5268..502af03 100644 --- a/tinydns-controller.lua +++ b/tinydns-controller.lua @@ -233,21 +233,34 @@ function edit(self) -- Save changes if ( self.clientdata.cmdsave) then - local filetochange = cfe ({ name=self.clientdata.filename, value=self.clientdata.filecontent, }) + local filetochange = cfe ({ name=self.clientdata.name, value=self.clientdata.filecontent, }) modifications = self.model:updatefilecontent(filetochange) - self.clientdata.name = self.clientdata.filename +-- if not (modifications) then +-- self.conf.action = "status" +-- self.conf.type = "redir" +-- error (self.conf) +-- end + end + + if not (self.model:valid_filename(self.clientdata.name)) then + self.conf.action = "status" + self.conf.type = "redir" + error (self.conf) end local status = getstatus(self) local file = self.model:get_filedetails(self.clientdata.name) + -- Add a cmd button to the view file.cmdsave = cfe({ name="cmdsave", label="Save/Apply above settings", value="Save", type="submit", - disabled="yes", }) + if (modifications) then + file.cmdsave.descr="* Changes has been saved!" + end return { option={ script=ENV["SCRIPT_NAME"], -- cgit v1.2.3