rev |
line source |
bsw/jbe@0
|
1 local areas_selector = param.get("areas_selector", "table")
|
bsw@375
|
2 local hide_membership = param.get("hide_membership", atom.boolean)
|
bsw/jbe@0
|
3
|
bsw@9
|
4 areas_selector
|
bsw@9
|
5 :reset_fields()
|
bsw@9
|
6 :add_field("area.id", nil, { "grouped" })
|
bsw@9
|
7 :add_field("area.name", nil, { "grouped" })
|
bsw@9
|
8 :add_field("member_weight", nil, { "grouped" })
|
bsw@9
|
9 :add_field("direct_member_count", nil, { "grouped" })
|
bsw@9
|
10 :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
|
11 :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
|
12 :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
|
13 :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
|
14 :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
|
15 :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
|
16
|
bsw@51
|
17 if app.session.member_id then
|
bsw@51
|
18 areas_selector
|
bsw@51
|
19 :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
|
20 :left_join("membership", "_membership", { "_membership.area_id = area.id AND _membership.member_id = ?", app.session.member.id })
|
bsw@51
|
21 :add_field("_membership.member_id NOTNULL", "is_member", { "grouped" })
|
bsw@274
|
22 :left_join("delegation", nil, {
|
bsw@274
|
23 "delegation.truster_id = ? AND delegation.area_id = area.id AND delegation.scope = 'area'", app.session.member_id
|
bsw@274
|
24 })
|
bsw@274
|
25 :left_join("member", nil, "member.id = delegation.trustee_id")
|
bsw@274
|
26 :add_field("member.id", "trustee_member_id", { "grouped" })
|
bsw@274
|
27 :add_field("member.name", "trustee_member_name", { "grouped" })
|
bsw@51
|
28 else
|
bsw@51
|
29 areas_selector:add_field("0", "issues_to_vote_count")
|
bsw@51
|
30 end
|
bsw@9
|
31
|
bsw@373
|
32
|
bsw@418
|
33 ui.container{ attr = { class = "box area_list" }, content = function()
|
bsw@373
|
34
|
bsw@378
|
35 ui.container{ attr = { class = "area head" }, content = function()
|
bsw@378
|
36
|
bsw@378
|
37 ui.container{ attr = { class = "phases" }, content = function()
|
bsw@378
|
38
|
bsw@378
|
39 ui.container{ attr = { class = "admission" }, content = function()
|
bsw@495
|
40 ui.image{ static = "icons/16/new.png", attr = { alt = _"New" } }
|
bsw@378
|
41 end }
|
bsw@378
|
42
|
bsw@378
|
43 ui.container{ attr = { class = "discussion" }, content = function()
|
bsw@495
|
44 ui.image{ static = "icons/16/comments.png", attr = { alt = _"Discussion" } }
|
bsw@378
|
45 end }
|
bsw@378
|
46
|
bsw@378
|
47 ui.container{ attr = { class = "verification" }, content = function()
|
bsw@495
|
48 ui.image{ static = "icons/16/lock.png", attr = { alt = _"Verification" } }
|
bsw@378
|
49 end }
|
bsw@378
|
50
|
bsw@378
|
51 ui.container{ attr = { class = "voting" }, content = function()
|
bsw@495
|
52 ui.image{ static = "icons/16/email_open.png", attr = { alt = _"Voting" } }
|
bsw@378
|
53 end }
|
bsw@378
|
54
|
bsw@378
|
55 ui.container{ attr = { class = "finished" }, content = function()
|
bsw@495
|
56 ui.image{ static = "icons/16/tick.png", attr = { alt = _"Finished" } }
|
bsw@378
|
57 end }
|
bsw@378
|
58
|
bsw@378
|
59 ui.container{ attr = { class = "cancelled" }, content = function()
|
bsw@495
|
60 ui.image{ static = "icons/16/cross.png", attr = { alt = _"Cancelled" } }
|
bsw@378
|
61 end }
|
bsw@378
|
62
|
bsw@378
|
63 end }
|
bsw@378
|
64
|
bsw@378
|
65 end }
|
bsw@378
|
66
|
bsw@373
|
67 for i, area in ipairs(areas_selector:exec()) do
|
bsw@373
|
68
|
bsw@373
|
69 ui.container{ attr = { class = "area" }, content = function()
|
bsw@373
|
70
|
bsw@375
|
71 ui.container{ attr = { class = "bar" }, content = function()
|
bsw@375
|
72 if area.member_weight and area.direct_member_count then
|
bsw@375
|
73 local max_value = MemberCount:get()
|
bsw@375
|
74 ui.bargraph{
|
bsw@375
|
75 max_value = max_value,
|
bsw@375
|
76 width = 100,
|
bsw@375
|
77 bars = {
|
bsw@375
|
78 { color = "#444", value = area.direct_member_count },
|
bsw@375
|
79 { color = "#777", value = area.member_weight - area.direct_member_count },
|
bsw@375
|
80 { color = "#ddd", value = max_value - area.member_weight },
|
bsw@269
|
81 }
|
bsw@375
|
82 }
|
bsw@375
|
83 end
|
bsw@375
|
84 end }
|
bsw@373
|
85
|
bsw@381
|
86 ui.container{ attr = { class = "name" }, content = function()
|
bsw@381
|
87 ui.link{
|
bsw@381
|
88 text = area.name,
|
bsw@381
|
89 module = "area",
|
bsw@381
|
90 view = "show",
|
bsw@381
|
91 id = area.id
|
bsw@381
|
92 }
|
bsw@381
|
93 slot.put(" ")
|
bsw@381
|
94 ui.tag{ content = "" }
|
bsw@381
|
95 end }
|
bsw@381
|
96
|
bsw@375
|
97 if not hide_membership then
|
bsw@373
|
98 ui.container{ attr = { class = "membership" }, content = function()
|
bsw@373
|
99 if area.is_member then
|
bsw@373
|
100 local text = _"Member of area"
|
bsw@373
|
101 ui.image{
|
bsw@373
|
102 attr = { title = text, alt = text },
|
bsw@373
|
103 static = "icons/16/user_gray.png",
|
bsw@373
|
104 }
|
bsw@373
|
105 else
|
bsw@494
|
106 slot.put('<img src="null.png" width="16" height="1" alt="" />')
|
bsw@373
|
107 end
|
bsw@373
|
108 end }
|
bsw@375
|
109 end
|
bsw@381
|
110
|
bsw@375
|
111 ui.container{ attr = { class = "delegatee" }, content = function()
|
bsw@375
|
112 if area.trustee_member_id then
|
bsw@375
|
113 local trustee_member = Member:by_id(area.trustee_member_id)
|
bsw@375
|
114 local text = _("Area delegated to '#{name}'", { name = area.trustee_member_name })
|
bsw@375
|
115 ui.image{
|
bsw@375
|
116 attr = { class = "delegation_arrow", alt = text, title = text },
|
bsw@375
|
117 static = "delegation_arrow_24_horizontal.png"
|
bsw@375
|
118 }
|
bsw@375
|
119 execute.view{
|
bsw@375
|
120 module = "member_image",
|
bsw@375
|
121 view = "_show",
|
bsw@375
|
122 params = {
|
bsw@375
|
123 member = trustee_member,
|
bsw@375
|
124 image_type = "avatar",
|
bsw@375
|
125 show_dummy = true,
|
bsw@375
|
126 class = "micro_avatar",
|
bsw@375
|
127 popup_text = text
|
bsw@373
|
128 }
|
bsw@375
|
129 }
|
bsw@375
|
130 else
|
bsw@494
|
131 slot.put('<img src="null.png" width="41" height="1" alt="" />')
|
bsw@375
|
132 end
|
bsw@375
|
133 end }
|
bsw@375
|
134
|
bsw@373
|
135 ui.container{ attr = { class = "phases" }, content = function()
|
bsw@373
|
136
|
bsw@373
|
137 ui.container{ attr = { class = "admission" }, content = function()
|
bsw@373
|
138 ui.link{
|
bsw@373
|
139 text = tostring(area.issues_new_count),
|
bsw@373
|
140 module = "area",
|
bsw@373
|
141 view = "show",
|
bsw@373
|
142 id = area.id,
|
bsw@478
|
143 params = { filter = "new", tab = "open" }
|
bsw@373
|
144 }
|
bsw@373
|
145 end }
|
bsw/jbe@19
|
146
|
bsw@373
|
147 ui.container{ attr = { class = "discussion" }, content = function()
|
bsw@373
|
148 ui.link{
|
bsw@373
|
149 text = tostring(area.issues_discussion_count),
|
bsw@373
|
150 module = "area",
|
bsw@373
|
151 view = "show",
|
bsw@373
|
152 id = area.id,
|
bsw@478
|
153 params = { filter = "accepted", tab = "open" }
|
bsw@373
|
154 }
|
bsw@373
|
155 end }
|
mail@240
|
156
|
bsw@373
|
157 ui.container{ attr = { class = "verification" }, content = function()
|
bsw@373
|
158 ui.link{
|
bsw@373
|
159 text = tostring(area.issues_frozen_count),
|
bsw@373
|
160 module = "area",
|
bsw@373
|
161 view = "show",
|
bsw@373
|
162 id = area.id,
|
bsw@478
|
163 params = { filter = "half_frozen", tab = "open" }
|
bsw@373
|
164 }
|
bsw@373
|
165 end }
|
bsw/jbe@19
|
166
|
bsw@373
|
167 ui.container{ attr = { class = "voting" }, content = function()
|
bsw@373
|
168 ui.link{
|
bsw@373
|
169 text = tostring(area.issues_voting_count),
|
bsw@373
|
170 module = "area",
|
bsw@373
|
171 view = "show",
|
bsw@373
|
172 id = area.id,
|
bsw@478
|
173 params = { filter = "frozen", tab = "open" }
|
bsw@373
|
174 }
|
bsw@373
|
175 end }
|
bsw/jbe@19
|
176
|
bsw@373
|
177 ui.container{ attr = { class = "finished" }, content = function()
|
bsw@373
|
178 ui.link{
|
bsw@373
|
179 text = tostring(area.issues_finished_count),
|
bsw@373
|
180 module = "area",
|
bsw@373
|
181 view = "show",
|
bsw@373
|
182 id = area.id,
|
bsw@478
|
183 params = { filter = "finished", tab = "closed" }
|
bsw@373
|
184 }
|
bsw@373
|
185 end }
|
bsw/jbe@19
|
186
|
bsw@373
|
187 ui.container{ attr = { class = "cancelled" }, content = function()
|
bsw@373
|
188 ui.link{
|
bsw@373
|
189 text = tostring(area.issues_cancelled_count),
|
bsw@373
|
190 module = "area",
|
bsw@373
|
191 view = "show",
|
bsw@373
|
192 id = area.id,
|
bsw@478
|
193 params = { filter = "cancelled", issue_list = "newest", tab = "closed" }
|
bsw@373
|
194 }
|
bsw@373
|
195 end }
|
bsw/jbe@19
|
196
|
bsw@373
|
197 end }
|
bsw@373
|
198
|
bsw@378
|
199 slot.put("<br style='clear: right;' />")
|
bsw@373
|
200 end }
|
bsw@373
|
201
|
bsw@373
|
202 end
|
bsw@373
|
203
|
bsw@373
|
204 end }
|