module(..., package.seeall) default_action = "status" function status(self) return self.model.getlogging() end function config(self) local config = self.model.getconfig() if self.clientdata.Save then for name,value in pairs(config.value) do if value.type == "boolean" then value.value = (self.clientdata[name] ~= nil) elseif clientdata[name] then value.value = clientdata[name] end end config = self.model.updateconfig(config) if not config.errtxt then config.descr = "Saved config" end end config.type = "form" config.label = "Edit config" config.option = "Save" return config end function expert(self) -- Save changes local config = self.model.get_filedetails() if self.clientdata.Save then local modifications = self.clientdata.filecontent or "" local result = self.model.update_filecontent(modifications) if not result.value then config.value.filecontent.value = modifications config.value.filecontent.errtxt = result.errtxt config.errtxt = "Failed to save config!" else config = self.model.get_filedetails() config.descr = "Saved File" end end config.type = "form" config.label = "Edit config" config.option = "Save" return config end function startstop(self) local result if self.clientdata.action then result = self.model:startstop_service(self.clientdata.action) self.sessiondata.syslogstartstopresult = result self.redirect_to_referrer(self) end local status = self.model.getstatus() if self.sessiondata.syslogstartstopresult then result = self.sessiondata.syslogstartstopresult self.sessiondata.syslogstartstopresult = nil end return cfe({ type="group", value={status=status, result=result} }) end function basicstatus(self) status = self.model.getstatus() version = self.model.getversion() return cfe({ type="group", value={status=status, version=version} }) end