bsw@1045: local member = param.get("member", "table") bsw@1045: bsw@1045: local public_contacts_selector = Contact:build_selector{ bsw@1045: public = true, bsw@1045: member_id = member.id, bsw@1045: order = "name" bsw@1045: } bsw@1045: bsw@1045: local private_contacts_selector = Contact:build_selector{ bsw@1045: public = false, bsw@1045: member_id = member.id, bsw@1045: order = "name" bsw@1045: } bsw@1045: bsw@1045: ui.sidebar( "tab-members", function() bsw@1045: bsw@1045: ui.sidebarHead( function() bsw@1045: ui.heading { level = 2, content = _"Published contacts" } bsw@1045: end ) bsw@1045: bsw@1045: --ui.sidebarSection( function() bsw@1045: bsw@1045: if public_contacts_selector:count() == 0 then bsw@1045: ui.sidebarSection( function() bsw@1045: ui.field.text{ value = _"No published contacts" } bsw@1045: end ) bsw@1045: else bsw@1045: ui.paginate{ bsw@1045: selector = public_contacts_selector, bsw@1045: name = "contacts", bsw@1045: content = function() bsw@1045: local contacts = public_contacts_selector:exec() bsw@1045: for i, contact in ipairs(contacts) do bsw@1045: ui.sidebarSection( "sidebarRowNarrow", function() bsw@1045: execute.view{ module = "member_image", view = "_show", params = { bsw@1045: member_id = contact.other_member.id, class = "micro_avatar", bsw@1045: popup_text = contact.other_member.name, bsw@1045: image_type = "avatar", show_dummy = true, bsw@1045: } } bsw@1045: slot.put(" ") bsw@1045: ui.link{ bsw@1045: content = contact.other_member.name, bsw@1045: module = "member", bsw@1045: view = "show", bsw@1045: id = contact.other_member.id bsw@1045: } bsw@1045: end ) bsw@1045: end bsw@1045: end bsw@1045: } bsw@1045: end bsw@1045: --end ) bsw@1045: bsw@1045: bsw@1085: if app.session.member_id and app.session.member_id == member.id bsw@1085: and private_contacts_selector:count() > 0 bsw@1085: then bsw@1045: bsw@1045: ui.sidebarHead( function() bsw@1045: ui.heading { level = 2, content = _"Private contacts" } bsw@1045: end ) bsw@1045: bsw@1045: ui.paginate{ bsw@1045: selector = private_contacts_selector, bsw@1045: name = "contacts", bsw@1045: content = function() bsw@1045: local contacts = private_contacts_selector:exec() bsw@1045: for i, contact in ipairs(contacts) do bsw@1045: ui.sidebarSection( "sidebarRowNarrow", function() bsw@1045: execute.view{ module = "member_image", view = "_show", params = { bsw@1045: member_id = contact.other_member.id, class = "micro_avatar", bsw@1045: popup_text = contact.other_member.name, bsw@1045: image_type = "avatar", show_dummy = true, bsw@1045: } } bsw@1045: slot.put(" ") bsw@1045: ui.link{ bsw@1045: content = contact.other_member.name, bsw@1045: module = "member", bsw@1045: view = "show", bsw@1045: id = contact.other_member.id bsw@1045: } bsw@1045: end ) bsw@1045: end bsw@1045: end bsw@1045: } bsw@1045: bsw@1045: end bsw@1045: end )