summaryrefslogtreecommitdiffstats
path: root/gnats-queryresult-html.lsp
blob: 628043ad8f8e1c9ef99366f5c54f871495262ff4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<% local form = ... %>
<%
--[[
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(form))
io.write("</span>")
--]]
if form.query ~= nil then

%>

<%
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) then 
				val.class = "error"
				io.write(" class='error'")
			end
			io.write(">" .. html.html_escape(val.label) .. "</DT>")
			io.write("\n\t\t<DD>")
			if (viewtype == "viewonly") then
				if not (val.value) or (val.value == "") then val.value = " " end
				io.write(html.html_escape(val.value))
			elseif (val.type == "radio") and (type(val.option) == "table") and (#val.option > 0) then
				io.write("<span style='display:inline' class='" .. html.html_escape(val.class) .. "'>")
				for k1,v1 in pairs(val.option) do
					io.write("\n\t\t\t"..html.html_escape(tostring(v1)) .. ":")
					io.write("<input style='margin-right:20px;margin-left:5px;' type='radio' class='" .. html.html_escape(val.class) .. "' name='" .. html.html_escape(val.name) .. "'")
					if (tostring(val.value) == tostring(v1)) then io.write(" checked='yes'") end
					io.write(" value='" .. html.html_escape(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(html.html_escape(val.descr), "\n", "<BR>") .. "</P>") end
			if (val.errtxt) then io.write("\n\t\t<P CLASS='error'>" .. string.gsub(html.html_escape(val.errtxt), "\n", "<BR>") .. "</P>") end
			io.write("\n\t\t</DD>\n")
		end
	end
end
%>

<H1><% io.write(html.html_escape(form["query"]["sfields"]["category"]["value"] .. "/"))
io.write(html.html_escape(form["query"]["sfields"]["number"]["value"] .. ": " )) 
io.write(html.html_escape(form["query"]["sfields"]["synopsis"]["value"] or form["query"]["header"]["subject"]["value"] or "Qurery object"))%></H1>

<DL>
<% 
local myform = form.query.header 
local tags = { "from","date", }
displayinfo(myform,tags,"viewonly")
%>
</DL>

<H2>Details</H2>
<DL>
<% 
local myform = form.query.sfields 
local tags = { "class", "release", "state", "priority", "severity", "responsible", }
displayinfo(myform,tags,"viewonly")
%>
</DL>

<%
local myform = form.query.mfields
local tags = {"environment", "description", "how_to_repeat", "fix", }
for k,v in pairs(tags) do
	local myform=myform[v]
%>
<H2><%= html.html_escape(myform.label) %></H2>
<DL>
<PRE><%= html.html_escape(myform.value) %></PRE>
</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><%= html.html_escape(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='" .. html.html_escape(v.class) .. "'><TD COLSPAN=2 CLASS='Header'>" .. html.html_escape(v.label or "Uknown") .. "</TD></TR>")
	end
	for i=1,#v do
		io.write("<TR><TD WIDTH='100%'><PRE>" .. html.html_escape(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><%= html.html_escape(myform.label) %></H2>
<DL>
<PRE><%= html.html_escape(myform.value) %></PRE>
</DL>
<% end %>

<% 
elseif (form.summary) then

-- -----------------------------------------------------------------------
-- Summary
-- -----------------------------------------------------------------------

require("viewfunctions")
%>

<style>
table { margin:10px; border:2px solid #555; }
table th { border-bottom:2px solid #555; font-weight: bold; }
table td {border:1px solid #aaa; border-right:none; border-bottom:none; }
.o { background-color: #fff; padding-bottom: 0px; }
.a { background-color: #cffafd; padding-bottom: 0px; }
.f { background-color: #ffc; padding-bottom: 0px; }
.p { background-color: #d1fbd6; padding-bottom: 0px; }
.r { background-color: #d6cfc4; padding-bottom: 0px; }
.s { background-color: #fcccd9; padding-bottom: 0px; }
.c { background-color: #fff; padding-bottom: 0px; color: #888;}
.header {padding:3px;font-weight:bold;border-bottom:1px solid #665;}
DT {border:1px solid #aaa; width: 40px;}
DL { padding-top: 5px; }
</style>

<h1>Current Alpine problem reports</h1>

<h2>Bugs can be in one of several states (S)</h2>

<DL>
<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>The problem is understood and a solution is being sought.</DD>
</DL>
<DL>
<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>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>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>
<table style='width:98%;'>
  <tr class='header'>
	<th>ID</th>
	<th>S</th>
	<th>Submitted</th>
	<th>Severity</th>
	<th>Description</th>
  </tr>

<% for k,v in pairs(form.summary) do %>

  <tr class='<%= html.html_escape(string.sub(v.state,1,1)) %>'>
	<td width='30px'><A HREF='queryresult?pr=<%= html.html_escape(v.number) %>' STYLE='font-weight:bold;'><%= html.html_escape(v.number) %></A></td>
	<td width='15px'><%= html.html_escape(string.sub(v.state,1,1)) %></td>
	<td width='80px'><%= html.html_escape(v.submit_date) %></td>
	<td width='80px'><%= html.html_escape(v.severity) %></td>
	<td style='white-space:normal;word-wrap:break-word'><%= html.html_escape(v.synopsis) %></td>
  </tr>
<% end %>

</table>

<% end %>