liquid_feedback_frontend

annotate env/util/help.lua @ 9:0ee1e0c42d4c

Version beta5

Minor security fix: Added missing security filter for admin section. Reading of member listing including login names was possible for all users. Write access has not been possible though.

Changing of name and login is possible while a history of these changes is written and accessible by all users.

Statistics shown in area list

Trimming of user input also converts multiple whitespaces to single space character.
author bsw
date Mon Jan 04 12:00:00 2010 +0100 (2010-01-04)
parents 80c215dbf076
children 00d1004545f1
rev   line source
bsw/jbe@4 1 function util.help(id, title)
bsw/jbe@4 2 local setting_key = "liquidfeedback_frontend_hidden_help_" .. id
bsw/jbe@4 3 local setting = Setting:by_pk(app.session.member.id, setting_key)
bsw/jbe@4 4 if not setting then
bsw/jbe@4 5 ui.container{
bsw/jbe@4 6 attr = { class = "help help_visible" },
bsw/jbe@4 7 content = function()
bsw/jbe@4 8 ui.image{
bsw/jbe@4 9 attr = { class = "help_icon" },
bsw/jbe@4 10 static = "icons/16/help.png"
bsw/jbe@4 11 }
bsw/jbe@4 12 ui.container{
bsw/jbe@4 13 attr = { class = "help_actions" },
bsw/jbe@4 14 content = function()
bsw/jbe@4 15 ui.link{
bsw/jbe@4 16 content = _"Hide this help message",
bsw/jbe@4 17 module = "help",
bsw/jbe@4 18 action = "update",
bsw/jbe@4 19 params = {
bsw/jbe@4 20 help_ident = id,
bsw/jbe@4 21 hide = true
bsw/jbe@4 22 },
bsw/jbe@4 23 routing = {
bsw/jbe@4 24 default = {
bsw/jbe@4 25 mode = "redirect",
bsw/jbe@4 26 module = request.get_module(),
bsw/jbe@4 27 view = request.get_view(),
bsw/jbe@4 28 id = param.get_id_cgi(),
bsw/jbe@4 29 params = param.get_all_cgi()
bsw/jbe@4 30 }
bsw/jbe@4 31 }
bsw/jbe@4 32 }
bsw/jbe@4 33 end
bsw/jbe@4 34 }
bsw/jbe@4 35 local lang = locale.get("lang")
bsw/jbe@4 36 local basepath = request.get_app_basepath()
bsw/jbe@4 37 local file_name = basepath .. "/locale/help/" .. id .. "." .. lang .. ".txt"
bsw/jbe@4 38 local file = io.open(file_name)
bsw/jbe@4 39 if file ~= nil then
bsw/jbe@4 40 local help_text = file:read("*a")
bsw/jbe@4 41 if #help_text > 0 then
bsw/jbe@4 42 ui.container{
bsw/jbe@4 43 attr = { class = "wiki" },
bsw/jbe@4 44 content = function()
bsw/jbe@4 45 slot.put(format.wiki_text(help_text))
bsw/jbe@4 46 end
bsw/jbe@4 47 }
bsw/jbe@4 48 else
bsw/jbe@4 49 ui.field.text{ value = _("Empty help text: #{id}.#{lang}.txt", { id = id, lang = lang }) }
bsw/jbe@4 50 end
bsw/jbe@4 51 else
bsw/jbe@4 52 ui.field.text{ value = _("Missing help text: #{id}.#{lang}.txt", { id = id, lang = lang }) }
bsw/jbe@4 53 end
bsw/jbe@4 54 end
bsw/jbe@4 55 }
bsw/jbe@4 56 else
bsw/jbe@4 57 if util._hidden_helps == nil then
bsw/jbe@4 58 util._hidden_helps = {}
bsw/jbe@4 59 end
bsw/jbe@4 60 util._hidden_helps[#util._hidden_helps+1] = {
bsw/jbe@4 61 id = id,
bsw/jbe@4 62 title = title
bsw/jbe@4 63 }
bsw/jbe@4 64 end
bsw/jbe@4 65 end

Impressum / About Us