summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gnats-controller.lua107
-rw-r--r--gnats-edit-html.lsp1
-rw-r--r--gnats-editpr-html.lsp129
-rw-r--r--gnats-expert-html.lsp4
-rw-r--r--gnats-model.lua29
-rw-r--r--gnats-queryeditpr-html.lsp56
-rw-r--r--gnats-status-html.lsp4
-rw-r--r--gnats-summary-html.lsp16
-rw-r--r--gnats.menu1
-rw-r--r--gnats.roles4
10 files changed, 301 insertions, 50 deletions
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")
<DL>
<?
local myform = form.file
+io.write('<input type="hidden" value="' .. myform.filename.value .. '" name="name">')
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 @@
+<? local form = ... ?>
+<?
+--[[ DEBUG INFORMATION
+io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
+io.write(html.cfe_unpack(form))
+io.write("</span>")
+--]]
+?>
+
+<?
+function displayinfo(myform,tags,viewtype)
+ for k,v in pairs(tags) do
+ if (myform[v]) and (myform[v]["value"]) then
+ local val = myform[v]
+ io.write("\n\t<DT")
+ if (#val.errtxt > 0) then
+ val.class = "error"
+ io.write(" class='error'")
+ end
+ io.write(">" .. val.label .. "</DT>")
+ io.write("\n\t\t<DD>")
+ if (viewtype == "viewonly") then
+ if not (val.value) or (val.value == "") then val.value = "&nbsp;" end
+ io.write(val.value)
+ elseif (val.type == "radio") and (type(val.option) == "table") and (#val.option > 0) then
+ io.write("<span style='display:inline' class='" .. ( val.class or "") .. "'>")
+ for k1,v1 in pairs(val.option) do
+ io.write("\n\t\t\t"..tostring(v1) .. ":")
+ io.write("<input style='margin-right:20px;margin-left:5px;' type='radio' class='" .. ( val.class or "") .. "' name='" .. val.name .. "'")
+ if (tostring(val.value) == tostring(v1)) then io.write(" checked='yes'") end
+ io.write(" value='" .. v1 .. "'>")
+ end
+ io.write("\n\t\t\t</input></span>")
+ else
+ io.write(html.form[val.type](val))
+ end
+ if (val.descr) and (#val.descr > 0) then io.write("\n\t\t<P CLASS='descr'>" .. string.gsub(val.descr, "\n", "<BR>") .. "</P>") end
+ if (#val.errtxt > 0) then io.write("\n\t\t<P CLASS='error'>" .. string.gsub(val.errtxt, "\n", "<BR>") .. "</P>") end
+ io.write("\n\t\t</DD>\n")
+ end
+ end
+end
+?>
+
+<H1><? io.write(form["query"]["sfields"]["category"]["value"] .. "/")
+io.write(form["query"]["sfields"]["number"]["value"] .. ": " )
+io.write(form["query"]["sfields"]["synopsis"]["value"] or form["query"]["header"]["subject"]["value"] or "Qurery object")?></H1>
+
+<H2>Header</H2>
+<DL>
+<?
+local myform = form.query.header
+local tags = { "from","date", "subject", }
+displayinfo(myform,tags)
+?>
+</DL>
+
+<H2>Details</H2>
+<DL>
+<?
+local myform = form.query.sfields
+local tags = { "submitter_id", "class", "release", "state", "priority", "severity", "responsible", "arrival_date", "closed_date", "last_modified", "originator", }
+displayinfo(myform,tags)
+?>
+</DL>
+
+<?
+local myform = form.query.mfields
+local tags = {"organization", "environment", "description", "how_to_repeat", "fix", "release_note", }
+for k,v in pairs(tags) do
+ local myform=myform[v]
+?>
+<H2><? io.write(myform.label) ?></H2>
+<DL>
+<? io.write(html.form[myform.type](myform)) ?>
+</DL>
+<? end ?>
+
+
+<style>
+table {margin:10px;margin-top:5px;border:1px solid #aaa;background:#eee;}
+.Responsible-Changed-From-To {background: #fcc;}
+.Responsible-Changed-From-To {background: #fcc;}
+.State-Changed-From-To {background: #cfc;}
+.From {background: #ccf;}
+.Header {padding:3px;font-weight:bold;border-bottom:1px solid #665;}
+</style>
+
+<?
+local myform = form.query["mfields"]["audit_trail"]
+?>
+<H2><? io.write(myform.label) ?></H2>
+<DL>
+<?
+for k,v in pairs(myform.option) do
+ io.write("\n<TABLE STYLE='width:98%;'>")
+ if (#v.label > 0) then
+ io.write("<TR CLASS='" .. (v.class or "") .. "'><TD COLSPAN=2 CLASS='Header'>" .. (v.label or "Uknown") .. "</TD></TR>")
+ end
+ for i=1,#v do
+ io.write("<TR><TD WIDTH='100%'><PRE>" .. (v[i] or "Uknown") .. "</PRE></TD></TR>")
+ end
+ io.write("\n</TABLE>")
+end
+?>
+</DL>
+
+<?
+local myform = form.query.mfields
+local tags = {"unformatted", }
+for k,v in pairs(tags) do
+ local myform=myform[v]
+?>
+<H2><? io.write(myform.label) ?></H2>
+<DL>
+<PRE><? io.write(myform.value) ?></PRE>
+</DL>
+<? end ?>
+
+<H2>Save changes</H2>
+<DL>
+<?
+local myform = form.query
+local tags = { "cmdsave", }
+displayinfo(myform,tags)
+?>
+</DL>
+
+
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")
?>
</DL>
-<h1>CONFIGURATION</h1>
-<h2>Expert config</h2>
-<h3>List of files</h3>
+<h2>CONFIGURATION</h2>
<DL>
<TABLE>
<?
diff --git a/gnats-model.lua b/gnats-model.lua
index 28b9d9e..a39090c 100644
--- a/gnats-model.lua
+++ b/gnats-model.lua
@@ -7,9 +7,7 @@ require("date")
require("getopts")
require("format")
require("posix")
-require("daemoncontrol")
require("validator")
-require("socket")
require("processinfo")
-- Set variables
@@ -304,14 +302,6 @@ end
-- ################################################################################
-- PUBLIC FUNCTIONS
-function startstop_service ( self, action )
- local cmd = action.value
- local cmdresult,cmdmessage,cmderror,cmdaction = daemoncontrol.daemoncontrol(processname, cmd)
- action.descr=cmdmessage
- action.errtxt=cmderror
- return cmdresult,action
-end
-
function valid_filename(self, path)
local files = {}
recursedir(baseurl,files)
@@ -344,7 +334,7 @@ function getstatus()
status.configfiles.size = #status.configfiles.option
status.numbugs = cfe({ name="numbugs",
- label="Still not closed reports",
+ label="Number of open reports",
value=get_various_info(),
})
@@ -451,14 +441,19 @@ function get_filedetails(self,path)
return true, file
end
function update_filecontent (self, modifications,path)
- if not (valid_filename(self,path)) then
- return false, {['errtxt'] = "Not a valid filename!"}
+ if not (fs.is_file(path)) then
+ return false, "Not a filename"
end
- local file_result,err = fs.write_file(path, format.dostounix(modifications))
- if (err) and (#err > 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 @@
+<? local form = ... ?>
+<?
+--[[ DEBUG INFORMATION
+io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
+io.write(html.cfe_unpack(form))
+io.write("</span>")
+--]]
+?>
+
+<?
+function displayinfo(myform,tags,viewtype)
+ for k,v in pairs(tags) do
+ if (myform[v]) and (myform[v]["value"]) then
+ local val = myform[v]
+ io.write("\n\t<DT")
+ if (#val.errtxt > 0) then
+ val.class = "error"
+ io.write(" class='error'")
+ end
+ io.write(">" .. val.label .. "</DT>")
+ io.write("\n\t\t<DD>")
+ if (viewtype == "viewonly") then
+ if (val.value == "") then val.value = "&nbsp;" end
+ io.write(val.value)
+ elseif (val.type == "radio") and (type(val.option) == "table") and (#val.option > 0) then
+ io.write("<span style='display:inline' class='" .. ( val.class or "") .. "'>")
+ for k1,v1 in pairs(val.option) do
+ io.write("\n\t\t\t"..tostring(v1) .. ":")
+ io.write("<input style='margin-right:20px;margin-left:5px;' type='radio' class='" .. ( val.class or "") .. "' name='" .. val.name .. "'")
+ if (tostring(val.value) == tostring(v1)) then io.write(" checked='yes'") end
+ io.write(" value='" .. v1 .. "'>")
+ end
+ io.write("\n\t\t\t</input></span>")
+ else
+ io.write(html.form[val.type](val))
+ end
+ if (val.descr) and (#val.descr > 0) then io.write("\n\t\t<P CLASS='descr'>" .. string.gsub(val.descr, "\n", "<BR>") .. "</P>") end
+ if (#val.errtxt > 0) then io.write("\n\t\t<P CLASS='error'>" .. string.gsub(val.errtxt, "\n", "<BR>") .. "</P>") end
+ io.write("\n\t\t</DD>\n")
+ end
+ end
+end
+?>
+
+<H1>Edit PR</H1>
+
+<form name="cmd" action="editpr" method="POST">
+<DL>
+<?
+local myform = form.query
+local tags = { "pr","pr_cmd", }
+displayinfo(myform,tags)
+?>
+</DL>
+</form>
+
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")
?>
-</DL>
-
-<H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2>
-<DL>
<?
local myform = form.status
local tags = { "numbugs", }
diff --git a/gnats-summary-html.lsp b/gnats-summary-html.lsp
index 93f5ec6..c70d1f1 100644
--- a/gnats-summary-html.lsp
+++ b/gnats-summary-html.lsp
@@ -26,25 +26,23 @@ DL { padding-top: 5px; }
</style>
<h1>Current Alpine problem reports</h1>
-<p>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. </p>
-<BR>
-<h3>Bugs can be in one of several states (S)</h3>
+<h2>Bugs can be in one of several states (S)</h2>
<DL>
-<DT class='o' WIDTH='300px'>o - open</DT><DD STYLE='border-top:1px solid #bbb;'>A problem report has been submitted, no sanity checking performed.</DD>
+<DT class='o' WIDTH='300px'>o - open</DT><DD>A problem report has been submitted, no sanity checking performed.</DD>
</DL>
<DL>
-<DT class='a'>a - analyzed</DT><DD STYLE='border-top:1px solid #bbb;'>The problem is understood and a solution is being sought.</DD>
+<DT class='a'>a - analyzed</DT><DD>The problem is understood and a solution is being sought.</DD>
</DL>
<DL>
-<DT class='f'>f - feedback</DT><DD STYLE='border-top:1px solid #bbb;'>Further work requires additional information from the originator or the community - possibly confirmation of the effectiveness of a proposed solution.</DD>
+<DT class='f'>f - feedback</DT><DD>Further work requires additional information from the originator or the community - possibly confirmation of the effectiveness of a proposed solution.</DD>
</DL>
<DL>
-<DT class='s'>s - suspended</DT><DD STYLE='border-top:1px solid #bbb;'>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.</DD>
+<DT class='s'>s - suspended</DT><DD>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.</DD>
</DL>
<DL>
-<DT class='c'>c - closed</DT><DD STYLE='border-top:1px solid #bbb;'>A problem report is closed when any changes have been integrated, documented, and tested -- or when fixing the problem is abandoned.</DD>
+<DT class='c'>c - closed</DT><DD>A problem report is closed when any changes have been integrated, documented, and tested -- or when fixing the problem is abandoned.</DD>
</DL>
<H1>SUMMARY</H1>
@@ -54,7 +52,6 @@ DL { padding-top: 5px; }
<th>S</th>
<th>Submitted</th>
<th>Severity</th>
- <th>Category</th>
<th>Description</th>
</tr>
@@ -65,7 +62,6 @@ DL { padding-top: 5px; }
<td width='15px'><? io.write(string.sub(v.state,1,1) or "") ?></td>
<td width='80px'><? io.write(v.submit_date or "") ?></td>
<td width='80px'><? io.write(v.severity or "")?></td>
- <td width='80px'><? io.write(v.category or "") ?></td>
<td style='white-space:normal;word-wrap:break-word'><? io.write(v.synopsis) ?></td>
</tr>
<? end ?>
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,
+