liquid_feedback_frontend

view app/main/issue/_list.lua @ 10:72c5e0ee7c98

Version beta6

Bugfixes:
- Security fix: Every user was able to change the discussion URL of an initiative
- Creation of new issues in areas without default policies is now possible
- Members can now be sorted in different ways
- No error when trying to compare a draft with itself
- Added missing local statement to variable initialization in app/main/delegation/new.lua
- CSS flaw in initiative action bar fixed

New features:
- Possiblity to invite other users to become initiator
- Revokation of initiatives implemented
- Number of suggestions, supporters, etc. is shown on corresponding tabs of initiative view
- Members can now be sorted by account creation (default sorting is "newest first")
- Configuration option to create an automatic discussion link for all issues
- First draft of global timeline feature (not accessible via link yet)
- Custom stylesheet URL for users marked as developers

In area listing the number of closed issues is shown too

Renamed "author" field of initiative to "last author"

Removed wrongly included file app/main/member/_show_thumb.lua.orig in the distribution

Help texts updated
author bsw
date Sun Jan 10 12:00:00 2010 +0100 (2010-01-10)
parents 8d91bccab0bf
children 77d58efe99fd
line source
1 local issues_selector = param.get("issues_selector", "table")
3 local ui_filter = ui.filter
4 if param.get("filter", atom.boolean) == false then
5 ui_filter = function(args) args.content() end
6 end
8 if param.get("no_filter", atom.boolean) then
9 ui_filter = function(args) args.content() end
10 end
12 local filter_voting = false
13 ui_filter{
14 selector = issues_selector,
15 filters = {
16 {
17 type = "boolean",
18 name = "open",
19 label = _"Open",
20 selector_modifier = function(selector, value)
21 if value then
22 selector:add_where("issue.closed ISNULL")
23 end
24 end
25 },
26 {
27 type = "boolean",
28 name = "new",
29 label = _"New",
30 selector_modifier = function(selector, value)
31 if value then
32 selector:add_where("issue.accepted ISNULL AND issue.closed ISNULL")
33 end
34 end
35 },
36 {
37 type = "boolean",
38 name = "accepted",
39 label = _"In discussion",
40 selector_modifier = function(selector, value)
41 if value then
42 selector:add_where("issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL")
43 end
44 end
45 },
46 {
47 type = "boolean",
48 name = "half_frozen",
49 label = _"Frozen",
50 selector_modifier = function(selector, value)
51 if value then
52 selector:add_where("issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL")
53 end
54 end
55 },
56 {
57 type = "boolean",
58 name = "frozen",
59 label = _"Voting",
60 selector_modifier = function(selector, value)
61 if value then
62 selector:add_where("issue.fully_frozen NOTNULL AND issue.closed ISNULL")
63 filter_voting = true
64 end
65 end
66 },
67 {
68 type = "boolean",
69 name = "finished",
70 label = _"Finished",
71 selector_modifier = function(selector, value)
72 if value then
73 selector:add_where("issue.closed NOTNULL AND issue.fully_frozen NOTNULL")
74 end
75 end
76 },
77 {
78 type = "boolean",
79 name = "cancelled",
80 label = _"Cancelled",
81 selector_modifier = function(selector, value)
82 if value then
83 selector:add_where("issue.closed NOTNULL AND issue.accepted ISNULL")
84 end
85 end
86 },
87 },
88 content = function()
89 local ui_filter = ui.filter
90 if not filter_voting then
91 ui_filter = function(args) args.content() end
92 end
93 if param.get("no_filter", atom.boolean) then
94 ui_filter = function(args) args.content() end
95 end
96 ui_filter{
97 selector = issues_selector,
98 name = "filter_voting",
99 filters = {
100 {
101 type = "boolean",
102 name = "any",
103 label = _"Any",
104 selector_modifier = function() end
105 },
106 {
107 type = "boolean",
108 name = "not_voted",
109 label = _"Not voted",
110 selector_modifier = function(selector, value)
111 if value then
112 selector:left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id })
113 selector:add_where("direct_voter.member_id ISNULL")
114 end
115 end
116 },
117 {
118 type = "boolean",
119 name = "voted",
120 label = _"Voted",
121 selector_modifier = function(selector, value)
122 if value then
123 selector:join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id })
124 end
125 end
126 },
127 },
128 content = function()
129 local ui_filter = ui.filter
130 if param.get("filter", atom.boolean) == false then
131 ui_filter = function(args) args.content() end
132 end
133 ui_filter{
134 selector = issues_selector,
135 name = "filter_interest",
136 filters = {
137 {
138 type = "boolean",
139 name = "any",
140 label = _"Any",
141 selector_modifier = function() end
142 },
143 {
144 type = "boolean",
145 name = "my",
146 label = _"Interested",
147 selector_modifier = function(selector, value)
148 if value then
149 selector:join("interest", "filter_interest", { "filter_interest.issue_id = issue.id AND filter_interest.member_id = ? ", app.session.member.id })
150 end
151 end
152 },
153 },
154 content = function()
155 local ui_order = ui.order
156 if param.get("no_sort", atom.boolean) then
157 ui_order = function(args) args.content() end
158 end
159 ui_order{
160 name = "issue_list",
161 selector = issues_selector,
162 options = {
163 {
164 name = "max_potential_support",
165 label = _"Max potential support",
166 selector_modifier = function(selector)
167 selector:add_order_by("(SELECT max(supporter_count) FROM initiative WHERE initiative.issue_id = issue.id) DESC")
168 end
169 },
170 {
171 name = "max_support",
172 label = _"Max support",
173 selector_modifier = function(selector)
174 selector:add_order_by("(SELECT max(satisfied_supporter_count) FROM initiative WHERE initiative.issue_id = issue.id) DESC")
175 end
176 },
177 {
178 name = "population",
179 label = _"Population",
180 order_by = "issue.population DESC"
181 },
182 {
183 name = "newest",
184 label = _"Newest",
185 order_by = "issue.created DESC"
186 },
187 {
188 name = "oldest",
189 label = _"Oldest",
190 order_by = "issue.created"
191 }
192 },
193 content = function()
194 local ui_paginate = ui.paginate
195 if param.get("per_page") == "all" then
196 ui_paginate = function(args) args.content() end
197 end
198 ui_paginate{
199 per_page = tonumber(param.get("per_page")),
200 selector = issues_selector,
201 content = function()
202 local highlight_string = param.get("highlight_string", "string")
203 local issues = issues or issues_selector:exec()
204 -- issues:load(initiatives)
205 ui.list{
206 attr = { class = "issues" },
207 records = issues,
208 columns = {
209 {
210 label = _"Issue",
211 content = function(record)
212 if not param.get("for_area_list", atom.boolean) then
213 ui.field.text{
214 value = record.area.name
215 }
216 slot.put("<br />")
217 end
218 ui.link{
219 text = _("Issue ##{id}", { id = tostring(record.id) }),
220 module = "issue",
221 view = "show",
222 id = record.id
223 }
224 if record.state == "new" then
225 ui.image{
226 static = "icons/16/new.png"
227 }
228 end
229 slot.put("<br />")
230 slot.put("<br />")
231 if record.old_state then
232 ui.field.text{ value = format.time(record.sort) }
233 ui.field.text{ value = Issue:get_state_name_for_state(record.old_state) .. " > " .. Issue:get_state_name_for_state(record.new_state) }
234 else
235 end
236 end
237 },
238 {
239 label = _"State",
240 content = function(record)
241 if record.state == "voting" then
242 ui.link{
243 content = _"Voting",
244 module = "vote",
245 view = "list",
246 params = { issue_id = record.id }
247 }
248 else
249 ui.field.issue_state{ value = record.state }
250 end
251 end
252 },
253 {
254 label = _"Initiatives",
255 content = function(record)
256 local initiatives_selector = record:get_reference_selector("initiatives")
257 local highlight_string = param.get("highlight_string")
258 if highlight_string then
259 initiatives_selector:add_field( {'"highlight"("initiative"."name", ?)', highlight_string }, "name_highlighted")
260 end
261 execute.view{
262 module = "initiative",
263 view = "_list",
264 params = {
265 issue = record,
266 initiatives_selector = initiatives_selector,
267 highlight_string = highlight_string,
268 limit = 3,
269 per_page = param.get("initiatives_per_page", atom.number),
270 no_sort = param.get("initiatives_no_sort", atom.boolean)
271 }
272 }
273 end
274 },
275 }
276 }
277 end
278 }
279 end
280 }
281 end
282 }
283 end
284 }
285 if param.get("legend", atom.boolean) ~= false then
286 local filter = param.get_all_cgi().filter
287 if not filter or filter == "any" or filter ~= "finished" then
288 ui.bargraph_legend{
289 width = 25,
290 bars = {
291 { color = "#0a0", label = _"Supporter" },
292 { color = "#777", label = _"Potential supporter" },
293 { color = "#ddd", label = _"No support at all" },
294 }
295 }
296 end
297 if not filter or filter == "any" or filter == "finished" then
298 ui.bargraph_legend{
299 width = 25,
300 bars = {
301 { color = "#0a0", label = _"Yes" },
302 { color = "#aaa", label = _"Abstention" },
303 { color = "#a00", label = _"No" },
304 }
305 }
306 end
307 end
308 end
309 }

Impressum / About Us