liquid_feedback_frontend
view env/util/help.lua @ 145:90520c9fca44
implement area filter in timeline
allows the user to ignore any area in the timeline filter.
better display in javascript off
allows the user to ignore any area in the timeline filter.
better display in javascript off
| author | Daniel Poelzleithner <poelzi@poelzi.org> |
|---|---|
| date | Thu Oct 07 00:35:48 2010 +0200 (2010-10-07) |
| parents | 134fce4bede3 |
| children |
line source
1 function util.help(id, title)
2 if not app.session.member_id then
3 return
4 end
5 local setting_key = "liquidfeedback_frontend_hidden_help_" .. id
6 local setting = Setting:by_pk(app.session.member.id, setting_key)
7 if not setting then
8 ui.container{
9 attr = { class = "help help_visible" },
10 content = function()
11 ui.image{
12 attr = { class = "help_icon" },
13 static = "icons/16/help.png"
14 }
15 ui.container{
16 attr = { class = "help_actions" },
17 content = function()
18 ui.link{
19 text = _"Hide this help message",
20 module = "help",
21 action = "update",
22 params = {
23 help_ident = id,
24 hide = true
25 },
26 routing = {
27 default = {
28 mode = "redirect",
29 module = request.get_module(),
30 view = request.get_view(),
31 id = param.get_id_cgi(),
32 params = param.get_all_cgi()
33 }
34 }
35 }
36 end
37 }
38 local lang = locale.get("lang")
39 local basepath = request.get_app_basepath()
40 local file_name = basepath .. "/locale/help/" .. id .. "." .. lang .. ".txt.html"
41 local file = io.open(file_name)
42 if file ~= nil then
43 local help_text = file:read("*a")
44 if #help_text > 0 then
45 ui.container{
46 attr = { class = "wiki" },
47 content = function()
48 slot.put(help_text)
49 end
50 }
51 else
52 ui.field.text{ value = _("Empty help text: #{id}.#{lang}.txt", { id = id, lang = lang }) }
53 end
54 else
55 ui.field.text{ value = _("Missing help text: #{id}.#{lang}.txt", { id = id, lang = lang }) }
56 end
57 end
58 }
59 else
60 if util._hidden_helps == nil then
61 util._hidden_helps = {}
62 end
63 util._hidden_helps[#util._hidden_helps+1] = {
64 id = id,
65 title = title
66 }
67 end
68 end
