rev |
line source |
bsw@1045
|
1 local member = param.get("member", "table")
|
bsw@1045
|
2
|
bsw@1045
|
3 local public_contacts_selector = Contact:build_selector{
|
bsw@1045
|
4 public = true,
|
bsw@1045
|
5 member_id = member.id,
|
bsw@1045
|
6 order = "name"
|
bsw@1045
|
7 }
|
bsw@1045
|
8
|
bsw@1045
|
9 local private_contacts_selector = Contact:build_selector{
|
bsw@1045
|
10 public = false,
|
bsw@1045
|
11 member_id = member.id,
|
bsw@1045
|
12 order = "name"
|
bsw@1045
|
13 }
|
bsw@1045
|
14
|
bsw@1045
|
15 ui.sidebar( "tab-members", function()
|
bsw@1045
|
16
|
bsw@1045
|
17 ui.sidebarHead( function()
|
bsw@1045
|
18 ui.heading { level = 2, content = _"Published contacts" }
|
bsw@1045
|
19 end )
|
bsw@1045
|
20
|
bsw@1045
|
21 --ui.sidebarSection( function()
|
bsw@1045
|
22
|
bsw@1045
|
23 if public_contacts_selector:count() == 0 then
|
bsw@1045
|
24 ui.sidebarSection( function()
|
bsw@1045
|
25 ui.field.text{ value = _"No published contacts" }
|
bsw@1045
|
26 end )
|
bsw@1045
|
27 else
|
bsw@1045
|
28 ui.paginate{
|
bsw@1045
|
29 selector = public_contacts_selector,
|
bsw@1045
|
30 name = "contacts",
|
bsw@1045
|
31 content = function()
|
bsw@1045
|
32 local contacts = public_contacts_selector:exec()
|
bsw@1045
|
33 for i, contact in ipairs(contacts) do
|
bsw@1045
|
34 ui.sidebarSection( "sidebarRowNarrow", function()
|
bsw@1045
|
35 execute.view{ module = "member_image", view = "_show", params = {
|
bsw@1045
|
36 member_id = contact.other_member.id, class = "micro_avatar",
|
bsw@1045
|
37 popup_text = contact.other_member.name,
|
bsw@1045
|
38 image_type = "avatar", show_dummy = true,
|
bsw@1045
|
39 } }
|
bsw@1045
|
40 slot.put(" ")
|
bsw@1045
|
41 ui.link{
|
bsw@1045
|
42 content = contact.other_member.name,
|
bsw@1045
|
43 module = "member",
|
bsw@1045
|
44 view = "show",
|
bsw@1045
|
45 id = contact.other_member.id
|
bsw@1045
|
46 }
|
bsw@1045
|
47 end )
|
bsw@1045
|
48 end
|
bsw@1045
|
49 end
|
bsw@1045
|
50 }
|
bsw@1045
|
51 end
|
bsw@1045
|
52 --end )
|
bsw@1045
|
53
|
bsw@1045
|
54
|
bsw@1045
|
55 if member.id == app.session.member.id and private_contacts_selector:count() > 0 then
|
bsw@1045
|
56
|
bsw@1045
|
57 ui.sidebarHead( function()
|
bsw@1045
|
58 ui.heading { level = 2, content = _"Private contacts" }
|
bsw@1045
|
59 end )
|
bsw@1045
|
60
|
bsw@1045
|
61 ui.paginate{
|
bsw@1045
|
62 selector = private_contacts_selector,
|
bsw@1045
|
63 name = "contacts",
|
bsw@1045
|
64 content = function()
|
bsw@1045
|
65 local contacts = private_contacts_selector:exec()
|
bsw@1045
|
66 for i, contact in ipairs(contacts) do
|
bsw@1045
|
67 ui.sidebarSection( "sidebarRowNarrow", function()
|
bsw@1045
|
68 execute.view{ module = "member_image", view = "_show", params = {
|
bsw@1045
|
69 member_id = contact.other_member.id, class = "micro_avatar",
|
bsw@1045
|
70 popup_text = contact.other_member.name,
|
bsw@1045
|
71 image_type = "avatar", show_dummy = true,
|
bsw@1045
|
72 } }
|
bsw@1045
|
73 slot.put(" ")
|
bsw@1045
|
74 ui.link{
|
bsw@1045
|
75 content = contact.other_member.name,
|
bsw@1045
|
76 module = "member",
|
bsw@1045
|
77 view = "show",
|
bsw@1045
|
78 id = contact.other_member.id
|
bsw@1045
|
79 }
|
bsw@1045
|
80 end )
|
bsw@1045
|
81 end
|
bsw@1045
|
82 end
|
bsw@1045
|
83 }
|
bsw@1045
|
84
|
bsw@1045
|
85 end
|
bsw@1045
|
86 end ) |