-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathview-tickets.rsp
290 lines (281 loc) · 9.17 KB
/
view-tickets.rsp
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<%
params: session/content/query
rc: request/content
invalid?: validate [orderby integer!]
order: any [
all [
not invalid?
rc/orderby
]
all [
params
params/orderby
]
8 ; default : order by "last-update"
]
validate [
page integer!
action word!
]
if all [params rc/action = 'navigate][params/page: rc/page] ; force page in saved query
if any [
not params ; no saved query ?
rc/action = 'search
][
validate [
preset string!
filter integer!
text string!
fields integer!
tid integer!
user integer!
status integer!
hstatus integer!
type integer!
severity integer!
priority integer!
version integer!
fixedin integer!
cat integer!
resolv integer!
results integer!
find string!
apply string!
]
params: request/content
if all [
params/find
params/tid
check-ticket-id params/tid
][
response/redirect join "ticket.rsp?id=" params/tid
]
;-- workaround "preset" not being a button
if any [params/find params/apply][params/preset: none]
if none? params/results [params/results: 25]
params/page: 1
session/content/query: params
]
params/orderby: order
request/content: params ;-- needed for 'mark function (TBD: refactor 'mark func)
count: select-tickets/count params
count: to-integer count/1/1
params/page: max 1 min params/page ceil count / params/results
tickets: select-tickets params
order: params/orderby
title: say "Tickets List"
include %head.rsp
%>
<script type="text/javascript">
var filters = ['preset-filters', 'search-filters', 'detail-filters'];
var fields = ['type', 'severity', 'status', 'hstatus', 'priority', 'results'];
function ShowFilters(index) {
var i;
for(i = 0; i < filters.length; i++) {
document.getElementById(filters[i]).style.visibility = (i == index ? 'visible':'hidden');
}
if (index == 0 && 0 == <%=pick [1 0] to-logic params/preset%>)
doFilter(document.getElementsByName('filter')[0].selectedIndex);
}
function doFilter(index) {
var f = document.getElementById('list');
f.preset.value='search';
f.submit();
}
function ResetDetailFilters() {
for (var f in fields) document.getElementsByName(fields[f])[0].selectedIndex = 0;
}
</script>
<table width="100%">
<tr>
<td align="left">
<form method="POST" id="list" action="view-tickets.rsp">
<input type="hidden" name="preset" value="<%=any [params/preset ""]%>">
<div id="filters">
<table id="preset-filters">
<tr>
<th align="left">#[Filter]</th>
</tr><tr>
<td colspan="6">
<select name="filter" onchange="doFilter(this.value);">
<%foreach [id label] enum-filters [
%><option value="<%=id%>" <%mark/selected id 'filter 0%>><%=say label%></option>
<%]%>
</select>
</td>
</tr>
</table>
<table id="search-filters">
<tr>
<th align="left">#[Keyword(s)]</th>
<th align="left">#[Fields]</th>
<th align="left"></th>
<th align="left" style="padding-left:8px">#[Ticket ID]</th>
</tr><tr>
<td><input type="text" name="text" value="<%=any [params/text ""]%>" size="30"></td>
<td>
<select name="fields">
<option value="2" <%mark/selected 2 'fields 2%>>#[Summary]</option>
<option value="3" <%mark/selected 3 'fields 2%>>#[Description]</option>
<option value="4" <%mark/selected 4 'fields 2%>>#[Comments]</option>
<option value="5" <%mark/selected 5 'fields 2%>>#[User]</option>
<option value="1" <%mark/selected 1 'fields 2%>><#[All]> (slow)</option>
<option disabled>----------</option>
<option value="6" <%mark/selected 6 'fields 2%>>#[Commented by]</option>
</select>
</td>
<td style="padding-left:8px">#[or]</td>
<td style="padding-left:8px"><input type="text" name="tid" value="" size="8"></td>
<td style="padding-left:8px"><input type="submit" name="find" value="#[Find]"></td>
</tr>
</table>
<table id="detail-filters">
<tr>
<th class="center">#[Type]</th>
<%if cat?: all [
session/content/project-id > 1
not empty? list-cat: enum-categories
][
%>
<th class="center">#[Category]</th>
<%]%>
<th class="center">#[Severity]</th>
<th class="center">#[Status]</th>
<th class="center">#[Hide status]</th>
<th class="center">#[Priority]</th>
<th class="center">#[Results]</th>
<th style="width:200px;"></th>
</tr><tr>
<td>
<select name="type">
<option value="0">[#[any]]</option>
<%foreach [id label] enum-types [
%><option value="<%=id%>" <%mark/selected id 'type 0%>><%=say label%></option><%
]%></select>
</td>
<%if cat? [%>
<td>
<select name="cat">
<option value="0">[#[any]]</option>
<%foreach [id label] list-cat [
%><option value="<%=id%>" <%mark/selected id 'cat 0%>><%=label%></option><%
]%></select>
</td>
<%]%>
<td>
<select name="severity">
<option value="0">[#[any]]</option>
<%foreach [id label] enum-severities [
%><option value="<%=id%>" <%mark/selected id 'severity 0%>><%=say label%></option><%
]%></select>
</td><td>
<select name="status">
<option value="0">[#[any]]</option>
<%foreach [id label] enum-statuses [
%><option value="<%=id%>" <%mark/selected id 'status 0%>><%=say label%></option>
<%]%></select>
</td><td>
<select name="hstatus">
<option value="0">[#[none]]</option>
<%foreach [id label] enum-statuses [
%><option value="<%=id%>" <%mark/selected id 'hstatus 0%>><%=say label%></option>
<%]%></select>
</td><td>
<select name="priority">
<option value="0">[#[any]]</option>
<%foreach [id label] enum-priorities [
%><option value="<%=id%>" <%mark/selected id 'priority 0%>><%=say label%></option>
<%]%>
</select>
</td><td>
<select name="results">
<%n: 25 loop 4 [
%><option value="<%=n%>" <%mark/selected n 'results 0%>><%=n%></option><%
n: n * 2
]%>
</select>
</td><td style="white-space:nowrap;">
<input type="button" name="apply" value="#[Reset]" onclick="ResetDetailFilters();">
<input type="submit" name="apply" value="#[Apply]">
</td>
</tr>
</table>
</div>
<input type="hidden" name="action" value="search">
<input type="hidden" name="page" value="<%=any [params/page 1]%>">
</form>
</td><td align="right">
<b>#[Filters Type]:</b>
<a href="javascript:ShowFilters(0);">#[Preset]</a> |
<a href="javascript:ShowFilters(1);">#[Search]</a> |
<a href="javascript:ShowFilters(2);">#[Detail]</a>
</td>
</tr>
</table>
<br><br>
<div id="filter-box">
<%either empty? tickets [%>
<br><center>#[No ticket found]</center>
<%][
include %navigate-results.rsp
show?: not params/preset
%>
<%=count%> <%=say pick ["tickets found" "ticket found"] count > 1%>
<div style="position:absolute;top:190px;right:10px;text-align:right;">
<a href="feed.rsp?prj=<%=session/content/project-id%>"><img src="img/rss.gif" border="0" alt="rss"></a><br>
</div>
<table class="tickets">
<tr>
<th width="50"><% coltitle 1 show? "ID" %></th>
<th width="20"><% coltitle 2 show? "#" %></th>
<th width="60"><% coltitle 3 show? "Type" %></th>
<th width="70"><% coltitle 4 show? "Severity" %></th>
<th width="70"><% coltitle 5 show? "Status" %></th>
<th width="60"><% coltitle 6 show? "Priority" %></th>
<th width="60"><% coltitle 7 show? "User" %></th>
<th width="80"><% coltitle 8 show? "Updated" %></th>
<th align="left"><%coltitle 9 show? "Summary" %></th>
</tr><%
line: 1
dev?: to-logic find [admin developer] session/content/user-role
forall tickets [
ticket: tickets/1
c: (params/page - 1 * params/results) + index? tickets
%><tr class="bg<%=ticket/8%>">
<td align="center">
<a href="<%=pick ["edit-" ""] dev?%>ticket.rsp?id=<%=ticket/1%>&cursor=<%=c%>"><%=zeropad ticket/1 7%></a>
</td>
<td align="center"><%=any [all [zero? any [ticket/2 0] " "] ticket/2]%></td>
<td align="center"><%=say ticket/3%></td>
<td align="center" class="mark-<%= pick ["high" "low"] ticket/9 > 5%>"><%=say ticket/4%></td>
<td align="center"><%=say ticket/5%></td>
<td align="center"><%=say ticket/10%></td>
<td align="center"><%=ticket/11%></td>
<td align="center"><%=ticket/6/date%><br><%=form-time ticket/6/time%></td>
<td><%=ticket/7%></td>
</tr>
<%]%>
</table>
<%include %navigate-results.rsp%>
<br><br>
<div>
<table class="colors">
<tr>
<td bgcolor="#ffa0a0">#[submitted]</td>
<td bgcolor="#ffd850">#[reviewed]</td>
<td bgcolor="#C0C0FF">#[problem]</td>
<td bgcolor="#C0C0FF">#[waiting]</td>
<td bgcolor="#C0C0FF">#[deferred]</td>
<td bgcolor="#c0c0c0">#[dismissed]</td>
<td bgcolor="#ffd850">#[pending]</td>
<td bgcolor="#cceedd">#[built]</td>
<td bgcolor="#8fbaa4">#[tested]</td>
<td bgcolor="#c0c0c0">#[complete]</td>
</tr>
</table>
</div>
<%]%>
</div>
<script type="text/javascript" >ShowFilters(<%=any [all [params/find 1] all [params/apply 2] 0]%>);</script>
<%include-file %footer.inc%>