From b6269f672717c021e81da02e6332a06b6651612f Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Fri, 25 Apr 2008 13:39:58 +0000 Subject: Bugfix on SendBugreport. Edit configurationfiles starts working. Started to work on EditPR (still not working). git-svn-id: svn://svn.alpinelinux.org/acf/gnats/trunk@1038 ab2d0c66-481e-0410-8bed-d214d4d58bed --- gnats-controller.lua | 107 +++++++++++++++++++++++++++++++------ gnats-edit-html.lsp | 1 + gnats-editpr-html.lsp | 129 +++++++++++++++++++++++++++++++++++++++++++++ gnats-expert-html.lsp | 4 +- gnats-model.lua | 29 +++++----- gnats-queryeditpr-html.lsp | 56 ++++++++++++++++++++ gnats-status-html.lsp | 4 -- gnats-summary-html.lsp | 16 +++--- gnats.menu | 1 + gnats.roles | 4 +- 10 files changed, 301 insertions(+), 50 deletions(-) create mode 100644 gnats-editpr-html.lsp create mode 100644 gnats-queryeditpr-html.lsp diff --git a/gnats-controller.lua b/gnats-controller.lua index 57a9d04..d5926ba 100644 --- a/gnats-controller.lua +++ b/gnats-controller.lua @@ -98,20 +98,30 @@ local descr = { } -- ################################################################################ --- PUBLIC FUNCTIONS +-- LOCAL FUNCTIONS + +local function list_redir(self) + self.conf.action = "status" + self.conf.type = "redir" + error (self.conf) +end -default_action = "status" + +-- ################################################################################ +-- PUBLIC FUNCTIONS +mvc = {} +function mvc.on_load(self, parent) + if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then + self.worker[self.conf.action] = list_redir(self) + end +end function status(self) return { status=self.model.getstatus() } end ---[[ +---[[ function expert(self) - local modifications = self.clientdata.filecontent or "" - if ( self.clientdata.cmdsave ) then - modifications = self.model:update_filecontent(modifications) - end local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller local status=self.model.getstatus() @@ -124,9 +134,6 @@ function expert(self) value="Apply", type="submit", }) - if (self.clientdata.cmdsave) then - file.cmdsave.descr="* Changes has been saved!" - end return ( { option={ script=ENV["SCRIPT_NAME"], @@ -144,8 +151,9 @@ function edit(self) -- Save changes local modifications = self.clientdata.filecontent or "" + local cmdresult, cmdresultmsg if ( self.clientdata.cmdsave ) then - modifications = self.model:update_filecontent(modifications,self.clientdata.name) + cmdresult, cmdresultmsg = self.model:update_filecontent(modifications,self.clientdata.name) end local status = self.model:getstatus(self) @@ -164,7 +172,8 @@ function edit(self) value="Save", type="submit", }) - if (modifications) then + + if (cmdresult) then file.cmdsave.descr="* Changes has been saved!" end @@ -178,7 +187,6 @@ function edit(self) modifications = modifications, file = file, status = status, - startstop = startstop, } end --]] @@ -257,7 +265,7 @@ function queryresult(self) if (tonumber(pr_id)) then query.header, query.sfields, query.mfields = self.model:read_pr(pr_id) else - redirect(self) + list_redir(self) end local myform = query.header @@ -292,6 +300,24 @@ function queryresult(self) local checkstring2 = 0 table.insert(audit_trail_table, cfe({class="", label=""})) + local tags = { "organization", "environment", "description", "how_to_repeat", "fix", "release_note", } + for k,val in pairs(tags) do + query.mfields[val].type="longtext" + end + + local tags = { "category", "severity", "priority", "class", "state", } + for k,val in pairs(tags) do + query.sfields[val] = cfe({ + name=val, + label=(descr.labels[val] or val), + value=query.sfields[val].value, + type="select", + option=self.model:get_select_opt(val), + }) + -- If there is only a limited amount records, then present as radio buttons. + if (#query.sfields[val].option < 6) then query.sfields[val].type="radio" end + end + for k,v in pairs(format.string_to_table(query.mfields.audit_trail.value, "\n")) do if (v == "") then checkstring2 = checkstring2 + 1 @@ -474,7 +500,10 @@ function report(self) if (noerrorsexists) then local bugreport = {} table.insert(bugreport, "To: " .. (bugreportreceiver or "")) - table.insert(bugreport, "From: " .. (self.clientdata.from or "")) + if not (self.clientdata.reporter_name) or (#self.clientdata.reporter_name == 0) then + self.clientdata.reporter_name = "unknown" + end + table.insert(bugreport, "From: " .. self.clientdata.reporter_name .. " <" .. (self.clientdata.from or "") .. ">") table.insert(bugreport, "Reply-To: " .. (self.clientdata.from or "")) table.insert(bugreport, "") for k,v in pairs({"reporter_id", "notify_list", "originator", "synopsis", "confidential", "severity", @@ -513,3 +542,51 @@ end function reportsuccess() -- Just show that the report was successfully sent. end + +function queryeditpr(self) + local query = {} + + query.pr = cfe({ + name="pr", + label="Query a specific PR number:", + }) + query.pr_cmd = cfe({ + name="pr_cmd", + label="Submit the query", + type="submit", + value="Submit", + }) + return { + option={ script=ENV["SCRIPT_NAME"], + prefix=self.conf.prefix, + controller = self.conf.controller, + action = "edit", + extra = "", + }, + query = query, + } + +end +function editpr(self) + local queryresult = queryresult(self) + local query = queryresult.query + + query.cmdsave = cfe({ + name="cmdsave", + label="Save above changes", + type="submit", + disabled="yes", + errtxt="This button doesn't work. Still don't know howto send this edited information into gnats.", + value="Submit", + }) + + return { + option={ script=ENV["SCRIPT_NAME"], + prefix=self.conf.prefix, + controller = self.conf.controller, + action = "edit", + extra = "", + }, + query = query, + } +end diff --git a/gnats-edit-html.lsp b/gnats-edit-html.lsp index 08dee18..8acbab7 100644 --- a/gnats-edit-html.lsp +++ b/gnats-edit-html.lsp @@ -25,6 +25,7 @@ displayinfo(myform,tags,"viewonly")
') local tags = { "filename", "filesize", "mtime", "sumerrors", } displayinfo(myform,tags,"viewonly") ?> diff --git a/gnats-editpr-html.lsp b/gnats-editpr-html.lsp new file mode 100644 index 0000000..28b39cf --- /dev/null +++ b/gnats-editpr-html.lsp @@ -0,0 +1,129 @@ + +DEBUGGING

DEBUG INFO: CFE

") +io.write(html.cfe_unpack(form)) +io.write("
") +--]] +?> + + 0) then + val.class = "error" + io.write(" class='error'") + end + io.write(">" .. val.label .. "") + io.write("\n\t\t
") + if (viewtype == "viewonly") then + if not (val.value) or (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("") + end + io.write("\n\t\t\t") + else + io.write(html.form[val.type](val)) + end + if (val.descr) and (#val.descr > 0) then io.write("\n\t\t

" .. string.gsub(val.descr, "\n", "
") .. "

") end + if (#val.errtxt > 0) then io.write("\n\t\t

" .. string.gsub(val.errtxt, "\n", "
") .. "

") end + io.write("\n\t\t
\n") + end + end +end +?> + +

+ +

Header

+
+ +
+ +

Details

+
+ +
+ + +

+
+ +
+ + + + + + +

+
+") + if (#v.label > 0) then + io.write("" .. (v.label or "Uknown") .. "") + end + for i=1,#v do + io.write("
" .. (v[i] or "Uknown") .. "
") + end + io.write("\n") +end +?> +
+ + +

+
+
+
+ + +

Save changes

+
+ +
+ + diff --git a/gnats-expert-html.lsp b/gnats-expert-html.lsp index da4ac15..a99d360 100644 --- a/gnats-expert-html.lsp +++ b/gnats-expert-html.lsp @@ -19,9 +19,7 @@ displayinfo(myform,tags,"viewonly") ?>
-

CONFIGURATION

-

Expert config

-

List of files

+

CONFIGURATION

0) then - return false, err + if (valid_filename(self,path)) then + local file_result,err = fs.write_file(path, format.dostounix(modifications)) + if (err) and (#err > 0) then + return false, err + end + return true + else + return false, "Not a valid filename!" end - return true, file_result + return false, "Something went wrong!" end function sendbug (self, message) diff --git a/gnats-queryeditpr-html.lsp b/gnats-queryeditpr-html.lsp new file mode 100644 index 0000000..dbde636 --- /dev/null +++ b/gnats-queryeditpr-html.lsp @@ -0,0 +1,56 @@ + +DEBUGGING

DEBUG INFO: CFE

") +io.write(html.cfe_unpack(form)) +io.write("
") +--]] +?> + + 0) then + val.class = "error" + io.write(" class='error'") + end + io.write(">" .. val.label .. "") + io.write("\n\t\t
") + 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("") + end + io.write("\n\t\t\t") + else + io.write(html.form[val.type](val)) + end + if (val.descr) and (#val.descr > 0) then io.write("\n\t\t

" .. string.gsub(val.descr, "\n", "
") .. "

") end + if (#val.errtxt > 0) then io.write("\n\t\t

" .. string.gsub(val.errtxt, "\n", "
") .. "

") end + io.write("\n\t\t
\n") + end + end +end +?> + +

Edit PR

+ + +
+ +
+ + diff --git a/gnats-status-html.lsp b/gnats-status-html.lsp index 1cf2963..b8ee333 100644 --- a/gnats-status-html.lsp +++ b/gnats-status-html.lsp @@ -16,10 +16,6 @@ local myform = form.status local tags = { "status", "version", } displayinfo(myform,tags,"viewonly") ?> - - -

PROGRAM SPECIFIC OPTIONS/INFORMATION

-

Current Alpine problem reports

-

The following is a listing of current problems submitted by Alpine users. These represent problem reports covering all versions including experimental development code and obsolete releases.

-
-

Bugs can be in one of several states (S)

+

Bugs can be in one of several states (S)

-
o - open
A problem report has been submitted, no sanity checking performed.
+
o - open
A problem report has been submitted, no sanity checking performed.
-
a - analyzed
The problem is understood and a solution is being sought.
+
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.
+
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.
+
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.
+
c - closed
A problem report is closed when any changes have been integrated, documented, and tested -- or when fixing the problem is abandoned.

SUMMARY

@@ -54,7 +52,6 @@ DL { padding-top: 5px; }
- @@ -65,7 +62,6 @@ DL { padding-top: 5px; } - diff --git a/gnats.menu b/gnats.menu index b9c5d6a..a275be5 100644 --- a/gnats.menu +++ b/gnats.menu @@ -4,5 +4,6 @@ Applications 98GNATS_bugreport Query query Applications 98GNATS_bugreport Report_a_BUG report #Applications 98GNATS_bugreport Statuslist summary #Applications 98GNATS_bugreport QueryResult queryresult +Applications 98GNATS_bugreport Edit_PR queryeditpr Applications 98GNATS_bugreport Configuration expert diff --git a/gnats.roles b/gnats.roles index abac913..1ef94e8 100644 --- a/gnats.roles +++ b/gnats.roles @@ -1 +1,3 @@ -READ=gnats:status,gnats:query,gnats:queryresult,gnats:summary,gnats:report +ALL=gnats:status,gnats:query,gnats:queryresult,gnats:summary,gnats:report,gnats:reportsuccess +CREATE=gnats:expert,gnats:edit,gnats:queryeditpr,gnats:editpr, + -- cgit v1.2.3
S Submitted SeverityCategory Description