liquid_feedback_frontend

view app/main/area/_list.lua @ 9:0ee1e0c42d4c

Version beta5

Minor security fix: Added missing security filter for admin section. Reading of member listing including login names was possible for all users. Write access has not been possible though.

Changing of name and login is possible while a history of these changes is written and accessible by all users.

Statistics shown in area list

Trimming of user input also converts multiple whitespaces to single space character.
author bsw
date Mon Jan 04 12:00:00 2010 +0100 (2010-01-04)
parents 80c215dbf076
children 72c5e0ee7c98
line source
1 local areas_selector = param.get("areas_selector", "table")
3 areas_selector
4 :reset_fields()
5 :add_field("area.id", nil, { "grouped" })
6 :add_field("area.name", nil, { "grouped" })
7 :add_field("member_weight", nil, { "grouped" })
8 :add_field("direct_member_count", nil, { "grouped" })
9 :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted ISNULL AND issue.closed ISNULL)", "issues_new_count")
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")
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")
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")
13 :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")
15 ui.order{
16 name = name,
17 selector = areas_selector,
18 options = {
19 {
20 name = "member_weight",
21 label = _"Population",
22 order_by = "area.member_weight DESC"
23 },
24 {
25 name = "direct_member_count",
26 label = _"Direct member count",
27 order_by = "area.direct_member_count DESC"
28 },
29 {
30 name = "az",
31 label = _"A-Z",
32 order_by = "area.name"
33 },
34 {
35 name = "za",
36 label = _"Z-A",
37 order_by = "area.name DESC"
38 }
39 },
40 content = function()
41 ui.list{
42 records = areas_selector:exec(),
43 columns = {
44 {
45 content = function(record)
46 if record.member_weight and record.direct_member_count then
47 local max_value = MemberCount:get()
48 ui.bargraph{
49 max_value = max_value,
50 width = 100,
51 bars = {
52 { color = "#444", value = record.direct_member_count },
53 { color = "#777", value = record.member_weight - record.direct_member_count },
54 { color = "#ddd", value = max_value - record.member_weight },
55 }
56 }
57 end
58 end
59 },
60 {
61 content = function(record)
62 ui.link{
63 text = record.name,
64 module = "area",
65 view = "show",
66 id = record.id
67 }
68 end
69 },
70 {
71 label = _"New",
72 field_attr = { style = "text-align: right;" },
73 content = function(record)
74 ui.link{
75 text = tostring(record.issues_new_count),
76 module = "area",
77 view = "show",
78 id = record.id,
79 params = { filter = "new" }
80 }
81 end
82 },
83 {
84 label = _"Discussion",
85 field_attr = { style = "text-align: right;" },
86 content = function(record)
87 ui.link{
88 text = tostring(record.issues_discussion_count),
89 module = "area",
90 view = "show",
91 id = record.id,
92 params = { filter = "accepted" }
93 }
94 end
95 },
96 {
97 label = _"Frozen",
98 field_attr = { style = "text-align: right;" },
99 content = function(record)
100 ui.link{
101 text = tostring(record.issues_frozen_count),
102 module = "area",
103 view = "show",
104 id = record.id,
105 params = { filter = "half_frozen" }
106 }
107 end
108 },
109 {
110 label = _"Voting",
111 field_attr = { style = "text-align: right;" },
112 content = function(record)
113 ui.link{
114 text = tostring(record.issues_voting_count),
115 module = "area",
116 view = "show",
117 id = record.id,
118 params = { filter = "frozen" }
119 }
120 end
121 },
122 {
123 label = _"Not yet voted",
124 field_attr = { style = "text-align: right;" },
125 content = function(record)
126 ui.link{
127 attr = { class = record.issues_to_vote_count > 0 and "not_voted" or nil },
128 text = tostring(record.issues_to_vote_count),
129 module = "area",
130 view = "show",
131 id = record.id,
132 params = { filter = "frozen", filter_voting = "not_voted" }
133 }
134 end
135 }
136 }
137 }
138 end
139 }
141 ui.bargraph_legend{
142 width = 25,
143 bars = {
144 { color = "#444", label = _"Direct membership" },
145 { color = "#777", label = _"Membership by delegation" },
146 { color = "#ddd", label = _"No membership at all" },
147 }
148 }

Impressum / About Us