-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.rsp
284 lines (273 loc) · 7.11 KB
/
index.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
<%
err?: denied?: no
fLogin: fPass: ""
sess: session/content
if all [
not sess/login?
none? validate/full [action word! *]
'identify = request/content/action
][
either invalid: validate/full [
login - *
pass - *
][
err?: yes
][
either block? res: identify-user request/content [
sess/user-id: first res
sess/user-name: request/content/login
sess/user-role: to-word second res
sess/prefs: get-user-prefs sess/user-id
sess/login?: yes
if sess/prefs/my-filter [sess/query: copy sess/prefs/my-filter]
sess/project-id: sess/prefs/my-project
response/redirect "view-tickets.rsp"
][
denied?: res
]
]
fLogin: any [request/content/login fLogin]
fPass: any [request/content/pass fPass]
]
title: say "Main"
include %head.rsp
either sess/login? [
stats: get-stats-by 'status
prj: get-project sess/project-id
total: 0
foreach [s n] stats [total: total + to integer! n]
%>
<div align="center" style="margin-bottom:40px;">
<h2>#[Project] : <%=prj/1%></h2>
<table>
<tr>
<td style="padding-right: 60px">
<table class="list-stats">
<tr>
<th>#[Description]</th>
<td height="40"><%=activate-links pre-encode html-encode say any [prj/2 ""]%></td>
</tr><tr>
<th>#[Visibility]</th>
<td><%=pick ["private" "public"] to logic! prj/3%></td>
</tr>
<%if prj/3 <> 1 [%>
<tr>
<th>#[External link]</th>
<td><a href="http://<%=
rejoin [
request/headers/Host
either request/server-port = 80 [""][join ":" request/server-port]
request/web-app
"/project.rsp?id="
session/content/project-id
]
%>"><%=prj/1%></a>
</td>
</tr><tr>
<th>#[Total]</th>
<td><%=mold total%> #[ticket(s)]</td>
</tr>
<%]%>
</table>
</td><td class="cols"><%
chart-url: http://chart.apis.google.com/chart?
repeat c divide length? stats 2 [
change at stats c * 2 to integer! pick stats c * 2
]
total: 0 foreach [s n] stats [total: total + n]
list: reduce [
copy "Open"
stats/("submitted")
+ stats/("reviewed")
+ stats/("pending")
+ stats/("built")
copy "Waiting"
stats/("problem")
+ stats/("waiting")
+ stats/("deferred")
copy "Closed"
stats/("dismissed")
+ stats/("tested")
+ stats/("complete")
]
repeat c 3 [append list/(c * 2 - 1) rejoin [" (" list/(c * 2) ")"]]
chart: join chart-url [
"chtt=" utf8-encode say "Tickets Overview"
"&chs=295x180"
"&chd=t:" chart-form/with extract/index list 2 2 #"," total
"&chco=ff9700,4e71bc,429120"
"&cht=p"
"&chp=-1.57"
"&chl=" chart-form extract list 2 #"|"
]
%><img src="<%=chart%>">
</td>
</tr>
</table>
</div>
<div align="center" style="margin-bottom:40px;">
<table align="center">
<tr>
<td style="text-align:right">
<%
stock: prepare-monthly-stockpile
chart: join chart-url [
"chtt=" utf8-encode say "Stockpile (6 months)"
"&chs=400x180"
"&chd=t:" chart-form stock/2 #","
"&chds=0," stock/3
"&chxr=0,0," stock/3 #"," stock/4
"&chxt=y"
"&chbh=50"
"&chco=ffc850"
"&cht=bvg"
"&chl=" chart-form stock/1 #"|"
]
%><img src="<%=chart%>">
</td>
<td style="text-align:left">
<%
stock: prepare-stockpile get-stockpile-evo
chart: join chart-url [
"chtt=" utf8-encode say "Stockpile evolution (6 months)"
"&chs=434x180"
"&chd=t2:" chart-form stock/2 #","
"|" chart-form stock/3 #","
"&chdl=New|Closed"
"&chds=0," stock/4 ",0," stock/4
"&chxr=0,0," stock/4 #"," stock/5
"&chxt=y"
"&chco=ffa0a0,cceedd"
"&cht=bvg"
"&chl=" chart-form stock/1 #"|"
]
%><img src="<%=chart%>">
</td>
</tr>
</table>
</div>
<div align="center">
<table align="center" class="stats-cols">
<tr>
<td class="cols"><%
total: 0 foreach [s n] stats [total: total + n]
foreach s ["complete" "tested" "dismissed"][remove/part find stats s 2]
data: chart-form-full
extract/index stats 2 2
["ffa0a0," "ffd850," "C0C0FF," "C0C0FF," "C0C0FF," "cceedd," "8fbaa4,"]
extract stats 2
total
chart: join chart-url [
"chtt=" utf8-encode say "Open and Waiting By Status"
"&chs=268x180"
"&chd=t:" data/1
"&chco=" data/2
"&cht=p"
"&chp=-1.57"
"&chl=" data/3
]
%><img src="<%=chart%>">
</td>
<td class="cols"><%
priorities: get-stats-by 'priority
total: 0 foreach [s n] priorities [total: total + to integer! n]
data: chart-form-full
extract/index priorities 2 2
["ffa0a0," "ff8060," "ffb850," "ffd850," "ffe860,"]
extract priorities 2
total
chart: join chart-url [
"chtt=" utf8-encode say "All by Priority"
"&chs=268x180"
"&chd=t:" data/1
"&chco=" data/2
"&cht=p"
"&chp=2.356"
"&chl=" data/3
]
%><img src="<%=chart%>">
</td>
<td class="cols"><%
severities: get-stats-by 'severity
total: 0 foreach [s n] priorities [total: total + to integer! n]
data: chart-form-full
extract/index severities 2 2
["ff3030," "ff6060," "ff8060," "ffb850," "ffc850," "ffd850," "ffd8a0," "c0c0c0,"]
extract severities 2
total
chart: join chart-url [
"chtt=" utf8-encode say "All by Severity"
"&chs=268x180"
"&chd=t:" data/1
"&chco=" data/2
"&cht=p"
"&chp=2.356"
"&chl=" data/3
]
%><img src="<%=chart%>">
</td>
</tr><tr>
<td class="cols">
<table align="center" class="list-stats">
<%foreach [s n] stats [%>
<tr><th><%=uppercase/part say s 1%></th><td><%=n%></td></tr>
<%]%>
</table>
</td>
<td class="cols">
<table align="center" class="list-stats">
<%foreach [s n] priorities [%>
<tr><th><%=uppercase/part say s 1%></th><td><%=n%></td></tr>
<%]%>
</table>
</td>
<td class="cols">
<table align="center" class="list-stats">
<%foreach [s n] severities [%>
<tr><th><%=uppercase/part say s 1%></th><td><%=n%></td></tr>
<%]%>
</table>
</td>
</tr>
</table>
</div>
<%][%>
<br><br><br>
<div align="center">
<a href="register.rsp">#[Register a new account]</a>
| <a href="reset-pass.rsp">#[Reset your password]</a>
</div>
<div align="center" style="height:400px;">
<br>
<form method="POST" action="index.rsp">
<%if err? [%>
<font color="red"><b>#[Error: Missing fields or incorrect values]</b></font>
<%]%>
<%if denied? [%>
<font color="red"><b>#[Error]: <%=denied?%></b></font>
<%]%>
<table style="padding:4px;">
<tr>
<th align="right">#[User ID]</th>
<td <% if err? [mark/error 'login] %>>
<input type="text" id="login" name="login" <%if not empty? fLogin [%>value="<%=fLogin%>"<%]%>>
</td>
</tr>
<tr>
<th align="right">#[Password]</th>
<td <% if err? [mark/error 'pass] %>>
<input type="password" id="pass" name="pass" <%if not empty? fPass [%>value="<%=fPass%>"<%]%>>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value="#[Login]" style="margin-top:10px">
</td>
</tr>
</table>
<input type="hidden" name="action" value="identify">
</form>
</div>
<%]%>
<%include-file %footer.inc%>