liquid_feedback_frontend
view config/init.lua @ 736:e642bf111347
Added missing config option
author | bsw |
---|---|
date | Thu Jun 28 18:36:47 2012 +0200 (2012-06-28) |
parents | 9d104952554a |
children | 0946d848a3f4 |
line source
1 -- ========================================================================
2 -- DO NOT CHANGE ANYTHING IN THIS FILE
3 -- (except when you really know what you are doing!)
4 -- ========================================================================
7 config.app_version = "2.beta12"
9 if not config.instance_name then
10 config.instance_name = request.get_config_name()
11 end
13 if
14 not config.app_service_provider or
15 not config.use_terms or
16 not config.use_terms_checkboxes
17 then
18 error("Missing mandatory config option")
19 end
21 if config.enabled_languages == nil then
22 config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu' }
23 end
25 if config.default_lang == nil then
26 config.default_lang = "en"
27 end
29 if config.mail_subject_prefix == nil then
30 config.mail_subject_prefix = "[LiquidFeedback] "
31 end
33 if config.absolute_base_url == nil then
34 config.absolute_base_url = request.get_relative_baseurl()
35 end
37 if config.member_image_content_type == nil then
38 config.member_image_content_type = "image/jpeg"
39 end
41 if config.member_image_convert_func == nil then
42 config.member_image_convert_func = {
43 avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
44 photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
45 }
46 end
48 if config.public_access == nil then
49 config.public_access = "full"
50 end
52 if config.locked_profile_fields == nil then
53 config.locked_profile_fields = {}
54 end
56 if not config.database then
57 config.database = { engine='postgresql', dbname='liquid_feedback' }
58 end
60 request.set_404_route{ module = 'index', view = '404' }
62 -- open and set default database handle
63 db = assert(mondelefant.connect(config.database))
64 at_exit(function()
65 db:close()
66 end)
67 function mondelefant.class_prototype:get_db_conn() return db end
69 -- enable output of SQL commands in trace system
70 function db:sql_tracer(command)
71 return function(error_info)
72 local error_info = error_info or {}
73 trace.sql{ command = command, error_position = error_info.position }
74 end
75 end
77 request.set_absolute_baseurl(config.absolute_base_url)
80 -- TODO abstraction
81 -- get record by id
82 function mondelefant.class_prototype:by_id(id)
83 local selector = self:new_selector()
84 selector:add_where{ 'id = ?', id }
85 selector:optional_object_mode()
86 return selector:exec()
87 end