# HG changeset patch # User bsw # Date 1271945723 -7200 # Node ID 0e75b5f04fe566edee0dc56c4650e74cc5ab7beb # Parent f77ca23f9ebdfb4702a745b4d47cc67cc36e3985 Show motd only if available diff -r f77ca23f9ebd -r 0e75b5f04fe5 app/main/member/show_tab.lua --- a/app/main/member/show_tab.lua Thu Apr 22 16:03:53 2010 +0200 +++ b/app/main/member/show_tab.lua Thu Apr 22 16:15:23 2010 +0200 @@ -18,15 +18,22 @@ } if show_as_homepage and app.session.member_id == member.id then - tabs[#tabs+1] = { - class = "yellow", - name = "motd", - label = _"Message of the day", - icon = { static = "icons/16/bell.png" }, - module = "index", - view = "_motd", - params = {} - } + + 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 + tabs[#tabs+1] = { + class = "yellow", + name = "motd", + label = _"Message of the day", + icon = { static = "icons/16/bell.png" }, + module = "index", + view = "_motd", + params = {} + } + end local selector = Area:new_selector() :reset_fields()