bsw@1045: local member = param.get("member", "table") bsw@1045: bsw@1045: ui.sidebar( "tab-whatcanido", function() bsw@1045: bsw@1045: if not member.active then bsw@1045: ui.container{ attr = { class = "sidebarSection" }, content = function() bsw@1045: slot.put(" · ") bsw@1045: ui.tag{ bsw@1045: attr = { class = "interest deactivated_member_info" }, bsw@1045: content = _"This member is inactive" bsw@1045: } bsw@1045: end } bsw@1045: end bsw@1045: bsw@1045: if member.locked then bsw@1045: ui.container{ attr = { class = "sidebarSection" }, content = function() bsw@1045: slot.put(" · ") bsw@1045: ui.tag{ bsw@1045: attr = { class = "interest deactivated_member_info" }, bsw@1045: content = _"This member is locked" bsw@1045: } bsw@1045: end } bsw@1045: end bsw@1045: bsw@1045: bsw@1045: ui.sidebarHeadWhatCanIDo() bsw@1045: bsw@1045: if member.id == app.session.member_id and not app.session.needs_delegation_check then bsw@1045: ui.sidebarSection( function() bsw@1045: ui.heading { level = 3, content = _"I want to customize my profile" } bsw@1045: ui.tag{ tag = "ul", attr = { class = "ul" }, content = function() bsw@1045: ui.tag{ tag = "li", content = function() bsw@1045: ui.link{ bsw@1045: content = _"edit profile data", bsw@1045: module = "member", bsw@1045: view = "edit" bsw@1045: } bsw@1045: end } bsw@1045: ui.tag{ tag = "li", content = function() bsw@1045: ui.link{ bsw@1045: content = _"change avatar/photo", bsw@1045: module = "member", bsw@1045: view = "edit_images" bsw@1045: } bsw@1045: end } bsw@1045: end } bsw@1045: end ) bsw@1045: --[[ bsw@1045: ui.sidebarSection( function() bsw@1045: ui.heading { level = 3, content = _"I want to manage my saved contacts" } bsw@1045: ui.tag{ tag = "ul", attr = { class = "ul" }, content = function() bsw@1045: ui.tag{ tag = "li", content = function() bsw@1045: bsw@1045: ui.link{ bsw@1045: content = _"show saved contacts", bsw@1045: module = 'contact', bsw@1045: view = 'list' bsw@1045: } bsw@1045: bsw@1045: end } bsw@1045: end } bsw@1045: end ) bsw@1045: --]] bsw@1045: bsw@1045: ui.sidebarSection( function() bsw@1045: bsw@1045: ui.heading { level = 3, content = _"I want to change account settings" } bsw@1045: bsw@1045: local pages = {} bsw@1045: bsw@1045: pages[#pages+1] = { view = "settings_notification", text = _"notification settings" } bsw@1045: if not config.locked_profile_fields.notify_email then bsw@1045: pages[#pages+1] = { view = "settings_email", text = _"change your notification email address" } bsw@1045: end bsw@1045: if not config.locked_profile_fields.name then bsw@1045: pages[#pages+1] = { view = "settings_name", text = _"change your screen name" } bsw@1045: end bsw@1045: if not config.locked_profile_fields.login then bsw@1045: pages[#pages+1] = { view = "settings_login", text = _"change your login" } bsw@1045: end bsw@1045: pages[#pages+1] = { view = "settings_password", text = _"change your password" } bsw@1045: pages[#pages+1] = { view = "developer_settings", text = _"developer settings" } bsw@1045: bsw@1045: if config.download_dir then bsw@1045: pages[#pages+1] = { module = "index", view = "download", text = _"database download" } bsw@1045: end bsw@1045: bsw@1045: ui.tag{ tag = "ul", attr = { class = "ul" }, content = function() bsw@1045: for i, page in ipairs(pages) do bsw@1045: ui.tag{ tag = "li", content = function() bsw@1045: ui.link{ bsw@1045: module = page.module or "member", bsw@1045: view = page.view, bsw@1045: text = page.text bsw@1045: } bsw@1045: end } bsw@1045: end bsw@1045: end } bsw@1045: end ) bsw@1045: bsw@1045: ui.sidebarSection( function() bsw@1045: ui.heading { level = 3, content = _"I want to logout" } bsw@1045: ui.tag{ tag = "ul", attr = { class = "ul" }, content = function() bsw@1045: ui.tag{ tag = "li", content = function() bsw@1045: ui.link{ bsw@1045: text = _"logout", bsw@1045: module = 'index', bsw@1045: action = 'logout', bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = "index", bsw@1045: view = "index" bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: end } bsw@1045: end ) bsw@1045: bsw@1045: ui.sidebarSection( function() bsw@1045: ui.heading { level = 3, content = _"I want to change the interface language" } bsw@1045: ui.tag{ tag = "ul", attr = { class = "ul" }, content = function() bsw@1045: for i, lang in ipairs(config.enabled_languages) do bsw@1045: bsw@1045: local langcode bsw@1045: bsw@1045: locale.do_with({ lang = lang }, function() bsw@1045: langcode = _("[Name of Language]") bsw@1045: end) bsw@1045: bsw@1045: ui.tag{ tag = "li", content = function() bsw@1045: ui.link{ bsw@1045: content = _('Select language "#{langcode}"', { langcode = langcode }), bsw@1045: module = "index", bsw@1045: action = "set_lang", bsw@1045: params = { lang = lang }, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: end bsw@1045: end } bsw@1045: end ) bsw@1045: elseif app.session.member_id and not (member.id == app.session.member.id) then bsw@1045: bsw@1045: ui.sidebarSection( function () bsw@1045: bsw@1045: local contact = Contact:by_pk(app.session.member.id, member.id) bsw@1045: if not contact then bsw@1045: ui.heading { level = 3, content = _"I want to save this member as contact (i.e. to use as delegatee)" } bsw@1045: ui.tag { tag = "ul", attr = { class = "ul" }, content = function () bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link{ bsw@1045: text = _"add to my list of public contacts", bsw@1045: module = "contact", bsw@1045: action = "add_member", bsw@1045: id = member.id, bsw@1045: params = { public = true }, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link{ bsw@1045: text = _"add to my list of private contacts", bsw@1045: module = "contact", bsw@1045: action = "add_member", bsw@1045: id = member.id, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: end } bsw@1045: elseif contact.public then bsw@1045: ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee) and others can see it" } bsw@1045: ui.tag { tag = "ul", attr = { class = "ul" }, content = function () bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link{ bsw@1045: text = _"make this contact private", bsw@1045: module = "contact", bsw@1045: action = "add_member", bsw@1045: id = contact.other_member_id, bsw@1045: params = { public = false }, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link{ bsw@1045: text = _"remove from my contact list", bsw@1045: module = "contact", bsw@1045: action = "remove_member", bsw@1045: id = contact.other_member_id, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: end } bsw@1045: else bsw@1045: ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee)" } bsw@1045: ui.tag { tag = "ul", attr = { class = "ul" }, content = function () bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link{ bsw@1045: text = _"make this contact public", bsw@1045: module = "contact", bsw@1045: action = "add_member", bsw@1045: id = contact.other_member_id, bsw@1045: params = { public = true }, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link{ bsw@1045: text = _"remove from my contact list", bsw@1045: module = "contact", bsw@1045: action = "remove_member", bsw@1045: id = contact.other_member_id, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: end } bsw@1045: end bsw@1045: end ) bsw@1045: bsw@1045: ui.sidebarSection( function() bsw@1045: local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id) bsw@1045: if not ignored_member then bsw@1045: ui.heading { level = 3, content = _"I do not like to hear from this member" } bsw@1045: ui.tag { tag = "ul", attr = { class = "ul" }, content = function () bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link{ bsw@1045: attr = { class = "interest" }, bsw@1045: text = _"block this member", bsw@1045: module = "member", bsw@1045: action = "update_ignore_member", bsw@1045: id = member.id, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: end } bsw@1045: else bsw@1045: ui.heading { level = 3, content = _"You blocked this member (i.e. you will not be notified about this members actions)" } bsw@1045: ui.tag { tag = "ul", attr = { class = "ul" }, content = function () bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link{ bsw@1045: text = _"unblock member", bsw@1045: module = "member", bsw@1045: action = "update_ignore_member", bsw@1045: id = member.id, bsw@1045: params = { delete = true }, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = request.get_module(), bsw@1045: view = request.get_view(), bsw@1045: id = param.get_id_cgi(), bsw@1045: params = param.get_all_cgi() bsw@1045: } bsw@1045: } bsw@1045: } bsw@1045: end } bsw@1045: end } bsw@1045: end bsw@1045: end ) bsw@1045: end bsw@1045: end )