# HG changeset patch # User bsw # Date 1448988196 -3600 # Node ID 554b739f86d6b03d99727e1b83ea53f726025ed4 # Parent e0235b3d19ee7b70821ffd1108eb6d68626d5a49 Removed developer settings diff -r e0235b3d19ee -r 554b739f86d6 app/main/member/_action/update_api_key.lua --- a/app/main/member/_action/update_api_key.lua Tue Dec 01 17:29:54 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - -local api_key - -if param.get_id() and param.get("delete", atom.boolean) then - - local member_application = MemberApplication:by_id(param.get_id()) - - if member_application then - member_application:destroy() - end - - slot.put_into("notice", _"API key has been deleted") -else - - local member_application = MemberApplication:new() - member_application.member_id = app.session.member_id - member_application.key = multirand.string( - 20, - '23456789BCDFGHJKLMNPQRSTVWXYZbcdfghjkmnpqrstvwxyz' - ) - member_application.name = 'member' - member_application.comment = '' - member_application.access_level = 'member' - - member_application:save() - slot.put_into("notice", _"API key has been created") -end diff -r e0235b3d19ee -r 554b739f86d6 app/main/member/_action/update_stylesheet_url.lua --- a/app/main/member/_action/update_stylesheet_url.lua Tue Dec 01 17:29:54 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ - -local setting_key = "liquidfeedback_frontend_developer_features" -local setting = Setting:by_pk(app.session.member.id, setting_key) - -if not setting then - error("access denied") -end - -local stylesheet_url = util.trim(param.get("stylesheet_url")) -local setting_key = "liquidfeedback_frontend_stylesheet_url" -local setting = Setting:by_pk(app.session.member.id, setting_key) - -if stylesheet_url and #stylesheet_url > 0 then - if not setting then - setting = Setting:new() - setting.member_id = app.session.member.id - setting.key = setting_key - end - setting.value = stylesheet_url - setting:save() -elseif setting then - setting:destroy() -end - -slot.put_into("notice", _"Stylesheet URL has been updated") diff -r e0235b3d19ee -r 554b739f86d6 app/main/member/_sidebar_whatcanido.lua --- a/app/main/member/_sidebar_whatcanido.lua Tue Dec 01 17:29:54 2015 +0100 +++ b/app/main/member/_sidebar_whatcanido.lua Tue Dec 01 17:43:16 2015 +0100 @@ -81,7 +81,6 @@ if not util.is_profile_field_locked(app.session.member, "password") then pages[#pages+1] = { view = "settings_password", text = _"change your password" } end - pages[#pages+1] = { view = "developer_settings", text = _"developer settings" } if config.download_dir then pages[#pages+1] = { module = "index", view = "download", text = _"database download" } diff -r e0235b3d19ee -r 554b739f86d6 app/main/member/developer_settings.lua --- a/app/main/member/developer_settings.lua Tue Dec 01 17:29:54 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -ui.title(_"Developer settings") - -execute.view { - module = "member", view = "_sidebar_whatcanido", params = { - member = app.session.member - } -} - -local setting_key = "liquidfeedback_frontend_developer_features" -local setting = Setting:by_pk(app.session.member.id, setting_key) - -if setting then - ui.section( function() - ui.sectionHead( function () - ui.heading{ content = "CSS development settings" } - end ) - - ui.sectionRow( function() - ui.form{ - attr = { class = "vertical" }, - module = "member", - action = "update_stylesheet_url", - routing = { - ok = { - mode = "redirect", - module = "member", - view = "show", - id = app.session.member_id - } - }, - content = function() - local setting_key = "liquidfeedback_frontend_stylesheet_url" - local setting = Setting:by_pk(app.session.member.id, setting_key) - local value = setting and setting.value - ui.field.text{ - label = "stylesheet URL", - name = "stylesheet_url", - value = value - } - ui.submit{ value = _"Set URL" } - end - } - end ) - end ) -end - -ui.section( function() - ui.sectionHead( function () - ui.heading{ content = "API keys" } - end ) - - ui.sectionRow( function() - local member_applications = MemberApplication:new_selector() - :add_where{ "member_id = ?", app.session.member.id } - :add_order_by("name, id") - :exec() - - if #member_applications > 0 then - - ui.list{ - records = member_applications, - columns = { - { - name = "name", - label = "Name" - }, - { - name = "access_level", - label = "Access level" - }, - { - name = "key", - label = "API Key" - }, - { - name = "last_usage", - label = "Last usage" - }, - { - content = function(member_application) - ui.link{ - text = "delete", - module = "member", action = "update_api_key", id = member_application.id, - params = { delete = true }, - routing = { - default = { - mode = "redirect", - module = "member", - view = "developer_settings" - } - } - } - end - }, - } - } - - else - - slot.put(_"Currently no API key is set.") - slot.put(" ") - ui.link{ - text = _"Generate API key", - module = "member", - action = "update_api_key", - routing = { - default = { - mode = "redirect", - module = "member", - view = "developer_settings" - } - } - } - end - end ) -end ) \ No newline at end of file