| 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@1085
 | 
    55   if app.session.member_id and app.session.member_id == member.id 
 | 
| 
bsw@1085
 | 
    56     and private_contacts_selector:count() > 0
 | 
| 
bsw@1085
 | 
    57   then
 | 
| 
bsw@1045
 | 
    58 
 | 
| 
bsw@1045
 | 
    59     ui.sidebarHead( function()
 | 
| 
bsw@1045
 | 
    60       ui.heading { level = 2, content = _"Private contacts" }
 | 
| 
bsw@1045
 | 
    61     end )
 | 
| 
bsw@1045
 | 
    62     
 | 
| 
bsw@1045
 | 
    63     ui.paginate{
 | 
| 
bsw@1045
 | 
    64       selector = private_contacts_selector,
 | 
| 
bsw@1045
 | 
    65       name = "contacts",
 | 
| 
bsw@1045
 | 
    66       content = function()
 | 
| 
bsw@1045
 | 
    67         local contacts = private_contacts_selector:exec()
 | 
| 
bsw@1045
 | 
    68         for i, contact in ipairs(contacts) do
 | 
| 
bsw@1045
 | 
    69           ui.sidebarSection( "sidebarRowNarrow", function()
 | 
| 
bsw@1045
 | 
    70             execute.view{ module = "member_image", view = "_show", params = {
 | 
| 
bsw@1045
 | 
    71               member_id = contact.other_member.id, class = "micro_avatar", 
 | 
| 
bsw@1045
 | 
    72               popup_text = contact.other_member.name,
 | 
| 
bsw@1045
 | 
    73               image_type = "avatar", show_dummy = true,
 | 
| 
bsw@1045
 | 
    74             } }
 | 
| 
bsw@1045
 | 
    75             slot.put(" ")
 | 
| 
bsw@1045
 | 
    76             ui.link{
 | 
| 
bsw@1045
 | 
    77               content = contact.other_member.name,
 | 
| 
bsw@1045
 | 
    78               module = "member",
 | 
| 
bsw@1045
 | 
    79               view = "show",
 | 
| 
bsw@1045
 | 
    80               id = contact.other_member.id
 | 
| 
bsw@1045
 | 
    81             }
 | 
| 
bsw@1045
 | 
    82           end )
 | 
| 
bsw@1045
 | 
    83         end
 | 
| 
bsw@1045
 | 
    84       end
 | 
| 
bsw@1045
 | 
    85     }
 | 
| 
bsw@1045
 | 
    86 
 | 
| 
bsw@1045
 | 
    87   end
 | 
| 
bsw@1045
 | 
    88 end ) |