summaryrefslogtreecommitdiffstats
path: root/gnats-controller.lua
diff options
context:
space:
mode:
authorNatanael Copa <natanael.copa@gmail.com>2008-05-27 12:00:26 +0000
committerNatanael Copa <natanael.copa@gmail.com>2008-05-27 12:00:26 +0000
commitb711e55cd1d49e0fdc5638f7acb0d7a7572e2f23 (patch)
treef2a01251fcbcab3038c08acb4aca7e585fa1562d /gnats-controller.lua
parent9f69a93779e249754f680ed9a78cb6d37c59acb0 (diff)
downloadacf-gnats-b711e55cd1d49e0fdc5638f7acb0d7a7572e2f23.tar.bz2
acf-gnats-b711e55cd1d49e0fdc5638f7acb0d7a7572e2f23.tar.xz
jquery powered gnatsv0.3
git-svn-id: svn://svn.alpinelinux.org/acf/gnats/trunk@1183 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'gnats-controller.lua')
-rw-r--r--gnats-controller.lua144
1 files changed, 77 insertions, 67 deletions
diff --git a/gnats-controller.lua b/gnats-controller.lua
index d85445d..0bcf6a6 100644
--- a/gnats-controller.lua
+++ b/gnats-controller.lua
@@ -25,8 +25,8 @@ local descr = {
['description']="Description",
['howtorepeat']="How-to-repeat this bug",
['fix']="Fix",
- ['synopsis']="Short description (on line)",
- ['from']="Your e-mail address",
+ ['synopsis']="One-line description*",
+ ['from']="Your e-mail address*",
['reporter_name']="Your full name",
['reporter_id']="Your ID (Submitter ID)",
['reporter_org']="Your organization name",
@@ -179,11 +179,11 @@ function query(self)
query.pr = cfe({
name="pr",
- label="Query a specific PR number:",
+ label="Search string",
})
query.pr_cmd = cfe({
name="pr_cmd",
- label="Submit the query",
+ label="&nbsp;",
type="submit",
value="Submit",
})
@@ -227,9 +227,9 @@ function query(self)
query.advanced_cmd = cfe({
name="advanced_cmd",
- label="Submit the advanced query",
+ label="&nbsp;",
type="submit",
- value="Submit",
+ value="Submit advanced query",
})
-- Assume connection is down if you get no reply from it (disable buttons)
@@ -252,13 +252,81 @@ function query(self)
}
end
+---------------------------------------------------------------------------
+function summary(self)
+ -- parse the search criterias - select boxes
+ local action = "Query"
+ local s = {}
+ local invalid = nil
+
+ if self.clientdata.pr then
+ s["synopsis"] = self.model.validate_textfield(self.clientdata.pr)
+ else
+
+ for i, f in ipairs({"class", "category", "severity", "priority", "state", "responsible"}) do
+ s[f] = self.model:validate_field(self.clientdata[f], f)
+ end
+
+ -- parse the search criterias - input boxes
+ for i,f in ipairs({"text", "multitext", "originator"}) do
+ s[f] = self.model.validate_textfield(self.clientdata[f] or "")
+ -- replace this with ajax stuff?
+ if action == "Query" and s[f] == nil then
+ self.model:set_invalid_field(f)
+ invalid = true
+ end
+ -- if field is blank, then ignore it
+ if action == "Query" and s[f] == "" then
+ s[f] = nil
+ end
+ end
+ end
+
+ -- we have found atleast one invalid field. reset the action
+ if invalid then
+ action = nil
+ end
+
+ if (self.clientdata.skipclosed) then
+ s["skip-closed"] = ""
+ else
+ s["skip-closed"] = nil
+ end
+
+ -- Set the search criterias
+ self.model:set_search_criteria(s)
+
+ local summary = self.model:summary()
+
+--[[ -- Hide unwanted records
+ local modsummary = {}
+ for k,v in pairs(orgsummary) do
+ if not ((orgsummary[k]['state'] == "closed") and ((orgsummary[k]['category'] == "test") or (orgsummary[k]['category'] == "spam"))) then
+ table.insert(modsummary, v)
+ end
+ end
+ summary = modsummary
+--]]
+
+ return {
+ option={ script=self.conf.script,
+ prefix=self.conf.prefix,
+ controller = self.conf.controller,
+ action = "edit",
+ extra = "",
+ },
+ summary = summary,
+ }
+end
+
+-----------------------------------------------------------------------
function queryresult(self)
local query = {}
local pr_id = self.clientdata.pr
if (tonumber(pr_id)) then
query.header, query.sfields, query.mfields = self.model:read_pr(pr_id)
else
- redirect(self)
+ return summary(self)
end
local myform = query.header
@@ -347,66 +415,8 @@ function queryresult(self)
end
-function summary(self)
- -- parse the search criterias - select boxes
- local action = "Query"
- local s = {}
- for i, f in ipairs({"class", "category", "severity", "priority", "state", "responsible"}) do
- s[f] = self.model:validate_field(self.clientdata[f], f)
- end
-
- local invalid = nil
- -- parse the search criterias - input boxes
- for i,f in ipairs({"text", "multitext", "originator"}) do
- s[f] = self.model:validate_textfield(self.clientdata[f], f)
- -- replace this with ajax stuff?
- if action == "Query" and s[f] == nil then
- self.model:set_invalid_field(f)
- invalid = true
- end
- -- if field is blank, then ignore it
- if action == "Query" and s[f] == "" then
- s[f] = nil
- end
- end
-
- -- we have found atleast one invalid field. reset the action
- if invalid then
- action = nil
- end
-
- if (self.clientdata.skipclosed) then
- s["skip-closed"] = ""
- else
- s["skip-closed"] = nil
- end
-
- -- Set the search criterias
- self.model:set_search_criteria(s)
-
- local summary = self.model:summary()
-
---[[ -- Hide unwanted records
- local modsummary = {}
- for k,v in pairs(orgsummary) do
- if not ((orgsummary[k]['state'] == "closed") and ((orgsummary[k]['category'] == "test") or (orgsummary[k]['category'] == "spam"))) then
- table.insert(modsummary, v)
- end
- end
- summary = modsummary
---]]
-
- return {
- option={ script=self.conf.script,
- prefix=self.conf.prefix,
- controller = self.conf.controller,
- action = "edit",
- extra = "",
- },
- summary = summary,
- }
-end
+--------------------------------------------------------------------------
function report(self)
local reportform = {}
local status = self.model:getstatus(self)
@@ -451,7 +461,7 @@ function report(self)
-- Add buttons
reportform.submit = cfe ({
name="submit",
- label="Submit this repport",
+ label="&nbsp;", -- hack
value="Submit",
type="submit",
})