From b711e55cd1d49e0fdc5638f7acb0d7a7572e2f23 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 27 May 2008 12:00:26 +0000 Subject: jquery powered gnats git-svn-id: svn://svn.alpinelinux.org/acf/gnats/trunk@1183 ab2d0c66-481e-0410-8bed-d214d4d58bed --- Makefile | 7 +- gnats-controller.lua | 144 ++++++++++++++------------- gnats-model.lua | 2 +- gnats-query-html.lsp | 9 +- gnats-queryresult-html.lsp | 76 +++++++++++++- gnats-summary-html.lsp | 4 +- js/jquery-1.2.5.min.js | 32 ++++++ js/sgbeal-togglepane.jquery.min.js | 6 ++ skins/gnats1/background_header_green.png | Bin 0 -> 292 bytes skins/gnats1/dot_green.gif | Bin 0 -> 52 bytes skins/gnats1/gnats1-ie.css | 6 ++ skins/gnats1/gnats1.css | 60 +++++++---- skins/gnats1/h1_green.png | Bin 0 -> 204 bytes template-html.lsp | 164 +++++++++++++++++++++++++++++++ 14 files changed, 414 insertions(+), 96 deletions(-) create mode 100644 js/jquery-1.2.5.min.js create mode 100644 js/sgbeal-togglepane.jquery.min.js create mode 100644 skins/gnats1/background_header_green.png create mode 100644 skins/gnats1/dot_green.gif create mode 100644 skins/gnats1/gnats1-ie.css create mode 100644 skins/gnats1/h1_green.png create mode 100644 template-html.lsp diff --git a/Makefile b/Makefile index ab78209..bf6f075 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,14 @@ APP_NAME=gnats PACKAGE=acf-$(APP_NAME) -VERSION=0.2.2 +VERSION=0.3 APP_DIST=\ gnats* \ + template-html.lsp EXTRA_DIST=README Makefile config.mk -DISTFILES=$(APP_DIST) $(EXTRA_DIST) skins +DISTFILES=$(APP_DIST) $(EXTRA_DIST) skins js TAR=tar @@ -15,6 +16,7 @@ P=$(PACKAGE)-$(VERSION) tarball=$(P).tar.bz2 install_dir=$(DESTDIR)/$(appdir)/$(APP_NAME) skin_dir=$(DESTDIR)/$(wwwdir)/skins/ +js_dir=$(DESTDIR)/$(wwwdir)/js/ all: clean: @@ -27,6 +29,7 @@ install: cp -a $(APP_DIST) "$(install_dir)" mkdir -p $(skin_dir) cp -a skins/* "$(skin_dir)" + cp -a js/* "$(js_dir)" $(tarball): $(DISTFILES) rm -rf $(P) 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=" ", type="submit", value="Submit", }) @@ -227,9 +227,9 @@ function query(self) query.advanced_cmd = cfe({ name="advanced_cmd", - label="Submit the advanced query", + label=" ", 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=" ", -- hack value="Submit", type="submit", }) diff --git a/gnats-model.lua b/gnats-model.lua index 5a00ba1..e0a2540 100644 --- a/gnats-model.lua +++ b/gnats-model.lua @@ -245,7 +245,7 @@ function validate_field(self, value, field) end -- validate for insecure chars in field -function validate_textfield(self,value) +function validate_textfield(value) if value == nil or value == "" then return "" end diff --git a/gnats-query-html.lsp b/gnats-query-html.lsp index bff537a..cc7824b 100644 --- a/gnats-query-html.lsp +++ b/gnats-query-html.lsp @@ -55,8 +55,11 @@ displayinfo(myform,tags) -
-

Advanced query

+ +
+
+

Advanced query

+
+
+
diff --git a/gnats-queryresult-html.lsp b/gnats-queryresult-html.lsp index f1d47ed..23fd3cb 100644 --- a/gnats-queryresult-html.lsp +++ b/gnats-queryresult-html.lsp @@ -1,10 +1,12 @@ DEBUGGING

DEBUG INFO: CFE

") -io.write(html.cfe_unpack(form.query)) +io.write(html.cfe_unpack(form)) io.write("
") --]] +if form.query ~= nil then + ?> + + + + +

Current Alpine problem reports

+ +

Bugs can be in one of several states (S)

+ +
+
o - open
A problem report has been submitted, no sanity checking performed.
+
+
+
a - analyzed
The problem is understood and a solution is being sought.
+
+
+
f - feedback
Further work requires additional information from the originator or the community - possibly confirmation of the effectiveness of a proposed solution.
+
+
+
s - suspended
The problem is not being worked on, due to lack of information or resources. This is a prime candidate for somebody who is looking for a project to do. If the problem cannot be solved at all, it will be closed, rather than suspended.
+
+
+
c - closed
A problem report is closed when any changes have been integrated, documented, and tested -- or when fixing the problem is abandoned.
+
+ +

SUMMARY

+ + + + + + + + + + + + + + + + + + + + +
IDSSubmittedSeverityDescription
+ + diff --git a/gnats-summary-html.lsp b/gnats-summary-html.lsp index c70d1f1..0c65e4e 100644 --- a/gnats-summary-html.lsp +++ b/gnats-summary-html.lsp @@ -2,11 +2,9 @@ require("viewfunctions") ?> DEBUGGING

DEBUG INFO: CFE

") io.write(html.cfe_unpack(form)) io.write("
") ---]] ?>