liquid_feedback_frontend

changeset 729:f52f918b38b8

Cleanup of config and orphaned code
author bsw
date Thu Jun 28 17:07:00 2012 +0200 (2012-06-28)
parents f49cdfb72567
children 2496ac5368ad
files app/main/_filter/21_auth.lua app/main/_filter_view/30_navigation.lua app/main/_filter_view/35_openid.lua app/main/_filter_view/36_html_title.lua app/main/_layout/report.html app/main/_layout/rss.html app/main/_layout/xml.html app/main/area/show.lua app/main/index/_action/set_lang.lua app/main/index/_menu.lua app/main/index/login.lua app/main/member_image/show.lua app/main/openid/_action/initiate.lua app/main/openid/_filter/00_openid.lua app/main/openid/announce.xrds.lua app/main/openid/verify.lua app/main/unit/_head.lua config/default.lua config/defaults.lua config/development.lua config/example.lua config/init.lua config/testing.lua env/util/autoapi.lua env/util/html_rss_head.lua
line diff
     1.1 --- a/app/main/_filter/21_auth.lua	Thu Jun 28 16:31:02 2012 +0200
     1.2 +++ b/app/main/_filter/21_auth.lua	Thu Jun 28 17:07:00 2012 +0200
     1.3 @@ -18,7 +18,6 @@
     1.4      or view   == "menu"
     1.5      or action == "set_lang"
     1.6    )
     1.7 -  or module == "openid"
     1.8  )
     1.9  
    1.10  if config.public_access then
     2.1 --- a/app/main/_filter_view/30_navigation.lua	Thu Jun 28 16:31:02 2012 +0200
     2.2 +++ b/app/main/_filter_view/30_navigation.lua	Thu Jun 28 17:07:00 2012 +0200
     2.3 @@ -1,5 +1,3 @@
     2.4 -slot.put_into("app_name", config.app_title)
     2.5 -
     2.6  slot.select('navigation', function()
     2.7  
     2.8    ui.link{
     2.9 @@ -112,11 +110,4 @@
    2.10    }
    2.11  end)
    2.12  
    2.13 -
    2.14 -if config.app_logo then
    2.15 -  slot.select("logo", function()
    2.16 -    ui.image{ static = config.app_logo }
    2.17 -  end)
    2.18 -end
    2.19 -
    2.20  execute.inner()
     3.1 --- a/app/main/_filter_view/35_openid.lua	Thu Jun 28 16:31:02 2012 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,6 +0,0 @@
     3.4 -auth.openid.xrds_header{
     3.5 -  module = "openid",
     3.6 -  view = "announce.xrds"
     3.7 -}
     3.8 -
     3.9 -execute.inner()
    3.10 \ No newline at end of file
     4.1 --- a/app/main/_filter_view/36_html_title.lua	Thu Jun 28 16:31:02 2012 +0200
     4.2 +++ b/app/main/_filter_view/36_html_title.lua	Thu Jun 28 17:07:00 2012 +0200
     4.3 @@ -30,6 +30,6 @@
     4.4    ..
     4.5    ( app.html_title.subtitle or "" )
     4.6    ..
     4.7 -  config.app_title
     4.8 +  _"LiquidFeedback" .. " - " .. config.instance_name
     4.9  )
    4.10  
     5.1 --- a/app/main/_layout/report.html	Thu Jun 28 16:31:02 2012 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,87 +0,0 @@
     5.4 -<html>
     5.5 -  <head>
     5.6 -    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     5.7 -    <title><!-- WEBMCP SLOTNODIV app_name --></title>
     5.8 -    <link rel="stylesheet" type="text/css" media="screen" href="<!-- WEBMCP SLOTNODIV stylesheet_url -->" />
     5.9 -    <script>
    5.10 -      var lastEls = new Array();
    5.11 -      function openEl(el) {
    5.12 -        var el = document.getElementById(el);
    5.13 -        if (! el) {
    5.14 -          return;
    5.15 -        }
    5.16 -        if (lastEls.length > 0) {
    5.17 -          lastEls[lastEls.length-1].style.display='none';
    5.18 -        };
    5.19 -        lastEls.push(el);
    5.20 -        el.style.display = 'block';
    5.21 -      }
    5.22 -      function undo() {
    5.23 -        if (lastEls.length > 1) {
    5.24 -          var el = lastEls.pop();
    5.25 -          el.style.display='none';
    5.26 -        };
    5.27 -        if (lastEls.length > 0) {
    5.28 -          lastEls[lastEls.length-1].style.display = 'block';
    5.29 -        };
    5.30 -      }
    5.31 -      var prev_issues = {};
    5.32 -      var prev_initiatives = {};
    5.33 -      var parents = {};
    5.34 -      var next_initiatives = {};
    5.35 -      var next_issues = {};
    5.36 -      function openPrevIssue() {
    5.37 -        openEl(prev_issues[lastEls[lastEls.length-1].id]);
    5.38 -      };
    5.39 -      function openPrevInitiative() {
    5.40 -        openEl(prev_initiatives[lastEls[lastEls.length-1].id]);
    5.41 -      };
    5.42 -      function openParent() {
    5.43 -        openEl(parents[lastEls[lastEls.length-1].id]);
    5.44 -      };
    5.45 -      function openNextInitiative() {
    5.46 -        openEl(next_initiatives[lastEls[lastEls.length-1].id]);
    5.47 -      };
    5.48 -      function openNextIssue() {
    5.49 -        openEl(next_issues[lastEls[lastEls.length-1].id]);
    5.50 -      };
    5.51 -      function openElDirect() {
    5.52 -        var issue_id_el = document.getElementById("input_issue");
    5.53 -        var initiative_id_el = document.getElementById("input_initiative");
    5.54 -        if (initiative_id_el.value) {
    5.55 -          openEl("initiative_" + initiative_id_el.value);
    5.56 -        } else if (issue_id_el.value) {
    5.57 -          openEl("issue_" + issue_id_el.value);
    5.58 -        };
    5.59 -        issue_id_el.value = "";
    5.60 -        initiative_id_el.value = "";
    5.61 -      }
    5.62 -    </script>
    5.63 -    <style>
    5.64 -      .nav {
    5.65 -        font-size: 75%;
    5.66 -      }
    5.67 -      .nav .left {
    5.68 -        float: left;
    5.69 -      }
    5.70 -
    5.71 -      .nav a {
    5.72 -        text-decoration: none;
    5.73 -        margin-left: 0.5em;
    5.74 -        padding: 1ex;
    5.75 -        background-color: #ddd;
    5.76 -      }
    5.77 -      .nav img {
    5.78 -        vertical-align: middle;
    5.79 -      }
    5.80 -    </style>
    5.81 -  </head>
    5.82 -  <body>
    5.83 -    <div class="main" id="default">
    5.84 -      <!-- WEBMCP SLOT default -->
    5.85 -    </div>
    5.86 -  </body>
    5.87 -  <script>
    5.88 -  </script>
    5.89 -</html>
    5.90 -
     6.1 --- a/app/main/_layout/rss.html	Thu Jun 28 16:31:02 2012 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,7 +0,0 @@
     6.4 -<?xml version="1.0" encoding="utf-8"?>
     6.5 -
     6.6 -<rss version="2.0">
     6.7 -  <channel>
     6.8 -    <!-- WEBMCP SLOTNODIV default -->
     6.9 -  </channel>
    6.10 -</rss>
     7.1 --- a/app/main/_layout/xml.html	Thu Jun 28 16:31:02 2012 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,2 +0,0 @@
     7.4 -<?xml version="1.0" encoding="utf-8"?>
     7.5 -<!-- WEBMCP SLOTNODIV default -->
     8.1 --- a/app/main/area/show.lua	Thu Jun 28 16:31:02 2012 +0200
     8.2 +++ b/app/main/area/show.lua	Thu Jun 28 17:07:00 2012 +0200
     8.3 @@ -6,13 +6,6 @@
     8.4  
     8.5  util.help("area.show")
     8.6  
     8.7 -
     8.8 -if config.feature_rss_enabled then
     8.9 -  util.html_rss_head{ title = _"Initiatives in this area (last created first)", module = "initiative", view = "list_rss", params = { area_id = area.id } }
    8.10 -  util.html_rss_head{ title = _"Initiatives in this area (last updated first)", module = "initiative", view = "list_rss", params = { area_id = area.id } }
    8.11 -end
    8.12 -
    8.13 -
    8.14  slot.select("head", function()
    8.15    execute.view{ module = "area", view = "_head", params = { area = area, show_content = true } }
    8.16  end)
     9.1 --- a/app/main/index/_action/set_lang.lua	Thu Jun 28 16:31:02 2012 +0200
     9.2 +++ b/app/main/index/_action/set_lang.lua	Thu Jun 28 17:07:00 2012 +0200
     9.3 @@ -1,6 +1,6 @@
     9.4  local lang = param.get("lang")
     9.5  local valid_lang = false
     9.6 -for i, tmp_lang in ipairs(config.available_languages) do
     9.7 +for i, tmp_lang in ipairs(config.enabled_languages) do
     9.8    if lang == tmp_lang then
     9.9      valid_lang = true
    9.10    end
    10.1 --- a/app/main/index/_menu.lua	Thu Jun 28 16:31:02 2012 +0200
    10.2 +++ b/app/main/index/_menu.lua	Thu Jun 28 17:07:00 2012 +0200
    10.3 @@ -73,7 +73,7 @@
    10.4      end }
    10.5    end
    10.6    
    10.7 -  for i, lang in ipairs(config.available_languages) do
    10.8 +  for i, lang in ipairs(config.enabled_languages) do
    10.9      
   10.10      local langcode
   10.11      
    11.1 --- a/app/main/index/login.lua	Thu Jun 28 16:31:02 2012 +0200
    11.2 +++ b/app/main/index/login.lua	Thu Jun 28 17:07:00 2012 +0200
    11.3 @@ -7,10 +7,9 @@
    11.4  
    11.5  execute.view{ module = "index", view = "_lang_chooser" }
    11.6  
    11.7 -slot.put_into("title", encode.html(config.app_title))
    11.8 +ui.title(_"Login")
    11.9  app.html_title.title = _"Login"
   11.10  
   11.11 -
   11.12  if config.motd_public then
   11.13    local help_text = config.motd_public
   11.14    ui.container{
   11.15 @@ -65,28 +64,3 @@
   11.16      }
   11.17    end
   11.18  }
   11.19 -
   11.20 -if config.auth_openid_enabled then
   11.21 -  ui.form{
   11.22 -    attr = { class = "login" },
   11.23 -    module = 'openid',
   11.24 -    action = 'initiate',
   11.25 -    routing = {
   11.26 -      default = {
   11.27 -        mode   = 'forward',
   11.28 -        module = 'index',
   11.29 -        view   = 'login',
   11.30 -      }
   11.31 -    },
   11.32 -    content = function()
   11.33 -      ui.field.text{
   11.34 -        label     = _'OpenID',
   11.35 -        html_name = 'openid_identifier',
   11.36 -        value     = ''
   11.37 -      }
   11.38 -      ui.submit{
   11.39 -        text = _'OpenID Login'
   11.40 -      }
   11.41 -    end
   11.42 -  }
   11.43 -end
    12.1 --- a/app/main/member_image/show.lua	Thu Jun 28 16:31:02 2012 +0200
    12.2 +++ b/app/main/member_image/show.lua	Thu Jun 28 17:07:00 2012 +0200
    12.3 @@ -4,7 +4,7 @@
    12.4  print('Cache-Control: max-age=300'); -- let the client cache the image for 5 minutes
    12.5  
    12.6  if record == nil then
    12.7 -  local default_file = config.member_image_default_file[image_type]
    12.8 +  local default_file = ({ avatar = "avatar.jpg", photo = nil })[image_type]
    12.9    if default_file then
   12.10      print('Location: ' .. encode.url{ static = default_file } .. '\n\n')
   12.11    else
    13.1 --- a/app/main/openid/_action/initiate.lua	Thu Jun 28 16:31:02 2012 +0200
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,20 +0,0 @@
    13.4 -local user_supplied_identifier = param.get("openid_identifier")
    13.5 -
    13.6 -if not config.auth_openid_identifier_check_func(user_supplied_identifier) then
    13.7 -  slot.put_into("error", _"This identifier is not allowed for this instance.")
    13.8 -  return
    13.9 -end
   13.10 -
   13.11 -local success,errmsg = auth.openid.initiate{
   13.12 -  user_supplied_identifier = user_supplied_identifier,
   13.13 -  https_as_default         = config.auth_openid_https_as_default,
   13.14 -  curl_options             = config.auth_openid_curl_options,
   13.15 -  realm                    = request.get_absolute_baseurl(),
   13.16 -  return_to_module         = "openid",
   13.17 -  return_to_view           = "verify"
   13.18 -}
   13.19 -
   13.20 -if not success then
   13.21 -  slot.put_into("error", encode.html(_("Error while resolving openid. Internal message: '#{errmsg}'", { errmsg = errmsg })))
   13.22 -  return false
   13.23 -end
   13.24 \ No newline at end of file
    14.1 --- a/app/main/openid/_filter/00_openid.lua	Thu Jun 28 16:31:02 2012 +0200
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,5 +0,0 @@
    14.4 -if not config.auth_openid_enabled then
    14.5 -  error("OpenID is not enabled.")
    14.6 -end
    14.7 -
    14.8 -execute.inner()
    15.1 --- a/app/main/openid/announce.xrds.lua	Thu Jun 28 16:31:02 2012 +0200
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,4 +0,0 @@
    15.4 -auth.openid.xrds_document{
    15.5 -  return_to_module = "openid",
    15.6 -  return_to_view = "verify"
    15.7 -}
    16.1 --- a/app/main/openid/verify.lua	Thu Jun 28 16:31:02 2012 +0200
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,17 +0,0 @@
    16.4 -local claimed_identifier, errmsg = auth.openid.verify{
    16.5 -  force_https              = config.auth_openid_force_https,
    16.6 -  curl_options             = config.auth_openid_curl_options
    16.7 -}
    16.8 -
    16.9 -if not claimed_identifier then
   16.10 -  slot.put_into("error", _"Sorry, it was not possible to verify your OpenID.")
   16.11 -  return
   16.12 -end
   16.13 -
   16.14 -if not config.auth_openid_identifier_check_func(claimed_identifier) then
   16.15 -  slot.put_into("error", _"This identifier is not allowed for this instance.")
   16.16 -  return
   16.17 -end
   16.18 -
   16.19 -slot.put("validated as: ", encode.html(claimed_identifier), "<br />")
   16.20 -
    17.1 --- a/app/main/unit/_head.lua	Thu Jun 28 16:31:02 2012 +0200
    17.2 +++ b/app/main/unit/_head.lua	Thu Jun 28 17:07:00 2012 +0200
    17.3 @@ -17,7 +17,7 @@
    17.4      else
    17.5        ui.link{ 
    17.6          module = "unit", view = "show", id = unit.id,
    17.7 -        attr = { class = "unit_name" }, content = config.app_title
    17.8 +        attr = { class = "unit_name" }, content = _"LiquidFeedback" .. " &middot; " .. config.instance_name
    17.9        }
   17.10      end
   17.11    end }
    18.1 --- a/config/default.lua	Thu Jun 28 16:31:02 2012 +0200
    18.2 +++ b/config/default.lua	Thu Jun 28 17:07:00 2012 +0200
    18.3 @@ -1,20 +1,25 @@
    18.4 -
    18.5 -config.app_name = "LiquidFeedback"
    18.6 -config.app_version = "2.beta12"
    18.7 +---------------------------------------------------------------------------
    18.8 +-- Include defaults (DO NOT REMOVE THIS SECTION)
    18.9 +---------------------------------------------------------------------------
   18.10 +execute.config("defaults")
   18.11  
   18.12 -config.instance_name = request.get_config_name()
   18.13 +---------------------------------------------------------------------------
   18.14 +-- MANDATORY CONFIG OPTIONS
   18.15 +---------------------------------------------------------------------------
   18.16  
   18.17 -config.app_title = config.app_name .. " " .. config.instance_name
   18.18 +-- Name of this instance, defaults to name of config file
   18.19 +-- config.instance_name = "Instance name"
   18.20  
   18.21 -config.app_logo = nil
   18.22 -
   18.23 +-- Information about service provider
   18.24 +---------------------------------------------------------------------------
   18.25  config.app_service_provider = "Snake Oil<br/>10000 Berlin<br/>Germany"
   18.26  
   18.27 ---config.footer_html = '<a href="somewhere">some link</a>'
   18.28 +-- A rocketwiki formatted text the user has to accept while registering
   18.29 +---------------------------------------------------------------------------
   18.30 +config.use_terms = "=== Terms of Use ==="
   18.31  
   18.32 -config.use_terms = "=== Terms of Use ===\nNothing is allowed."
   18.33 ---config.use_terms_html = ""
   18.34 -
   18.35 +-- Checkbox(es) the user has to accept while registering
   18.36 +---------------------------------------------------------------------------
   18.37  config.use_terms_checkboxes = {
   18.38    {
   18.39      name = "terms_of_use_v1",
   18.40 @@ -23,93 +28,76 @@
   18.41    }
   18.42  }
   18.43  
   18.44 -config.locked_profile_fields = {
   18.45 -  field_name = true,
   18.46 -}
   18.47 +---------------------------------------------------------------------------
   18.48 +-- Optional config options
   18.49 +---------------------------------------------------------------------------
   18.50  
   18.51 -config.member_image_content_type = "image/jpeg"
   18.52 -config.member_image_convert_func = {
   18.53 -  avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
   18.54 -  photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
   18.55 -}
   18.56 +-- List of enabled languages, defaults to available languages
   18.57 +---------------------------------------------------------------------------
   18.58 +-- config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu' }
   18.59  
   18.60 -config.member_image_default_file = {
   18.61 -  avatar = "avatar.jpg",
   18.62 -  photo = nil
   18.63 -}
   18.64 -
   18.65 -config.available_languages = { 'en', 'de', 'eo', 'el', 'hu' }
   18.66 -
   18.67 -config.default_lang = "de"
   18.68 +-- Default language, defaults to "en"
   18.69 +---------------------------------------------------------------------------
   18.70 +-- config.default_lang = "en"
   18.71  
   18.72  -- after how long is a user considered inactive and the trustee will see warning
   18.73  -- notation is according to postgresql intervals
   18.74 -config.delegation_warning_time = '6 months'
   18.75 -
   18.76 -config.mail_subject_prefix = "[LiquidFeedback] "
   18.77 +---------------------------------------------------------------------------
   18.78 +-- config.delegation_warning_time = '6 months'
   18.79  
   18.80 -config.fastpath_url_func = nil
   18.81 -
   18.82 -config.download_dir = nil
   18.83 +-- Sender and prefix of all automatic mails, default to "[Liquid Feedback] "
   18.84 +---------------------------------------------------------------------------
   18.85 +-- config.mail_subject_prefix = "[LiquidFeedback] "
   18.86 +-- config.mail_envelope_from = "liquid-support@example.com"
   18.87 +-- config.mail_from = "LiquidFeedback"
   18.88 +-- config.mail_reply_to = "liquid-support@example.com"
   18.89  
   18.90 -config.download_use_terms = "=== Nutzungsbedingungen ===\nAlles ist verboten"
   18.91 -
   18.92 -config.public_access = false  -- Available options: "anonymous", "pseudonym"
   18.93 +-- Supply custom url for avatar/photo delivery
   18.94 +---------------------------------------------------------------------------
   18.95 +-- config.fastpath_url_func = nil
   18.96  
   18.97 -config.api_enabled = true
   18.98 +-- Local directory for database dumps offered for download
   18.99 +---------------------------------------------------------------------------
  18.100 +-- config.download_dir = nil
  18.101  
  18.102 -config.feature_rss_enabled = false -- feature is broken
  18.103 +-- Special use terms for database dump download
  18.104 +---------------------------------------------------------------------------
  18.105 +-- config.download_use_terms = "=== Download use terms ===\n"
  18.106  
  18.107 -config.single_unit_id = false
  18.108 +-- Set public access level
  18.109 +-- Available options: false, "anonymous", "pseudonym", "full"
  18.110 +---------------------------------------------------------------------------
  18.111 +-- config.public_access = "full"
  18.112  
  18.113 --- OpenID authentication is not fully implemented yet, DO NOT USE BEFORE THIS NOTICE HAS BEEN REMOVED!
  18.114 -config.auth_openid_enabled = false
  18.115 -config.auth_openid_https_as_default = true
  18.116 -config.auth_openid_identifier_check_func = function(uri) return false end
  18.117 +-- Use custom image conversion
  18.118 +---------------------------------------------------------------------------
  18.119 +--config.member_image_content_type = "image/jpeg"
  18.120 +--config.member_image_convert_func = {
  18.121 +--  avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
  18.122 +--  photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
  18.123 +--}
  18.124  
  18.125 -request.set_allowed_json_request_slots{ "title", "actions", "support", "default", "trace", "system_error" }
  18.126 -
  18.127 +-- Integration of Etherpad
  18.128 +---------------------------------------------------------------------------
  18.129 +--config.etherpad = {
  18.130 +--  base_url = "http://example.com:9001/",
  18.131 +--  api_base = "http://localhost:9001/",
  18.132 +--  api_key = "mysecretapikey",
  18.133 +--  group_id = "mygroupname",
  18.134 +--  cookie_path = "/"
  18.135 +--}
  18.136  
  18.137 -if request.get_json_request_slots() then
  18.138 -  request.force_absolute_baseurl()
  18.139 -end
  18.140 -
  18.141 -request.set_404_route{ module = 'index', view = '404' }
  18.142 -
  18.143 +-- WebMCP accelerator
  18.144 +---------------------------------------------------------------------------
  18.145  -- uncomment the following two lines to use C implementations of chosen
  18.146  -- functions and to disable garbage collection during the request, to
  18.147  -- increase speed:
  18.148  --
  18.149 -require 'webmcp_accelerator'
  18.150 -collectgarbage("stop")
  18.151 -
  18.152 --- open and set default database handle
  18.153 -db = assert(mondelefant.connect{
  18.154 -  engine='postgresql',
  18.155 -  dbname='liquid_feedback'
  18.156 -})
  18.157 -at_exit(function() 
  18.158 -  db:close()
  18.159 -end)
  18.160 -function mondelefant.class_prototype:get_db_conn() return db end
  18.161 -
  18.162 --- enable output of SQL commands in trace system
  18.163 -function db:sql_tracer(command)
  18.164 -  return function(error_info)
  18.165 -    local error_info = error_info or {}
  18.166 -    trace.sql{ command = command, error_position = error_info.position }
  18.167 -  end
  18.168 -end
  18.169 -
  18.170 -request.set_absolute_baseurl(config.absolute_base_url)
  18.171 +-- require 'webmcp_accelerator'
  18.172 +-- collectgarbage("stop")
  18.173  
  18.174  
  18.175 -
  18.176 --- TODO abstraction
  18.177 --- get record by id
  18.178 -function mondelefant.class_prototype:by_id(id)
  18.179 -  local selector = self:new_selector()
  18.180 -  selector:add_where{ 'id = ?', id }
  18.181 -  selector:optional_object_mode()
  18.182 -  return selector:exec()
  18.183 -end
  18.184 +---------------------------------------------------------------------------
  18.185 +-- Do main initialisation (DO NOT REMOVE THIS SECTION)
  18.186 +---------------------------------------------------------------------------
  18.187 +execute.config("init")
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/config/defaults.lua	Thu Jun 28 17:07:00 2012 +0200
    19.3 @@ -0,0 +1,39 @@
    19.4 +config.app_version = "2.beta12"
    19.5 +
    19.6 +config.instance_name = request.get_config_name()
    19.7 +
    19.8 +config.app_service_provider = "Snake Oil<br/>10000 Berlin<br/>Germany"
    19.9 +
   19.10 +config.use_terms = "=== Terms of Use ==="
   19.11 +
   19.12 +config.use_terms_checkboxes = {
   19.13 +  {
   19.14 +    name = "terms_of_use_v1",
   19.15 +    html = "I accept the terms of use.",
   19.16 +    not_accepted_error = "You have to accept the terms of use to be able to register."
   19.17 +  }
   19.18 +}
   19.19 +
   19.20 +config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu' }
   19.21 +
   19.22 +config.default_lang = "en"
   19.23 +
   19.24 +config.delegation_warning_time = '6 months'
   19.25 +
   19.26 +config.mail_subject_prefix = "[LiquidFeedback] "
   19.27 +
   19.28 +config.fastpath_url_func = nil
   19.29 +
   19.30 +config.download_dir = nil
   19.31 +
   19.32 +config.download_use_terms = "=== Nutzungsbedingungen ===\nAlles ist verboten"
   19.33 +
   19.34 +config.public_access = false
   19.35 +
   19.36 +config.member_image_content_type = "image/jpeg"
   19.37 +
   19.38 +config.member_image_convert_func = {
   19.39 +  avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
   19.40 +  photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
   19.41 +}
   19.42 +
    20.1 --- a/config/development.lua	Thu Jun 28 16:31:02 2012 +0200
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,54 +0,0 @@
    20.4 -config.absolute_base_url = "http://10.8.33.34/lf/"
    20.5 -
    20.6 -execute.config("default")
    20.7 -
    20.8 -config.formatting_engine_executeables = {
    20.9 -  rocketwiki= "/opt/rocketwiki/rocketwiki-lqfb",
   20.10 -  compat = "/opt/rocketwiki/rocketwiki-lqfb-compat"
   20.11 -}
   20.12 -
   20.13 -config.mail_from = "LiquidFeedback"
   20.14 -config.mail_reply_to = "liquid-support@localhost"
   20.15 -
   20.16 -config.issue_discussion_url_func = function(issue) return "http://example.com/issue_" .. tostring(issue.id) end
   20.17 -
   20.18 -config.auth_openid_enabled = false
   20.19 -config.auth_openid_https_as_default = true
   20.20 -
   20.21 -config.api_enabled = true
   20.22 -
   20.23 -config.auth_openid_identifier_check_func = function(uri)
   20.24 -  local uri = uri:lower()
   20.25 -  if uri:find("^https://") then
   20.26 -    uri = uri:match("^https://(.*)")
   20.27 -  end
   20.28 -  if uri:find("^[0-9A-Za-z_-]+%.example%.com/?$") then
   20.29 -    return true
   20.30 -  else
   20.31 -    return false
   20.32 -  end
   20.33 -end
   20.34 -
   20.35 -config.motd_public = "==Public motd=="
   20.36 -
   20.37 ---config.motd_intern = "==Internal motd=="
   20.38 -
   20.39 -config.public_access = "anonym"
   20.40 -
   20.41 --- you can put some js code to the bottom on the page
   20.42 --- here it opens the trace window
   20.43 -
   20.44 ---slot.put_into(
   20.45 ---  "custom_script",
   20.46 ---  "document.getElementById('trace_show').onclick();"
   20.47 ---)
   20.48 -
   20.49 -config.etherpad = {
   20.50 -  base_url = "http://10.8.33.34:9001/",
   20.51 -  api_base = "http://10.8.33.34:9001/",
   20.52 -  api_key = "g5XAVrRb5EgPuEqIdVrRNt2Juipx3PoH",
   20.53 -  group_id = "g.7WDKN3StkEyuWkyN",
   20.54 -  cookie_path = "/"
   20.55 -}
   20.56 -
   20.57 -config.document_dir = "/home/dark/tmp"
    21.1 --- a/config/example.lua	Thu Jun 28 16:31:02 2012 +0200
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,129 +0,0 @@
    21.4 -request.set_absolute_baseurl(request.get_relative_baseurl())
    21.5 --- request.set_absolute_baseurl("http://www.example.com/lf/")
    21.6 -
    21.7 -config.app_name = "LiquidFeedback"
    21.8 -config.app_version = "2.beta6"
    21.9 -
   21.10 -config.instance_name = request.get_config_name()
   21.11 -
   21.12 -config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)"
   21.13 -
   21.14 -config.app_logo = nil
   21.15 -
   21.16 -config.app_service_provider = "Snake Oil<br/>10000 Berlin<br/>Germany"
   21.17 -
   21.18 ---config.footer_html = '<a href="somewhere">some link</a>'
   21.19 -
   21.20 -config.use_terms = "=== Terms of Use ===\nNothing is allowed."
   21.21 ---config.use_terms_html = ""
   21.22 -
   21.23 -config.use_terms_checkboxes = {
   21.24 -  {
   21.25 -    name = "terms_of_use_v1",
   21.26 -    html = "I accept the terms of use.",
   21.27 -    not_accepted_error = "You have to accept the terms of use to be able to register."
   21.28 -  }
   21.29 -}
   21.30 -
   21.31 -config.locked_profile_fields = {
   21.32 -  login               = false,
   21.33 -  notify_email        = false,
   21.34 -  name                = false,
   21.35 -  organizational_unit = false,
   21.36 -  internal_posts      = false,
   21.37 -  realname            = false,
   21.38 -  birthday            = false,
   21.39 -  address             = false,
   21.40 -  email               = false
   21.41 -}
   21.42 -
   21.43 -config.member_image_content_type = "image/jpeg"
   21.44 -config.member_image_convert_func = {
   21.45 -  avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
   21.46 -  photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
   21.47 -}
   21.48 -
   21.49 -config.member_image_default_file = {
   21.50 -  avatar = "avatar.jpg",
   21.51 -  photo = nil
   21.52 -}
   21.53 -
   21.54 -config.default_lang = "en"
   21.55 -
   21.56 --- after how long is a user considered inactive and the trustee will see warning
   21.57 --- notation is according to postgresql intervals
   21.58 -config.delegation_warning_time = '6 months'
   21.59 -
   21.60 -config.mail_subject_prefix = "[LiquidFeedback] "
   21.61 -
   21.62 -config.fastpath_url_func = nil
   21.63 -
   21.64 -config.download_dir = nil
   21.65 -
   21.66 -config.download_use_terms = "=== Nutzungsbedingungen ===\nAlles ist verboten"
   21.67 -
   21.68 -config.public_access = false  -- Available options: "anonymous", "pseudonym"
   21.69 -
   21.70 -config.api_enabled = true
   21.71 -
   21.72 -config.feature_rss_enabled = false -- feature is broken
   21.73 -
   21.74 -config.single_unit_id = false
   21.75 -
   21.76 --- OpenID authentication is not fully implemented yet, DO NOT USE BEFORE THIS NOTICE HAS BEEN REMOVED!
   21.77 -config.auth_openid_enabled = false
   21.78 -config.auth_openid_https_as_default = true
   21.79 -config.auth_openid_identifier_check_func = function(uri) return false end
   21.80 -
   21.81 -request.set_allowed_json_request_slots{ "title", "actions", "support", "default", "trace", "system_error" }
   21.82 -
   21.83 -if request.get_json_request_slots() then
   21.84 -  request.force_absolute_baseurl()
   21.85 -end
   21.86 -
   21.87 -request.set_404_route{ module = 'index', view = '404' }
   21.88 -
   21.89 --- uncomment the following two lines to use C implementations of chosen
   21.90 --- functions and to disable garbage collection during the request, to
   21.91 --- increase speed:
   21.92 ---
   21.93 --- require 'webmcp_accelerator'
   21.94 --- collectgarbage("stop")
   21.95 -
   21.96 --- open and set default database handle
   21.97 -db = assert(mondelefant.connect{
   21.98 -  engine='postgresql',
   21.99 -  dbname='liquid_feedback_p'
  21.100 -})
  21.101 -at_exit(function() 
  21.102 -  db:close()
  21.103 -end)
  21.104 -function mondelefant.class_prototype:get_db_conn() return db end
  21.105 -
  21.106 --- enable output of SQL commands in trace system
  21.107 -function db:sql_tracer(command)
  21.108 -  return function(error_info)
  21.109 -    local error_info = error_info or {}
  21.110 -    trace.sql{ command = command, error_position = error_info.position }
  21.111 -  end
  21.112 -end
  21.113 -
  21.114 -
  21.115 --- TODO abstraction
  21.116 --- get record by id
  21.117 -function mondelefant.class_prototype:by_id(id)
  21.118 -  local selector = self:new_selector()
  21.119 -  selector:add_where{ 'id = ?', id }
  21.120 -  selector:optional_object_mode()
  21.121 -  return selector:exec()
  21.122 -end
  21.123 -
  21.124 -config.formatting_engine_executeables = {
  21.125 -  rocketwiki= "/opt/rocketwiki-lqfb/rocketwiki-lqfb",
  21.126 -  compat = "/opt/rocketwiki-lqfb/rocketwiki-lqfb-compat"
  21.127 -}
  21.128 -
  21.129 -config.fastpath_url_func = function(member_id, image_type)
  21.130 -  return request.get_absolute_baseurl() .. "fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type)
  21.131 -end
  21.132 -
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/config/init.lua	Thu Jun 28 17:07:00 2012 +0200
    22.3 @@ -0,0 +1,33 @@
    22.4 +request.set_404_route{ module = 'index', view = '404' }
    22.5 +
    22.6 +-- open and set default database handle
    22.7 +db = assert(mondelefant.connect{
    22.8 +  engine='postgresql',
    22.9 +  dbname='liquid_feedback'
   22.10 +})
   22.11 +at_exit(function() 
   22.12 +  db:close()
   22.13 +end)
   22.14 +function mondelefant.class_prototype:get_db_conn() return db end
   22.15 +
   22.16 +-- enable output of SQL commands in trace system
   22.17 +function db:sql_tracer(command)
   22.18 +  return function(error_info)
   22.19 +    local error_info = error_info or {}
   22.20 +    trace.sql{ command = command, error_position = error_info.position }
   22.21 +  end
   22.22 +end
   22.23 +
   22.24 +request.set_absolute_baseurl(config.absolute_base_url)
   22.25 +
   22.26 +
   22.27 +
   22.28 +-- TODO abstraction
   22.29 +-- get record by id
   22.30 +function mondelefant.class_prototype:by_id(id)
   22.31 +  local selector = self:new_selector()
   22.32 +  selector:add_where{ 'id = ?', id }
   22.33 +  selector:optional_object_mode()
   22.34 +  return selector:exec()
   22.35 +end
   22.36 +
    23.1 --- a/config/testing.lua	Thu Jun 28 16:31:02 2012 +0200
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,12 +0,0 @@
    23.4 -config.absolute_base_url = "http://www.public-software-group.org/liquid_feedback_testing/"
    23.5 -
    23.6 -execute.config("default")
    23.7 -
    23.8 -config.formatting_engine_executeables = {
    23.9 -  rocketwiki= "/opt/liquid_feedback_testing/rocketwiki/rocketwiki-lqfb",
   23.10 -  compat = "/opt/liquid_feedback_testing/rocketwiki/rocketwiki-lqfb-compat"
   23.11 -}
   23.12 -
   23.13 -config.fastpath_url_func = function(member_id, image_type)
   23.14 -  return "http://www.public-software-group.org/liquid_feedback_testing/fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type)
   23.15 -end
   23.16 \ No newline at end of file
    24.1 --- a/env/util/autoapi.lua	Thu Jun 28 16:31:02 2012 +0200
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,88 +0,0 @@
    24.4 -function util.autoapi_xml(args)
    24.5 -  local relation_name = assert(args.relation_name)
    24.6 -  local selector = assert(args.selector)
    24.7 -  local fields = assert(args.fields)
    24.8 -  local rows = selector:exec()
    24.9 -  slot.set_layout("xml", "application/xml")
   24.10 -  slot.put("<", relation_name, "_list>\n")
   24.11 -  for i_row, row in ipairs(rows) do
   24.12 -    slot.put("  <", relation_name, ">\n")
   24.13 -    for i_field, field in ipairs(fields) do
   24.14 -      slot.put("    <", field.name, ">")
   24.15 -      local value
   24.16 -      if field.func then
   24.17 -        value = field.func(row)
   24.18 -      elseif field.field then
   24.19 -        value = row[field.name]
   24.20 -      end
   24.21 -      if value ~= nil then
   24.22 -        slot.put(encode.html(tostring(value)))
   24.23 -      else
   24.24 -        slot.put("NULL")
   24.25 -      end
   24.26 -      slot.put("</", field.name, ">\n")
   24.27 -    end
   24.28 -    slot.put("  </", relation_name, ">\n")
   24.29 -  end
   24.30 -  slot.put("</", relation_name, "_list>\n")
   24.31 -end
   24.32 -
   24.33 -function util.autoapi_json(args)
   24.34 -  slot.set_layout("blank", "application/json")
   24.35 -  local selector = assert(args.selector)
   24.36 -  local fields = assert(args.fields)
   24.37 -  local rows = selector:exec()
   24.38 -  slot.put("[\n")
   24.39 -  for i_row, row in ipairs(rows) do
   24.40 -    slot.put("  {\n")
   24.41 -    for i_field, field in ipairs(fields) do
   24.42 -      slot.put("    \"", field.name, "\": ")
   24.43 -      local value
   24.44 -      if field.func then
   24.45 -        value = field.func(row)
   24.46 -      elseif field.field then
   24.47 -        value = row[field.name]
   24.48 -      end
   24.49 -      slot.put(encode.json(value))
   24.50 -      if i_field < #fields then
   24.51 -        slot.put(",")
   24.52 -      end
   24.53 -      slot.put("\n")
   24.54 -    end
   24.55 -    slot.put("  }")
   24.56 -    if i_row < #rows then
   24.57 -      slot.put(",")
   24.58 -    end
   24.59 -    slot.put("\n")
   24.60 -  end
   24.61 -  slot.put("]\n")
   24.62 -end
   24.63 -
   24.64 -function util.autoapi(args)
   24.65 -  local relation_name = assert(args.relation_name)
   24.66 -  local selector = assert(args.selector)
   24.67 -  local fields = assert(args.fields)
   24.68 -  local api_engine = assert(args.api_engine)
   24.69 -
   24.70 -  selector:reset_fields()
   24.71 -
   24.72 -  for i_field, field in ipairs(fields) do
   24.73 -    if field.field then
   24.74 -      selector:add_field(field.field, field.name)
   24.75 -    end
   24.76 -  end
   24.77 -
   24.78 -  if api_engine == "xml" then
   24.79 -    util.autoapi_xml{
   24.80 -      relation_name = relation_name,
   24.81 -      selector = selector,
   24.82 -      fields = fields
   24.83 -    }
   24.84 -  elseif api_engine == "json" then
   24.85 -    util.autoapi_json{
   24.86 -      selector = selector,
   24.87 -      fields = fields
   24.88 -    }
   24.89 -  end
   24.90 -
   24.91 -end
   24.92 \ No newline at end of file
    25.1 --- a/env/util/html_rss_head.lua	Thu Jun 28 16:31:02 2012 +0200
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,3 +0,0 @@
    25.4 -function util.html_rss_head(args)
    25.5 -  slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="' .. encode.html(args.title) .. '" href="' .. encode.url{ module = args.module, view = args.view, id = args.id, params = args.params } .. '">')
    25.6 -end

Impressum / About Us