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