rev |
line source |
bsw/jbe@0
|
1 local areas_selector = param.get("areas_selector", "table")
|
bsw/jbe@0
|
2
|
bsw@9
|
3 areas_selector
|
bsw@9
|
4 :reset_fields()
|
bsw@9
|
5 :add_field("area.id", nil, { "grouped" })
|
bsw@9
|
6 :add_field("area.name", nil, { "grouped" })
|
bsw@9
|
7 :add_field("member_weight", nil, { "grouped" })
|
bsw@9
|
8 :add_field("direct_member_count", nil, { "grouped" })
|
bsw@9
|
9 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted ISNULL AND issue.closed ISNULL)", "issues_new_count")
|
bsw@9
|
10 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL)", "issues_discussion_count")
|
bsw@9
|
11 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL AND issue.closed ISNULL)", "issues_frozen_count")
|
bsw@9
|
12 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL)", "issues_voting_count")
|
bsw@10
|
13 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed NOTNULL)", "issues_finished_count")
|
bsw@10
|
14 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen ISNULL AND issue.closed NOTNULL)", "issues_cancelled_count")
|
bsw@51
|
15
|
bsw@51
|
16 if app.session.member_id then
|
bsw@51
|
17 areas_selector
|
bsw@51
|
18 :add_field({ "(SELECT COUNT(*) FROM issue LEFT JOIN direct_voter ON direct_voter.issue_id = issue.id AND direct_voter.member_id = ? WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL AND direct_voter.member_id ISNULL)", app.session.member.id }, "issues_to_vote_count")
|
bsw@51
|
19 :left_join("membership", "_membership", { "_membership.area_id = area.id AND _membership.member_id = ?", app.session.member.id })
|
bsw@51
|
20 :add_field("_membership.member_id NOTNULL", "is_member", { "grouped" })
|
mail@240
|
21 :add_field({ "(SELECT member.name FROM delegation LEFT JOIN member ON delegation.trustee_id = member.id WHERE delegation.scope = 'area' AND delegation.area_id = area.id AND truster_id = ?)", app.session.member.id }, "area_delegation_name")
|
bsw@51
|
22 else
|
bsw@51
|
23 areas_selector:add_field("0", "issues_to_vote_count")
|
bsw@51
|
24 end
|
bsw@9
|
25
|
bsw/jbe@19
|
26 local label_attr = { style = "text-align: right; width: 4em;" }
|
bsw/jbe@19
|
27 local field_attr = { style = "text-align: right; width: 4em;" }
|
bsw/jbe@19
|
28
|
bsw@269
|
29 ui.list{
|
bsw@269
|
30 attr = { class = "area_list" },
|
bsw@269
|
31 records = areas_selector:exec(),
|
bsw@269
|
32 columns = {
|
bsw@269
|
33 {
|
bsw@269
|
34 content = function(record)
|
bsw@269
|
35 if record.is_member then
|
bsw@269
|
36 local text = _"Member of area"
|
bsw@269
|
37 ui.image{
|
bsw@269
|
38 attr = { title = text, alt = text, style = "vertical-align: middle;" },
|
bsw@269
|
39 static = "icons/16/user_gray.png",
|
bsw@269
|
40 }
|
bsw@269
|
41 end
|
bsw@269
|
42 end
|
bsw@269
|
43 },
|
bsw/jbe@0
|
44 {
|
bsw@269
|
45 content = function(record)
|
bsw@269
|
46 if record.area_delegation_name then
|
bsw@269
|
47 local text = _("Area delegated to '#{name}'", { name = record.area_delegation_name })
|
bsw@269
|
48 ui.image{
|
bsw@269
|
49 attr = { title = text, alt = text, style = "vertical-align: middle;" },
|
bsw@269
|
50 static = "icons/16/link.png",
|
bsw@269
|
51 }
|
bsw@269
|
52 end
|
bsw@269
|
53 end
|
bsw@269
|
54 },
|
bsw@269
|
55 {
|
bsw@269
|
56 content = function(record)
|
bsw@269
|
57 if record.member_weight and record.direct_member_count then
|
bsw@269
|
58 local max_value = MemberCount:get()
|
bsw@269
|
59 ui.bargraph{
|
bsw@269
|
60 max_value = max_value,
|
bsw@269
|
61 width = 100,
|
bsw@269
|
62 bars = {
|
bsw@269
|
63 { color = "#444", value = record.direct_member_count },
|
bsw@269
|
64 { color = "#777", value = record.member_weight - record.direct_member_count },
|
bsw@269
|
65 { color = "#ddd", value = max_value - record.member_weight },
|
bsw@269
|
66 }
|
bsw@269
|
67 }
|
bsw@269
|
68 end
|
bsw@269
|
69 end
|
bsw/jbe@0
|
70 },
|
bsw/jbe@0
|
71 {
|
bsw@269
|
72 content = function(record)
|
bsw@269
|
73 ui.link{
|
bsw@269
|
74 text = record.name,
|
bsw@269
|
75 module = "area",
|
bsw@269
|
76 view = "show",
|
bsw@269
|
77 id = record.id
|
bsw@269
|
78 }
|
bsw@269
|
79 end
|
bsw/jbe@0
|
80 },
|
bsw/jbe@0
|
81 {
|
bsw@269
|
82 label = function()
|
bsw@269
|
83 local title = _"New"
|
bsw@269
|
84 ui.image{
|
bsw@269
|
85 attr = { title = title, alt = title },
|
bsw@269
|
86 static = "icons/16/new.png"
|
bsw@269
|
87 }
|
bsw@269
|
88 end,
|
bsw@269
|
89 field_attr = field_attr,
|
bsw@269
|
90 label_attr = label_attr,
|
bsw@269
|
91 content = function(record)
|
bsw@269
|
92 ui.link{
|
bsw@269
|
93 text = tostring(record.issues_new_count),
|
bsw@269
|
94 module = "area",
|
bsw@269
|
95 view = "show",
|
bsw@269
|
96 id = record.id,
|
bsw@269
|
97 params = { filter = "new", tab = "issues" }
|
bsw@269
|
98 }
|
bsw@269
|
99 end
|
bsw@269
|
100 },
|
bsw@269
|
101 {
|
bsw@269
|
102 label = function()
|
bsw@269
|
103 local title = _"Discussion"
|
bsw@269
|
104 ui.image{
|
bsw@269
|
105 attr = { title = title, alt = title },
|
bsw@269
|
106 static = "icons/16/comments.png"
|
bsw@269
|
107 }
|
bsw@269
|
108 end,
|
bsw@269
|
109 field_attr = field_attr,
|
bsw@269
|
110 label_attr = label_attr,
|
bsw@269
|
111 content = function(record)
|
bsw@269
|
112 ui.link{
|
bsw@269
|
113 text = tostring(record.issues_discussion_count),
|
bsw@269
|
114 module = "area",
|
bsw@269
|
115 view = "show",
|
bsw@269
|
116 id = record.id,
|
bsw@269
|
117 params = { filter = "accepted", tab = "issues" }
|
bsw@269
|
118 }
|
bsw@269
|
119 end
|
bsw/jbe@0
|
120 },
|
bsw/jbe@0
|
121 {
|
bsw@269
|
122 label = function()
|
bsw@269
|
123 local title = _"Frozen"
|
bsw@269
|
124 ui.image{
|
bsw@269
|
125 attr = { title = title, alt = title },
|
bsw@269
|
126 static = "icons/16/lock.png"
|
bsw@269
|
127 }
|
bsw@269
|
128 end,
|
bsw@269
|
129 field_attr = field_attr,
|
bsw@269
|
130 label_attr = label_attr,
|
bsw@269
|
131 content = function(record)
|
bsw@269
|
132 ui.link{
|
bsw@269
|
133 text = tostring(record.issues_frozen_count),
|
bsw@269
|
134 module = "area",
|
bsw@269
|
135 view = "show",
|
bsw@269
|
136 id = record.id,
|
bsw@269
|
137 params = { filter = "half_frozen", tab = "issues" }
|
bsw@269
|
138 }
|
bsw@269
|
139 end
|
bsw@269
|
140 },
|
bsw@269
|
141 {
|
bsw@269
|
142 label = function()
|
bsw@269
|
143 local title = _"Voting"
|
bsw@269
|
144 ui.image{
|
bsw@269
|
145 attr = { title = title, alt = title },
|
bsw@269
|
146 static = "icons/16/email_open.png"
|
bsw@269
|
147 }
|
bsw@269
|
148 end,
|
bsw@269
|
149 field_attr = field_attr,
|
bsw@269
|
150 label_attr = label_attr,
|
bsw@269
|
151 content = function(record)
|
bsw@269
|
152 ui.link{
|
bsw@269
|
153 text = tostring(record.issues_voting_count),
|
bsw@269
|
154 module = "area",
|
bsw@269
|
155 view = "show",
|
bsw@269
|
156 id = record.id,
|
bsw@269
|
157 params = { filter = "frozen", tab = "issues" }
|
bsw@269
|
158 }
|
bsw@269
|
159 end
|
bsw@269
|
160 },
|
bsw@269
|
161 {
|
bsw@269
|
162 label = function()
|
bsw@269
|
163 local title = _"Finished"
|
bsw@269
|
164 ui.image{
|
bsw@269
|
165 attr = { title = title, alt = title },
|
bsw@269
|
166 static = "icons/16/tick.png"
|
bsw@269
|
167 }
|
bsw@269
|
168 end,
|
bsw@269
|
169 field_attr = field_attr,
|
bsw@269
|
170 label_attr = label_attr,
|
bsw@269
|
171 content = function(record)
|
bsw@269
|
172 ui.link{
|
bsw@269
|
173 text = tostring(record.issues_finished_count),
|
bsw@269
|
174 module = "area",
|
bsw@269
|
175 view = "show",
|
bsw@269
|
176 id = record.id,
|
bsw@269
|
177 params = { filter = "finished", issue_list = "newest", tab = "issues" }
|
bsw@269
|
178 }
|
bsw@269
|
179 end
|
bsw@269
|
180 },
|
bsw@269
|
181 {
|
bsw@269
|
182 label = function()
|
bsw@269
|
183 local title = _"Cancelled"
|
bsw@269
|
184 ui.image{
|
bsw@269
|
185 attr = { title = title, alt = title },
|
bsw@269
|
186 static = "icons/16/cross.png"
|
bsw@269
|
187 }
|
bsw@269
|
188 end,
|
bsw@269
|
189 field_attr = field_attr,
|
bsw@269
|
190 label_attr = label_attr,
|
bsw@269
|
191 content = function(record)
|
bsw@269
|
192 ui.link{
|
bsw@269
|
193 text = tostring(record.issues_cancelled_count),
|
bsw@269
|
194 module = "area",
|
bsw@269
|
195 view = "show",
|
bsw@269
|
196 id = record.id,
|
bsw@269
|
197 params = { filter = "cancelled", issue_list = "newest", tab = "issues" }
|
bsw@269
|
198 }
|
bsw@269
|
199 end
|
bsw@269
|
200 },
|
bsw@269
|
201 {
|
bsw@269
|
202 content = function(record)
|
bsw@269
|
203 if record.issues_to_vote_count > 0 then
|
bsw@269
|
204 ui.link{
|
bsw@269
|
205 attr = { class = "not_voted" },
|
bsw@269
|
206 text = _"Not yet voted" .. ": " .. tostring(record.issues_to_vote_count),
|
bsw@269
|
207 module = "area",
|
bsw@269
|
208 view = "show",
|
bsw@269
|
209 id = record.id,
|
bsw@269
|
210 params = {
|
bsw@269
|
211 filter = "frozen",
|
bsw@269
|
212 filter_voting = "not_voted",
|
bsw@269
|
213 tab = "issues"
|
bsw@9
|
214 }
|
bsw@269
|
215 }
|
bsw@269
|
216 end
|
bsw@269
|
217 end
|
bsw@269
|
218 },
|
bsw@269
|
219 }
|
bsw/jbe@4
|
220 }
|
bsw/jbe@4
|
221
|
bsw/jbe@4
|
222 ui.bargraph_legend{
|
bsw/jbe@4
|
223 width = 25,
|
bsw/jbe@4
|
224 bars = {
|
bsw/jbe@4
|
225 { color = "#444", label = _"Direct membership" },
|
bsw/jbe@4
|
226 { color = "#777", label = _"Membership by delegation" },
|
bsw/jbe@4
|
227 { color = "#ddd", label = _"No membership at all" },
|
bsw/jbe@4
|
228 }
|
bsw/jbe@4
|
229 }
|
bsw/jbe@4
|
230
|
bsw/jbe@19
|
231 slot.put("<br /> ")
|
bsw/jbe@19
|
232
|
bsw/jbe@19
|
233
|
bsw@51
|
234 if app.session.member_id then
|
bsw@51
|
235 ui.image{
|
bsw@51
|
236 attr = { title = title, alt = title },
|
bsw@51
|
237 static = "icons/16/user_gray.png"
|
bsw@51
|
238 }
|
bsw@51
|
239 slot.put(" ")
|
bsw@51
|
240 slot.put(_"Member of area")
|
bsw@51
|
241 slot.put(" ")
|
mail@240
|
242
|
mail@240
|
243 ui.image{
|
mail@240
|
244 attr = { title = title, alt = title },
|
mail@240
|
245 static = "icons/16/link.png"
|
mail@240
|
246 }
|
mail@240
|
247 slot.put(" ")
|
mail@240
|
248 slot.put(_"Area delegated")
|
mail@240
|
249 slot.put(" ")
|
bsw@51
|
250 end
|
bsw/jbe@19
|
251
|
bsw/jbe@19
|
252 ui.image{
|
bsw/jbe@19
|
253 attr = { title = title, alt = title },
|
bsw/jbe@19
|
254 static = "icons/16/new.png"
|
bsw/jbe@19
|
255 }
|
bsw/jbe@19
|
256 slot.put(" ")
|
bsw/jbe@19
|
257 slot.put(_"New")
|
bsw/jbe@19
|
258 slot.put(" ")
|
bsw/jbe@19
|
259
|
bsw/jbe@19
|
260 ui.image{
|
bsw/jbe@19
|
261 attr = { title = title, alt = title },
|
bsw/jbe@19
|
262 static = "icons/16/comments.png"
|
bsw/jbe@19
|
263 }
|
bsw/jbe@19
|
264 slot.put(" ")
|
bsw/jbe@19
|
265 slot.put(_"Discussion")
|
bsw/jbe@19
|
266 slot.put(" ")
|
bsw/jbe@19
|
267
|
bsw/jbe@19
|
268 ui.image{
|
bsw/jbe@19
|
269 attr = { title = title, alt = title },
|
bsw/jbe@19
|
270 static = "icons/16/lock.png"
|
bsw/jbe@19
|
271 }
|
bsw/jbe@19
|
272 slot.put(" ")
|
bsw/jbe@19
|
273 slot.put(_"Frozen")
|
bsw/jbe@19
|
274 slot.put(" ")
|
bsw/jbe@19
|
275
|
bsw/jbe@19
|
276 ui.image{
|
bsw/jbe@19
|
277 attr = { title = title, alt = title },
|
bsw/jbe@19
|
278 static = "icons/16/email_open.png"
|
bsw/jbe@19
|
279 }
|
bsw/jbe@19
|
280 slot.put(" ")
|
bsw/jbe@19
|
281 slot.put(_"Voting")
|
bsw/jbe@19
|
282 slot.put(" ")
|
bsw/jbe@19
|
283
|
bsw/jbe@19
|
284 ui.image{
|
bsw/jbe@19
|
285 attr = { title = title, alt = title },
|
bsw/jbe@19
|
286 static = "icons/16/tick.png"
|
bsw/jbe@19
|
287 }
|
bsw/jbe@19
|
288 slot.put(" ")
|
bsw/jbe@19
|
289 slot.put(_"Finished")
|
bsw/jbe@19
|
290 slot.put(" ")
|
bsw/jbe@19
|
291
|
bsw/jbe@19
|
292 ui.image{
|
bsw/jbe@19
|
293 attr = { title = title, alt = title },
|
bsw/jbe@19
|
294 static = "icons/16/cross.png"
|
bsw/jbe@19
|
295 }
|
bsw/jbe@19
|
296 slot.put(" ")
|
bsw/jbe@19
|
297 slot.put(_"Cancelled")
|
bsw/jbe@19
|
298
|