liquid_feedback_frontend

annotate app/main/area/_list.lua @ 282:7f41f3c44fae

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

Impressum / About Us