1. Daniel Poelzleithner
  2. liquid_feedback_frontend

Commits

bsw  committed c553898

Moved motd from locale/motd/*-files to configuration setting

  • Participants
  • Parent commits 20186f0
  • Branches default
  • Tags beta18

Comments (0)

Files changed (6)

File app/main/area/list.lua

View file
  • Ignore whitespace
   slot.put_into("title", encode.html(config.app_title))
 end
 
-local lang = locale.get("lang")
-local basepath = request.get_app_basepath() 
-local file_name = basepath .. "/locale/motd/" .. lang .. "_public.txt"
-local file = io.open(file_name)
-if file ~= nil then
-  local help_text = file:read("*a")
-  if #help_text > 0 then
-    ui.container{
-      attr = { class = "motd wiki" },
-      content = function()
-        slot.put(format.wiki_text(help_text))
-      end
-    }
-  end
+if not app.session.member_id and config.motd_public then
+  local help_text = config.motd_public
+  ui.container{
+    attr = { class = "wiki motd" },
+    content = function()
+      slot.put(format.wiki_text(help_text))
+    end
+  }
 end
 
 util.help("area.list", _"Area list")

File app/main/index/_motd.lua

View file
  • Ignore whitespace
-local lang = locale.get("lang")
-local basepath = request.get_app_basepath() 
-local file_name = basepath .. "/locale/motd/" .. lang .. ".txt"
-local file = io.open(file_name)
-if file ~= nil then
-  local help_text = file:read("*a")
-  if #help_text > 0 then
-    ui.container{
-      attr = { class = "wiki" },
-      content = function()
-        slot.put(format.wiki_text(help_text))
-      end
-    }
-  end
+if config.motd_intern then
+  local help_text = config.motd_intern
+  ui.container{
+    attr = { class = "wiki" },
+    content = function()
+      slot.put(format.wiki_text(help_text))
+    end
+  }
 end

File app/main/index/login.lua

View file
  • Ignore whitespace
   }
 end)
 
+if config.motd_public then
+  local help_text = config.motd_public
+  ui.container{
+    attr = { class = "wiki motd" },
+    content = function()
+      slot.put(format.wiki_text(help_text))
+    end
+  }
+end
 
 ui.tag{
   tag = 'p',

File app/main/member/show_tab.lua

View file
  • Ignore whitespace
 
 if show_as_homepage and app.session.member_id == member.id then
 
-  local lang = locale.get("lang")
-  local basepath = request.get_app_basepath() 
-  local file_name = basepath .. "/locale/motd/" .. lang .. ".txt"
-  local file = io.open(file_name)
-  if file ~= nil then
+  if config.motd_intern then
     tabs[#tabs+1] = {
       class = "yellow",
       name = "motd",

File config/default.lua

View file
  • Ignore whitespace
 config.app_name = "LiquidFeedback"
-config.app_version = "beta17"
+config.app_version = "beta18"
 
 config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)"
 

File config/development.lua

View file
  • Ignore whitespace
   else
     return false
   end
-end
+end
+
+config.motd_public = "==Public motd=="
+
+config.motd_intern = "==Internal motd=="
+
+config.public_access = "anonymous"