From 9f69a93779e249754f680ed9a78cb6d37c59acb0 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Thu, 22 May 2008 11:59:52 +0000 Subject: Viewfile bugfixes on IMG. Disable buttons when no connection to server. git-svn-id: svn://svn.alpinelinux.org/acf/gnats/trunk@1174 ab2d0c66-481e-0410-8bed-d214d4d58bed --- Makefile | 2 +- gnats-controller.lua | 16 ++++++++++++++++ gnats-report-html.lsp | 22 ++++++++++++---------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index b284221..ab78209 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ APP_NAME=gnats PACKAGE=acf-$(APP_NAME) -VERSION=0.2.1 +VERSION=0.2.2 APP_DIST=\ gnats* \ diff --git a/gnats-controller.lua b/gnats-controller.lua index 25d1ee5..d85445d 100644 --- a/gnats-controller.lua +++ b/gnats-controller.lua @@ -232,6 +232,15 @@ function query(self) value="Submit", }) + -- Assume connection is down if you get no reply from it (disable buttons) + if not (query['severity']['option']) or (#query['severity']['option'] < 2) then + query.advanced_cmd.disabled="yes" + query.advanced_cmd.errtxt="Lost connection to the server!" + query.pr_cmd.disabled=query.advanced_cmd.disabled + query.pr_cmd.errtxt=query.advanced_cmd.errtxt + + end + return { option={ script=self.conf.script, prefix=self.conf.prefix, @@ -446,6 +455,13 @@ function report(self) value="Submit", type="submit", }) + -- Assume connection is down if you get no reply from it (disable buttons) + if not (reportform['severity']['option']) or (#reportform['severity']['option'] == 0) then + reportform.submit.disabled = "yes" + reportform.submit.errtxt = "Lost connection to the server!" + end + + if (self.clientdata.submit) then diff --git a/gnats-report-html.lsp b/gnats-report-html.lsp index 7047653..b8a841e 100644 --- a/gnats-report-html.lsp +++ b/gnats-report-html.lsp @@ -1,6 +1,4 @@ -DEBUGGING

DEBUG INFO: CFE

") io.write(html.cfe_unpack(form)) @@ -23,15 +21,19 @@ function displayinfo(myform,tags,viewtype) if (viewtype == "viewonly") then if (val.value == "") then val.value = " " end io.write(val.value) - elseif (val.type == "radio") and (type(val.option) == "table") and (#val.option > 0) then - io.write("") - for k1,v1 in pairs(val.option) do - io.write("\n\t\t\t"..tostring(v1) .. ":") - io.write("") + elseif (val.type == "radio") and (type(val.option) == "table") then + if (#val.option > 0) then + io.write("") + for k1,v1 in pairs(val.option) do + io.write("\n\t\t\t"..tostring(v1) .. ":") + io.write("") + end + io.write("\n\t\t\t") + else + io.write("[No options available]") end - io.write("\n\t\t\t") else io.write(html.form[val.type](val)) end -- cgit v1.2.3