Anonymous avatar Anonymous committed c553898

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

Comments (0)

Files changed (6)

app/main/area/list.lua

   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")

app/main/index/_motd.lua

-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

app/main/index/login.lua

   }
 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',

app/main/member/show_tab.lua

 
 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",

config/default.lua

 config.app_name = "LiquidFeedback"
-config.app_version = "beta17"
+config.app_version = "beta18"
 
 config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)"
 

config/development.lua

   else
     return false
   end
-end
+end
+
+config.motd_public = "==Public motd=="
+
+config.motd_intern = "==Internal motd=="
+
+config.public_access = "anonymous"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.