liquid_feedback_frontend

view app/main/member/_area_list.lua @ 510:ab68f1d0f78e

Set version number to 2.beta4
author bsw
date Tue Mar 27 18:54:16 2012 +0200 (2012-03-27)
parents a42179662951
children 63d6549cc00b
line source
1 local member = param.get("member", "table")
2 local for_member = param.get("for_member", atom.boolean)
4 local units = member.units_with_voting_right
6 for i, unit in ipairs(units) do
7 local trustee_member = Member:new_selector()
8 :join("delegation", nil, { "delegation.scope = 'unit' AND delegation.unit_id = ? AND delegation.trustee_id = member.id AND delegation.truster_id = ?", unit.id, member.id })
9 :optional_object_mode()
10 :exec()
12 local areas_selector = Area:new_selector()
13 :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
14 :add_where{ "area.unit_id = ?", unit.id }
15 :add_where{ "area.active" }
16 :add_order_by("area.member_weight DESC")
18 local area_count = areas_selector:count()
20 ui.container{ attr = { class = "member_area_list" }, content = function()
21 ui.container{ attr = { class = "unit_head" }, content = function()
22 ui.link{
23 text = unit.name,
24 module = "unit", view = "show", id = unit.id
25 }
27 if trustee_member then
28 local text = _("Unit delegated to '#{name}'", { name = trustee_member.name })
29 ui.image{
30 attr = { class = "delegation_arrow", alt = text, title = text },
31 static = "delegation_arrow_24_horizontal.png"
32 }
33 execute.view{
34 module = "member_image",
35 view = "_show",
36 params = {
37 member = trustee_member,
38 image_type = "avatar",
39 show_dummy = true,
40 class = "micro_avatar",
41 popup_text = text
42 }
43 }
44 end
45 end }
47 if area_count > 0 then
48 execute.view{
49 module = "area", view = "_list",
50 params = { areas_selector = areas_selector, hide_membership = true }
51 }
52 else
53 if for_member then
54 ui.container{ attr = { class = "voting_priv_info" }, content = _"This member has voting privileges for this unit, but you ist not member of any of its areas." }
55 else
56 ui.container{ attr = { class = "voting_priv_info" }, content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
57 end
58 end
59 local max_area_count = Area:new_selector()
60 :add_where{ "area.unit_id = ?", unit.id }
61 :add_where{ "area.active" }
62 :count()
63 local more_area_count = max_area_count - area_count
64 local delegated_count = Area:new_selector()
65 :add_where{ "area.unit_id = ?", unit.id }
66 :add_where{ "area.active" }
67 :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id } )
68 :add_where{ "membership.member_id ISNULL" }
69 :join("delegation", nil, { "delegation.area_id = area.id AND delegation.truster_id = ?", member.id } )
70 :count()
71 if more_area_count > 0 then
72 slot.put("<br />")
73 ui.container{ attr = { class = "more_areas" }, content = function()
74 ui.link{ content = _("#{count} more areas in this unit, #{delegated_count} of them are delegated", { count = more_area_count, delegated_count = delegated_count }), module = "unit", view = "show", id = unit.id }
75 end }
76 end
77 end }
79 end

Impressum / About Us