liquid_feedback_frontend

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

Impressum / About Us