LiquidFeedback Frontend Configuration

-- absolute base url of application
config.absolute_base_url = "http://10.8.33.34/lf/"

-- application name
config.app_name = "LiquidFeedback"

-- application version string
config.app_version = "beta18"

-- html title string
config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)"

-- logo image, optional
config.app_logo = nil

-- internal message of the day (rocketwiki)
config.motd_intern = nil

-- public message of the day (rocketwiki)
config.motd_public = nil

-- application service provider, optional including legal information about organisation (html)
config.app_service_provider = "Snake Oil<br/>10000 Berlin<br/>Germany"

-- use terms, has to be accepted by user while registering (rocketwiki)
config.use_terms = "=== Usage terms ===\nExample usage terms."

-- function creating url for automatic issue discussion link (optional)

--config.issue_discussion_url_func = function(issue) return "http://example.com/issue_" .. tostring(issue.id) end

-- email configuration
config.mail_from = "lf@example.com"

--config.mail_reply_to = "lf@example.com" -- optional

-- prefix subject of every automatic generated email
config.mail_subject_prefix = "[LiquidFeedback] "

-- directory on host system containing database dumps for downloading (created by lf_export from lfcore) (optional)
config.download_dir = nil

-- specific use terms displayed on download page
config.download_use_terms = "=== Usage terms ===\nExample usage terms."

-- public read access
config.public_access = false -- Available options: false, "anonymous", "pseudonym" ("full" in development)

-- add message when issues and initiatives are displayed publically

--[[
config.public_access_issue_head = function(issue)
ui.tag{
tag = "div",
attr = { class = "public_access_issue_head" },
content = "Example text"
}
end

--]]

-- HTTP/JSON/XML programming interface (API)
config.api_enabled = false

-- Enable rss feeds (experimental)
config.feature_rss_enabled = false

-- OpenID authentication is not fully implemented yet, DO NOT USE BEFORE THIS NOTICE HAS BEEN REMOVED!
config.auth_openid_enabled = false
config.auth_openid_https_as_default = true
config.auth_openid_identifier_check_func = function(uri) return false end

-- default avatar image, used until user uploads own avatar
config.member_image_default_file = {
avatar = "avatar.jpg",
photo = nil
}

-- external service routines for image conversion
config.member_image_content_type = "image/jpeg"
config.member_image_convert_func = {
avatar = function(data) return os.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
photo = function(data) return os.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
}

-- external web service call for images (optional)

--[[
config.fastpath_url_func = function(member_id, image_type)
return "http://example.com/liquid_feedback/fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type)
end

--]]
config.fastpath_url_func = nil

-- external services for text formatting
config.formatting_engine_executeables = {
rocketwiki= "/opt/rocketwiki/rocketwiki-lqfb",
compat = "/opt/rocketwiki/rocketwiki-lqfb-compat"
}

-- use custom 404 page
request.set_404_route{ module = 'index', view = '404' }

-- set absolute base url from configuration
request.set_absolute_baseurl(config.absolute_base_url)

-- enable XHR request support
request.set_allowed_json_request_slots{ "title", "actions", "support", "default", "trace", "system_error" }

-- use absolute urls for XHR
if request.get_json_request_slots() then
request.force_absolute_baseurl()
end

-- uncomment the following two lines to use C implementations of chosen
-- functions and to disable garbage collection during the request, to
-- increase speed:
--
-- require 'webmcp_accelerator'
-- collectgarbage("stop")

-- open and set default database handle
db = assert(mondelefant.connect{
engine='postgresql',
dbname='liquid_feedback'
})

-- add exit handler
at_exit(function()
db:close()
end)

-- set default database connection
function mondelefant.class_prototype:get_db_conn() return db end

-- enable output of SQL commands in trace system
function db:sql_tracer(command)
return function(error_info)
local error_info = error_info or {}
trace.sql{ command = command, error_position = error_info.position }
end
end

-- default prototype TODO abstraction
function mondelefant.class_prototype:by_id(id)
local selector = self:new_selector()
selector:add_where{ 'id = ?', id }
selector:optional_object_mode()
return selector:exec()
end