| 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 
 | 
| 
bsw@1045
 | 
    85       if config.download_dir then
 | 
| 
bsw@1045
 | 
    86         pages[#pages+1] = { module = "index", view = "download",      text = _"database download" }
 | 
| 
bsw@1045
 | 
    87       end
 | 
| 
bsw@1045
 | 
    88 
 | 
| 
bsw@1045
 | 
    89       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
    90         for i, page in ipairs(pages) do
 | 
| 
bsw@1045
 | 
    91           ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
    92             ui.link{
 | 
| 
bsw@1045
 | 
    93               module = page.module or "member",
 | 
| 
bsw@1045
 | 
    94               view = page.view,
 | 
| 
bsw@1045
 | 
    95               text = page.text
 | 
| 
bsw@1045
 | 
    96             }
 | 
| 
bsw@1045
 | 
    97           end }
 | 
| 
bsw@1045
 | 
    98         end
 | 
| 
bsw@1045
 | 
    99       end }
 | 
| 
bsw@1045
 | 
   100     end )
 | 
| 
bsw@1045
 | 
   101     
 | 
| 
bsw@1045
 | 
   102     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
   103       ui.heading { level = 3, content = _"I want to logout" }
 | 
| 
bsw@1045
 | 
   104       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
   105         ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
   106           ui.link{
 | 
| 
bsw@1045
 | 
   107             text   = _"logout",
 | 
| 
bsw@1045
 | 
   108             module = 'index',
 | 
| 
bsw@1045
 | 
   109             action = 'logout',
 | 
| 
bsw@1045
 | 
   110             routing = {
 | 
| 
bsw@1045
 | 
   111               default = {
 | 
| 
bsw@1045
 | 
   112                 mode = "redirect",
 | 
| 
bsw@1045
 | 
   113                 module = "index",
 | 
| 
bsw@1045
 | 
   114                 view = "index"
 | 
| 
bsw@1045
 | 
   115               }
 | 
| 
bsw@1045
 | 
   116             }
 | 
| 
bsw@1045
 | 
   117           }
 | 
| 
bsw@1045
 | 
   118         end }
 | 
| 
bsw@1045
 | 
   119       end }
 | 
| 
bsw@1045
 | 
   120     end )
 | 
| 
bsw@1045
 | 
   121     
 | 
| 
bsw@1045
 | 
   122     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
   123       ui.heading { level = 3, content = _"I want to change the interface language" }
 | 
| 
bsw@1045
 | 
   124       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1045
 | 
   125         for i, lang in ipairs(config.enabled_languages) do
 | 
| 
bsw@1045
 | 
   126           
 | 
| 
bsw@1045
 | 
   127           local langcode
 | 
| 
bsw@1045
 | 
   128           
 | 
| 
bsw@1045
 | 
   129           locale.do_with({ lang = lang }, function()
 | 
| 
bsw@1045
 | 
   130             langcode = _("[Name of Language]")
 | 
| 
bsw@1045
 | 
   131           end)
 | 
| 
bsw@1045
 | 
   132           
 | 
| 
bsw@1045
 | 
   133           ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1045
 | 
   134             ui.link{
 | 
| 
bsw@1045
 | 
   135               content = _('Select language "#{langcode}"', { langcode = langcode }),
 | 
| 
bsw@1045
 | 
   136               module = "index",
 | 
| 
bsw@1045
 | 
   137               action = "set_lang",
 | 
| 
bsw@1045
 | 
   138               params = { lang = lang },
 | 
| 
bsw@1045
 | 
   139               routing = {
 | 
| 
bsw@1045
 | 
   140                 default = {
 | 
| 
bsw@1045
 | 
   141                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   142                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   143                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   144                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   145                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   146                 }
 | 
| 
bsw@1045
 | 
   147               }
 | 
| 
bsw@1045
 | 
   148             }
 | 
| 
bsw@1045
 | 
   149           end }
 | 
| 
bsw@1045
 | 
   150         end
 | 
| 
bsw@1045
 | 
   151       end }
 | 
| 
bsw@1045
 | 
   152     end )
 | 
| 
bsw@1045
 | 
   153   elseif app.session.member_id and not (member.id == app.session.member.id) then
 | 
| 
bsw@1045
 | 
   154     
 | 
| 
bsw@1045
 | 
   155     ui.sidebarSection( function ()
 | 
| 
bsw@1045
 | 
   156 
 | 
| 
bsw@1045
 | 
   157       local contact = Contact:by_pk(app.session.member.id, member.id)
 | 
| 
bsw@1045
 | 
   158       if not contact then
 | 
| 
bsw@1045
 | 
   159         ui.heading { level = 3, content = _"I want to save this member as contact (i.e. to use as delegatee)" }
 | 
| 
bsw@1045
 | 
   160         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   161           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   162             ui.link{
 | 
| 
bsw@1045
 | 
   163               text    = _"add to my list of public contacts",
 | 
| 
bsw@1045
 | 
   164               module  = "contact",
 | 
| 
bsw@1045
 | 
   165               action  = "add_member",
 | 
| 
bsw@1045
 | 
   166               id      = member.id,
 | 
| 
bsw@1045
 | 
   167               params = { public = true },
 | 
| 
bsw@1045
 | 
   168               routing = {
 | 
| 
bsw@1045
 | 
   169                 default = {
 | 
| 
bsw@1045
 | 
   170                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   171                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   172                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   173                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   174                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   175                 }
 | 
| 
bsw@1045
 | 
   176               }
 | 
| 
bsw@1045
 | 
   177             }
 | 
| 
bsw@1045
 | 
   178           end }
 | 
| 
bsw@1045
 | 
   179           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   180             ui.link{
 | 
| 
bsw@1045
 | 
   181               text    = _"add to my list of private contacts",
 | 
| 
bsw@1045
 | 
   182               module  = "contact",
 | 
| 
bsw@1045
 | 
   183               action  = "add_member",
 | 
| 
bsw@1045
 | 
   184               id      = member.id,
 | 
| 
bsw@1045
 | 
   185               routing = {
 | 
| 
bsw@1045
 | 
   186                 default = {
 | 
| 
bsw@1045
 | 
   187                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   188                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   189                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   190                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   191                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   192                 }
 | 
| 
bsw@1045
 | 
   193               }
 | 
| 
bsw@1045
 | 
   194             }
 | 
| 
bsw@1045
 | 
   195           end }
 | 
| 
bsw@1045
 | 
   196         end }
 | 
| 
bsw@1045
 | 
   197       elseif contact.public then
 | 
| 
bsw@1045
 | 
   198         ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee) and others can see it" }
 | 
| 
bsw@1045
 | 
   199         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   200           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   201             ui.link{
 | 
| 
bsw@1045
 | 
   202               text   = _"make this contact private",
 | 
| 
bsw@1045
 | 
   203               module = "contact",
 | 
| 
bsw@1045
 | 
   204               action = "add_member",
 | 
| 
bsw@1045
 | 
   205               id     = contact.other_member_id,
 | 
| 
bsw@1045
 | 
   206               params = { public = false },
 | 
| 
bsw@1045
 | 
   207               routing = {
 | 
| 
bsw@1045
 | 
   208                 default = {
 | 
| 
bsw@1045
 | 
   209                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   210                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   211                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   212                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   213                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   214                 }
 | 
| 
bsw@1045
 | 
   215               }
 | 
| 
bsw@1045
 | 
   216             }
 | 
| 
bsw@1045
 | 
   217           end }
 | 
| 
bsw@1045
 | 
   218           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   219             ui.link{
 | 
| 
bsw@1045
 | 
   220               text   = _"remove from my contact list",
 | 
| 
bsw@1045
 | 
   221               module = "contact",
 | 
| 
bsw@1045
 | 
   222               action = "remove_member",
 | 
| 
bsw@1045
 | 
   223               id     = contact.other_member_id,
 | 
| 
bsw@1045
 | 
   224               routing = {
 | 
| 
bsw@1045
 | 
   225                 default = {
 | 
| 
bsw@1045
 | 
   226                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   227                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   228                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   229                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   230                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   231                 }
 | 
| 
bsw@1045
 | 
   232               }
 | 
| 
bsw@1045
 | 
   233             }
 | 
| 
bsw@1045
 | 
   234           end }
 | 
| 
bsw@1045
 | 
   235         end }
 | 
| 
bsw@1045
 | 
   236       else
 | 
| 
bsw@1045
 | 
   237         ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee)" }
 | 
| 
bsw@1045
 | 
   238         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   239           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   240             ui.link{
 | 
| 
bsw@1045
 | 
   241               text   = _"make this contact public",
 | 
| 
bsw@1045
 | 
   242               module = "contact",
 | 
| 
bsw@1045
 | 
   243               action = "add_member",
 | 
| 
bsw@1045
 | 
   244               id     = contact.other_member_id,
 | 
| 
bsw@1045
 | 
   245               params = { public = true },
 | 
| 
bsw@1045
 | 
   246               routing = {
 | 
| 
bsw@1045
 | 
   247                 default = {
 | 
| 
bsw@1045
 | 
   248                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   249                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   250                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   251                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   252                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   253                 }
 | 
| 
bsw@1045
 | 
   254               }
 | 
| 
bsw@1045
 | 
   255             }
 | 
| 
bsw@1045
 | 
   256           end }
 | 
| 
bsw@1045
 | 
   257           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   258             ui.link{
 | 
| 
bsw@1045
 | 
   259               text   = _"remove from my contact list",
 | 
| 
bsw@1045
 | 
   260               module = "contact",
 | 
| 
bsw@1045
 | 
   261               action = "remove_member",
 | 
| 
bsw@1045
 | 
   262               id     = contact.other_member_id,
 | 
| 
bsw@1045
 | 
   263               routing = {
 | 
| 
bsw@1045
 | 
   264                 default = {
 | 
| 
bsw@1045
 | 
   265                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   266                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   267                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   268                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   269                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   270                 }
 | 
| 
bsw@1045
 | 
   271               }
 | 
| 
bsw@1045
 | 
   272             }
 | 
| 
bsw@1045
 | 
   273           end }
 | 
| 
bsw@1045
 | 
   274         end }
 | 
| 
bsw@1045
 | 
   275       end
 | 
| 
bsw@1045
 | 
   276     end )
 | 
| 
bsw@1045
 | 
   277     
 | 
| 
bsw@1045
 | 
   278     ui.sidebarSection( function()
 | 
| 
bsw@1045
 | 
   279       local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
 | 
| 
bsw@1045
 | 
   280       if not ignored_member then
 | 
| 
bsw@1045
 | 
   281         ui.heading { level = 3, content = _"I do not like to hear from this member" }
 | 
| 
bsw@1045
 | 
   282         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   283           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   284             ui.link{
 | 
| 
bsw@1045
 | 
   285               attr = { class = "interest" },
 | 
| 
bsw@1045
 | 
   286               text    = _"block this member",
 | 
| 
bsw@1045
 | 
   287               module  = "member",
 | 
| 
bsw@1045
 | 
   288               action  = "update_ignore_member",
 | 
| 
bsw@1045
 | 
   289               id      = member.id,
 | 
| 
bsw@1045
 | 
   290               routing = {
 | 
| 
bsw@1045
 | 
   291                 default = {
 | 
| 
bsw@1045
 | 
   292                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   293                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   294                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   295                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   296                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   297                 }
 | 
| 
bsw@1045
 | 
   298               }
 | 
| 
bsw@1045
 | 
   299             }
 | 
| 
bsw@1045
 | 
   300           end }
 | 
| 
bsw@1045
 | 
   301         end }
 | 
| 
bsw@1045
 | 
   302       else
 | 
| 
bsw@1045
 | 
   303         ui.heading { level = 3, content = _"You blocked this member (i.e. you will not be notified about this members actions)" }
 | 
| 
bsw@1045
 | 
   304         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   305           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   306             ui.link{
 | 
| 
bsw@1045
 | 
   307               text   = _"unblock member",
 | 
| 
bsw@1045
 | 
   308               module = "member",
 | 
| 
bsw@1045
 | 
   309               action = "update_ignore_member",
 | 
| 
bsw@1045
 | 
   310               id     = member.id,
 | 
| 
bsw@1045
 | 
   311               params = { delete = true },
 | 
| 
bsw@1045
 | 
   312               routing = {
 | 
| 
bsw@1045
 | 
   313                 default = {
 | 
| 
bsw@1045
 | 
   314                   mode = "redirect",
 | 
| 
bsw@1045
 | 
   315                   module = request.get_module(),
 | 
| 
bsw@1045
 | 
   316                   view = request.get_view(),
 | 
| 
bsw@1145
 | 
   317                   id = request.get_id_string(),
 | 
| 
bsw@1145
 | 
   318                   params = request.get_param_strings()
 | 
| 
bsw@1045
 | 
   319                 }
 | 
| 
bsw@1045
 | 
   320               }
 | 
| 
bsw@1045
 | 
   321             }
 | 
| 
bsw@1045
 | 
   322           end }
 | 
| 
bsw@1045
 | 
   323         end }
 | 
| 
bsw@1045
 | 
   324       end
 | 
| 
bsw@1045
 | 
   325     end )
 | 
| 
bsw@1045
 | 
   326   end
 | 
| 
bsw@1045
 | 
   327 end ) |