liquid_feedback_frontend

changeset 62:0e75b5f04fe5

Show motd only if available
author bsw
date Thu Apr 22 16:15:23 2010 +0200 (2010-04-22)
parents f77ca23f9ebd
children 32a814f8b496
files app/main/member/show_tab.lua
line diff
     1.1 --- a/app/main/member/show_tab.lua	Thu Apr 22 16:03:53 2010 +0200
     1.2 +++ b/app/main/member/show_tab.lua	Thu Apr 22 16:15:23 2010 +0200
     1.3 @@ -18,15 +18,22 @@
     1.4  }
     1.5  
     1.6  if show_as_homepage and app.session.member_id == member.id then
     1.7 -  tabs[#tabs+1] = {
     1.8 -    class = "yellow",
     1.9 -    name = "motd",
    1.10 -    label = _"Message of the day",
    1.11 -    icon = { static = "icons/16/bell.png" },
    1.12 -    module = "index",
    1.13 -    view = "_motd",
    1.14 -    params = {}
    1.15 -  }
    1.16 +
    1.17 +  local lang = locale.get("lang")
    1.18 +  local basepath = request.get_app_basepath() 
    1.19 +  local file_name = basepath .. "/locale/motd/" .. lang .. ".txt"
    1.20 +  local file = io.open(file_name)
    1.21 +  if file ~= nil then
    1.22 +    tabs[#tabs+1] = {
    1.23 +      class = "yellow",
    1.24 +      name = "motd",
    1.25 +      label = _"Message of the day",
    1.26 +      icon = { static = "icons/16/bell.png" },
    1.27 +      module = "index",
    1.28 +      view = "_motd",
    1.29 +      params = {}
    1.30 +    }
    1.31 +  end
    1.32  
    1.33    local selector = Area:new_selector()
    1.34      :reset_fields()

Impressum / About Us