diff options
Diffstat (limited to 'tinydns-controller.lua')
-rw-r--r-- | tinydns-controller.lua | 19 |
1 files changed, 16 insertions, 3 deletions
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"], |