liquid_feedback_frontend
view config/init.lua @ 743:7a452bd3d0df
Optical enhancements
| author | bsw | 
|---|---|
| date | Thu Jun 28 22:27:05 2012 +0200 (2012-06-28) | 
| parents | 0946d848a3f4 | 
| children | 6d651f83a64b | 
 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
    10   not config.app_service_provider or
    11   not config.use_terms or
    12   not config.use_terms_checkboxes
    13 then
    14   error("Missing mandatory config option")
    15 end
    17 if config.enabled_languages == nil then
    18   config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu' }
    19 end
    21 if config.default_lang == nil then
    22   config.default_lang = "en"
    23 end
    25 if config.mail_subject_prefix == nil then
    26   config.mail_subject_prefix = "[LiquidFeedback] "
    27 end
    29 if config.absolute_base_url == nil then
    30   config.absolute_base_url = request.get_relative_baseurl()
    31 end
    33 if config.member_image_content_type == nil then
    34   config.member_image_content_type = "image/jpeg"
    35 end
    37 if config.member_image_convert_func == nil then
    38   config.member_image_convert_func = {
    39     avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
    40     photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
    41   }
    42 end
    44 if config.public_access == nil then
    45   config.public_access = "full"
    46 end
    48 if config.locked_profile_fields == nil then
    49   config.locked_profile_fields = {}
    50 end
    52 if not config.database then
    53   config.database = { engine='postgresql', dbname='liquid_feedback' }
    54 end
    56 request.set_404_route{ module = 'index', view = '404' }
    58 -- open and set default database handle
    59 db = assert(mondelefant.connect(config.database))
    60 at_exit(function() 
    61   db:close()
    62 end)
    63 function mondelefant.class_prototype:get_db_conn() return db end
    65 -- enable output of SQL commands in trace system
    66 function db:sql_tracer(command)
    67   return function(error_info)
    68     local error_info = error_info or {}
    69     trace.sql{ command = command, error_position = error_info.position }
    70   end
    71 end
    73 request.set_absolute_baseurl(config.absolute_base_url)
    76 -- TODO abstraction
    77 -- get record by id
    78 function mondelefant.class_prototype:by_id(id)
    79   local selector = self:new_selector()
    80   selector:add_where{ 'id = ?', id }
    81   selector:optional_object_mode()
    82   return selector:exec()
    83 end
