| rev | 
   line source | 
| 
bsw@1045
 | 
     1 local member = param.get("member", "table")
 | 
| 
bsw@1045
 | 
     2 
 | 
| 
bsw@1045
 | 
     3 ui.sidebar( "tab-whatcanido", function()
 | 
| 
bsw@1045
 | 
     4 
 | 
| 
bsw@1045
 | 
     5   if not member.active then
 | 
| 
bsw@1045
 | 
     6     ui.container{ attr = { class = "sidebarSection" }, content = function()
 | 
| 
bsw@1045
 | 
     7       slot.put(" · ")
 | 
| 
bsw@1045
 | 
     8       ui.tag{
 | 
| 
bsw@1045
 | 
     9         attr = { class = "interest deactivated_member_info" },
 | 
| 
bsw@1045
 | 
    10         content = _"This member is inactive"
 | 
| 
bsw@1045
 | 
    11       }
 | 
| 
bsw@1045
 | 
    12     end }   
 | 
| 
bsw@1045
 | 
    13   end
 | 
| 
bsw@1045
 | 
    14   
 | 
| 
bsw@1045
 | 
    15   if member.locked then
 | 
| 
bsw@1045
 | 
    16     ui.container{ attr = { class = "sidebarSection" }, content = function()
 | 
| 
bsw@1045
 | 
    17       slot.put(" · ")
 | 
| 
bsw@1045
 | 
    18       ui.tag{
 | 
| 
bsw@1045
 | 
    19         attr = { class = "interest deactivated_member_info" },
 | 
| 
bsw@1045
 | 
    20         content = _"This member is locked"
 | 
| 
bsw@1045
 | 
    21       }
 | 
| 
bsw@1045
 | 
    22     end }   
 | 
| 
bsw@1045
 | 
    23   end
 | 
| 
bsw@1045
 | 
    24 
 | 
| 
bsw@1045
 | 
    25   
 | 
| 
bsw@1045
 | 
    26   ui.sidebarHeadWhatCanIDo()
 | 
| 
bsw@1045
 | 
    27 
 | 
| 
bsw@1045
 | 
    28   if member.id == app.session.member_id and not app.session.needs_delegation_check then
 | 
| 
bsw@1045
 | 
    29     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
    30       ui.heading { level = 3, content = _"I want to customize my profile" }
 | 
| 
bsw@1045
 | 
    31       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
    32         ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
    33           ui.link{
 | 
| 
bsw@1045
 | 
    34             content = _"edit profile data",
 | 
| 
bsw@1045
 | 
    35             module  = "member",
 | 
| 
bsw@1045
 | 
    36             view    = "edit"
 | 
| 
bsw@1045
 | 
    37           }
 | 
| 
bsw@1045
 | 
    38         end }
 | 
| 
bsw@1045
 | 
    39         ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
    40           ui.link{
 | 
| 
bsw@1045
 | 
    41             content = _"change avatar/photo",
 | 
| 
bsw@1045
 | 
    42             module  = "member",
 | 
| 
bsw@1045
 | 
    43             view    = "edit_images"
 | 
| 
bsw@1045
 | 
    44           }
 | 
| 
bsw@1045
 | 
    45         end }
 | 
| 
bsw@1045
 | 
    46       end }
 | 
| 
bsw@1045
 | 
    47     end )
 | 
| 
bsw@1045
 | 
    48     --[[
 | 
| 
bsw@1045
 | 
    49     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
    50       ui.heading { level = 3, content = _"I want to manage my saved contacts" }
 | 
| 
bsw@1045
 | 
    51       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
    52         ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
    53 
 | 
| 
bsw@1045
 | 
    54           ui.link{
 | 
| 
bsw@1045
 | 
    55             content = _"show saved contacts",
 | 
| 
bsw@1045
 | 
    56             module = 'contact',
 | 
| 
bsw@1045
 | 
    57             view   = 'list'
 | 
| 
bsw@1045
 | 
    58           }
 | 
| 
bsw@1045
 | 
    59 
 | 
| 
bsw@1045
 | 
    60         end }
 | 
| 
bsw@1045
 | 
    61       end }
 | 
| 
bsw@1045
 | 
    62     end )
 | 
| 
bsw@1045
 | 
    63     --]]
 | 
| 
bsw@1045
 | 
    64     
 | 
| 
bsw@1045
 | 
    65     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
    66 
 | 
| 
bsw@1045
 | 
    67       ui.heading { level = 3, content = _"I want to change account settings" }
 | 
| 
bsw@1045
 | 
    68 
 | 
| 
bsw@1045
 | 
    69       local pages = {}
 | 
| 
bsw@1045
 | 
    70 
 | 
| 
bsw@1045
 | 
    71       pages[#pages+1] = { view = "settings_notification", text = _"notification settings" }
 | 
| 
bsw@1071
 | 
    72       if not util.is_profile_field_locked(app.session.member, "notify_email") then
 | 
| 
bsw@1045
 | 
    73         pages[#pages+1] = { view = "settings_email",          text = _"change your notification email address" }
 | 
| 
bsw@1045
 | 
    74       end
 | 
| 
bsw@1071
 | 
    75       if not util.is_profile_field_locked(app.session.member, "name") then
 | 
| 
bsw@1045
 | 
    76         pages[#pages+1] = { view = "settings_name",           text = _"change your screen name" }
 | 
| 
bsw@1045
 | 
    77       end
 | 
| 
bsw@1071
 | 
    78       if not util.is_profile_field_locked(app.session.member, "login") then
 | 
| 
bsw@1045
 | 
    79         pages[#pages+1] = { view = "settings_login",          text = _"change your login" }
 | 
| 
bsw@1045
 | 
    80       end
 | 
| 
bsw@1071
 | 
    81       if not util.is_profile_field_locked(app.session.member, "password") then
 | 
| 
bsw@1071
 | 
    82         pages[#pages+1] = { view = "settings_password",       text = _"change your password" }
 | 
| 
bsw@1071
 | 
    83       end
 | 
| 
bsw@1045
 | 
    84       pages[#pages+1] = { view = "developer_settings",      text = _"developer settings" }
 | 
| 
bsw@1045
 | 
    85 
 | 
| 
bsw@1045
 | 
    86       if config.download_dir then
 | 
| 
bsw@1045
 | 
    87         pages[#pages+1] = { module = "index", view = "download",      text = _"database download" }
 | 
| 
bsw@1045
 | 
    88       end
 | 
| 
bsw@1045
 | 
    89 
 | 
| 
bsw@1045
 | 
    90       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
    91         for i, page in ipairs(pages) do
 | 
| 
bsw@1045
 | 
    92           ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
    93             ui.link{
 | 
| 
bsw@1045
 | 
    94               module = page.module or "member",
 | 
| 
bsw@1045
 | 
    95               view = page.view,
 | 
| 
bsw@1045
 | 
    96               text = page.text
 | 
| 
bsw@1045
 | 
    97             }
 | 
| 
bsw@1045
 | 
    98           end }
 | 
| 
bsw@1045
 | 
    99         end
 | 
| 
bsw@1045
 | 
   100       end }
 | 
| 
bsw@1045
 | 
   101     end )
 | 
| 
bsw@1045
 | 
   102     
 | 
| 
bsw@1045
 | 
   103     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
   104       ui.heading { level = 3, content = _"I want to logout" }
 | 
| 
bsw@1045
 | 
   105       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
   106         ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
   107           ui.link{
 | 
| 
bsw@1045
 | 
   108             text   = _"logout",
 | 
| 
bsw@1045
 | 
   109             module = 'index',
 | 
| 
bsw@1045
 | 
   110             action = 'logout',
 | 
| 
bsw@1045
 | 
   111             routing = {
 | 
| 
bsw@1045
 | 
   112               default = {
 | 
| 
bsw@1045
 | 
   113                 mode = "redirect",
 | 
| 
bsw@1045
 | 
   114                 module = "index",
 | 
| 
bsw@1045
 | 
   115                 view = "index"
 | 
| 
bsw@1045
 | 
   116               }
 | 
| 
bsw@1045
 | 
   117             }
 | 
| 
bsw@1045
 | 
   118           }
 | 
| 
bsw@1045
 | 
   119         end }
 | 
| 
bsw@1045
 | 
   120       end }
 | 
| 
bsw@1045
 | 
   121     end )
 | 
| 
bsw@1045
 | 
   122     
 | 
| 
bsw@1045
 | 
   123     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
   124       ui.heading { level = 3, content = _"I want to change the interface language" }
 | 
| 
bsw@1045
 | 
   125       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
   126         for i, lang in ipairs(config.enabled_languages) do
 | 
| 
bsw@1045
 | 
   127           
 | 
| 
bsw@1045
 | 
   128           local langcode
 | 
| 
bsw@1045
 | 
   129           
 | 
| 
bsw@1045
 | 
   130           locale.do_with({ lang = lang }, function()
 | 
| 
bsw@1045
 | 
   131             langcode = _("[Name of Language]")
 | 
| 
bsw@1045
 | 
   132           end)
 | 
| 
bsw@1045
 | 
   133           
 | 
| 
bsw@1045
 | 
   134           ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
   135             ui.link{
 | 
| 
bsw@1045
 | 
   136               content = _('Select language "#{langcode}"', { langcode = langcode }),
 | 
| 
bsw@1045
 | 
   137               module = "index",
 | 
| 
bsw@1045
 | 
   138               action = "set_lang",
 | 
| 
bsw@1045
 | 
   139               params = { lang = lang },
 | 
| 
bsw@1045
 | 
   140               routing = {
 | 
| 
bsw@1045
 | 
   141                 default = {
 | 
| 
bsw@1045
 | 
   142                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   143                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   144                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   145                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   146                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   147                 }
 | 
| 
bsw@1045
 | 
   148               }
 | 
| 
bsw@1045
 | 
   149             }
 | 
| 
bsw@1045
 | 
   150           end }
 | 
| 
bsw@1045
 | 
   151         end
 | 
| 
bsw@1045
 | 
   152       end }
 | 
| 
bsw@1045
 | 
   153     end )
 | 
| 
bsw@1045
 | 
   154   elseif app.session.member_id and not (member.id == app.session.member.id) then
 | 
| 
bsw@1045
 | 
   155     
 | 
| 
bsw@1045
 | 
   156     ui.sidebarSection( function ()
 | 
| 
bsw@1045
 | 
   157 
 | 
| 
bsw@1045
 | 
   158       local contact = Contact:by_pk(app.session.member.id, member.id)
 | 
| 
bsw@1045
 | 
   159       if not contact then
 | 
| 
bsw@1045
 | 
   160         ui.heading { level = 3, content = _"I want to save this member as contact (i.e. to use as delegatee)" }
 | 
| 
bsw@1045
 | 
   161         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   162           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   163             ui.link{
 | 
| 
bsw@1045
 | 
   164               text    = _"add to my list of public contacts",
 | 
| 
bsw@1045
 | 
   165               module  = "contact",
 | 
| 
bsw@1045
 | 
   166               action  = "add_member",
 | 
| 
bsw@1045
 | 
   167               id      = member.id,
 | 
| 
bsw@1045
 | 
   168               params = { public = true },
 | 
| 
bsw@1045
 | 
   169               routing = {
 | 
| 
bsw@1045
 | 
   170                 default = {
 | 
| 
bsw@1045
 | 
   171                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   172                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   173                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   174                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   175                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   176                 }
 | 
| 
bsw@1045
 | 
   177               }
 | 
| 
bsw@1045
 | 
   178             }
 | 
| 
bsw@1045
 | 
   179           end }
 | 
| 
bsw@1045
 | 
   180           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   181             ui.link{
 | 
| 
bsw@1045
 | 
   182               text    = _"add to my list of private contacts",
 | 
| 
bsw@1045
 | 
   183               module  = "contact",
 | 
| 
bsw@1045
 | 
   184               action  = "add_member",
 | 
| 
bsw@1045
 | 
   185               id      = member.id,
 | 
| 
bsw@1045
 | 
   186               routing = {
 | 
| 
bsw@1045
 | 
   187                 default = {
 | 
| 
bsw@1045
 | 
   188                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   189                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   190                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   191                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   192                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   193                 }
 | 
| 
bsw@1045
 | 
   194               }
 | 
| 
bsw@1045
 | 
   195             }
 | 
| 
bsw@1045
 | 
   196           end }
 | 
| 
bsw@1045
 | 
   197         end }
 | 
| 
bsw@1045
 | 
   198       elseif contact.public then
 | 
| 
bsw@1045
 | 
   199         ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee) and others can see it" }
 | 
| 
bsw@1045
 | 
   200         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   201           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   202             ui.link{
 | 
| 
bsw@1045
 | 
   203               text   = _"make this contact private",
 | 
| 
bsw@1045
 | 
   204               module = "contact",
 | 
| 
bsw@1045
 | 
   205               action = "add_member",
 | 
| 
bsw@1045
 | 
   206               id     = contact.other_member_id,
 | 
| 
bsw@1045
 | 
   207               params = { public = false },
 | 
| 
bsw@1045
 | 
   208               routing = {
 | 
| 
bsw@1045
 | 
   209                 default = {
 | 
| 
bsw@1045
 | 
   210                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   211                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   212                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   213                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   214                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   215                 }
 | 
| 
bsw@1045
 | 
   216               }
 | 
| 
bsw@1045
 | 
   217             }
 | 
| 
bsw@1045
 | 
   218           end }
 | 
| 
bsw@1045
 | 
   219           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   220             ui.link{
 | 
| 
bsw@1045
 | 
   221               text   = _"remove from my contact list",
 | 
| 
bsw@1045
 | 
   222               module = "contact",
 | 
| 
bsw@1045
 | 
   223               action = "remove_member",
 | 
| 
bsw@1045
 | 
   224               id     = contact.other_member_id,
 | 
| 
bsw@1045
 | 
   225               routing = {
 | 
| 
bsw@1045
 | 
   226                 default = {
 | 
| 
bsw@1045
 | 
   227                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   228                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   229                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   230                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   231                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   232                 }
 | 
| 
bsw@1045
 | 
   233               }
 | 
| 
bsw@1045
 | 
   234             }
 | 
| 
bsw@1045
 | 
   235           end }
 | 
| 
bsw@1045
 | 
   236         end }
 | 
| 
bsw@1045
 | 
   237       else
 | 
| 
bsw@1045
 | 
   238         ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee)" }
 | 
| 
bsw@1045
 | 
   239         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   240           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   241             ui.link{
 | 
| 
bsw@1045
 | 
   242               text   = _"make this contact public",
 | 
| 
bsw@1045
 | 
   243               module = "contact",
 | 
| 
bsw@1045
 | 
   244               action = "add_member",
 | 
| 
bsw@1045
 | 
   245               id     = contact.other_member_id,
 | 
| 
bsw@1045
 | 
   246               params = { public = true },
 | 
| 
bsw@1045
 | 
   247               routing = {
 | 
| 
bsw@1045
 | 
   248                 default = {
 | 
| 
bsw@1045
 | 
   249                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   250                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   251                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   252                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   253                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   254                 }
 | 
| 
bsw@1045
 | 
   255               }
 | 
| 
bsw@1045
 | 
   256             }
 | 
| 
bsw@1045
 | 
   257           end }
 | 
| 
bsw@1045
 | 
   258           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   259             ui.link{
 | 
| 
bsw@1045
 | 
   260               text   = _"remove from my contact list",
 | 
| 
bsw@1045
 | 
   261               module = "contact",
 | 
| 
bsw@1045
 | 
   262               action = "remove_member",
 | 
| 
bsw@1045
 | 
   263               id     = contact.other_member_id,
 | 
| 
bsw@1045
 | 
   264               routing = {
 | 
| 
bsw@1045
 | 
   265                 default = {
 | 
| 
bsw@1045
 | 
   266                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   267                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   268                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   269                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   270                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   271                 }
 | 
| 
bsw@1045
 | 
   272               }
 | 
| 
bsw@1045
 | 
   273             }
 | 
| 
bsw@1045
 | 
   274           end }
 | 
| 
bsw@1045
 | 
   275         end }
 | 
| 
bsw@1045
 | 
   276       end
 | 
| 
bsw@1045
 | 
   277     end )
 | 
| 
bsw@1045
 | 
   278     
 | 
| 
bsw@1045
 | 
   279     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
   280       local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
 | 
| 
bsw@1045
 | 
   281       if not ignored_member then
 | 
| 
bsw@1045
 | 
   282         ui.heading { level = 3, content = _"I do not like to hear from this member" }
 | 
| 
bsw@1045
 | 
   283         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   284           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   285             ui.link{
 | 
| 
bsw@1045
 | 
   286               attr = { class = "interest" },
 | 
| 
bsw@1045
 | 
   287               text    = _"block this member",
 | 
| 
bsw@1045
 | 
   288               module  = "member",
 | 
| 
bsw@1045
 | 
   289               action  = "update_ignore_member",
 | 
| 
bsw@1045
 | 
   290               id      = member.id,
 | 
| 
bsw@1045
 | 
   291               routing = {
 | 
| 
bsw@1045
 | 
   292                 default = {
 | 
| 
bsw@1045
 | 
   293                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   294                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   295                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   296                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   297                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   298                 }
 | 
| 
bsw@1045
 | 
   299               }
 | 
| 
bsw@1045
 | 
   300             }
 | 
| 
bsw@1045
 | 
   301           end }
 | 
| 
bsw@1045
 | 
   302         end }
 | 
| 
bsw@1045
 | 
   303       else
 | 
| 
bsw@1045
 | 
   304         ui.heading { level = 3, content = _"You blocked this member (i.e. you will not be notified about this members actions)" }
 | 
| 
bsw@1045
 | 
   305         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   306           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   307             ui.link{
 | 
| 
bsw@1045
 | 
   308               text   = _"unblock member",
 | 
| 
bsw@1045
 | 
   309               module = "member",
 | 
| 
bsw@1045
 | 
   310               action = "update_ignore_member",
 | 
| 
bsw@1045
 | 
   311               id     = member.id,
 | 
| 
bsw@1045
 | 
   312               params = { delete = true },
 | 
| 
bsw@1045
 | 
   313               routing = {
 | 
| 
bsw@1045
 | 
   314                 default = {
 | 
| 
bsw@1045
 | 
   315                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   316                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   317                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   318                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   319                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   320                 }
 | 
| 
bsw@1045
 | 
   321               }
 | 
| 
bsw@1045
 | 
   322             }
 | 
| 
bsw@1045
 | 
   323           end }
 | 
| 
bsw@1045
 | 
   324         end }
 | 
| 
bsw@1045
 | 
   325       end
 | 
| 
bsw@1045
 | 
   326     end )
 | 
| 
bsw@1045
 | 
   327   end
 | 
| 
bsw@1045
 | 
   328 end ) |