liquid_feedback_frontend

annotate env/util/help.lua @ 118:93f4e465b50d

add initiator support in delegation

if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
author Daniel Poelzleithner <poelzi@poelzi.org>
date Mon Sep 20 20:32:04 2010 +0200 (2010-09-20)
parents 134fce4bede3
children
rev   line source
bsw/jbe@4 1 function util.help(id, title)
bsw@51 2 if not app.session.member_id then
bsw@51 3 return
bsw@51 4 end
bsw/jbe@4 5 local setting_key = "liquidfeedback_frontend_hidden_help_" .. id
bsw/jbe@4 6 local setting = Setting:by_pk(app.session.member.id, setting_key)
bsw/jbe@4 7 if not setting then
bsw/jbe@4 8 ui.container{
bsw/jbe@4 9 attr = { class = "help help_visible" },
bsw/jbe@4 10 content = function()
bsw/jbe@4 11 ui.image{
bsw/jbe@4 12 attr = { class = "help_icon" },
bsw/jbe@4 13 static = "icons/16/help.png"
bsw/jbe@4 14 }
bsw/jbe@4 15 ui.container{
bsw/jbe@4 16 attr = { class = "help_actions" },
bsw/jbe@4 17 content = function()
bsw/jbe@4 18 ui.link{
bsw/jbe@19 19 text = _"Hide this help message",
bsw/jbe@4 20 module = "help",
bsw/jbe@4 21 action = "update",
bsw/jbe@4 22 params = {
bsw/jbe@4 23 help_ident = id,
bsw/jbe@4 24 hide = true
bsw/jbe@4 25 },
bsw/jbe@4 26 routing = {
bsw/jbe@4 27 default = {
bsw/jbe@4 28 mode = "redirect",
bsw/jbe@4 29 module = request.get_module(),
bsw/jbe@4 30 view = request.get_view(),
bsw/jbe@4 31 id = param.get_id_cgi(),
bsw/jbe@4 32 params = param.get_all_cgi()
bsw/jbe@4 33 }
bsw/jbe@4 34 }
bsw/jbe@4 35 }
bsw/jbe@4 36 end
bsw/jbe@4 37 }
bsw/jbe@4 38 local lang = locale.get("lang")
bsw/jbe@4 39 local basepath = request.get_app_basepath()
bsw@81 40 local file_name = basepath .. "/locale/help/" .. id .. "." .. lang .. ".txt.html"
bsw/jbe@4 41 local file = io.open(file_name)
bsw/jbe@4 42 if file ~= nil then
bsw/jbe@4 43 local help_text = file:read("*a")
bsw/jbe@4 44 if #help_text > 0 then
bsw/jbe@4 45 ui.container{
bsw/jbe@4 46 attr = { class = "wiki" },
bsw/jbe@4 47 content = function()
bsw@81 48 slot.put(help_text)
bsw/jbe@4 49 end
bsw/jbe@4 50 }
bsw/jbe@4 51 else
bsw/jbe@4 52 ui.field.text{ value = _("Empty help text: #{id}.#{lang}.txt", { id = id, lang = lang }) }
bsw/jbe@4 53 end
bsw/jbe@4 54 else
bsw/jbe@4 55 ui.field.text{ value = _("Missing help text: #{id}.#{lang}.txt", { id = id, lang = lang }) }
bsw/jbe@4 56 end
bsw/jbe@4 57 end
bsw/jbe@4 58 }
bsw/jbe@4 59 else
bsw/jbe@4 60 if util._hidden_helps == nil then
bsw/jbe@4 61 util._hidden_helps = {}
bsw/jbe@4 62 end
bsw/jbe@4 63 util._hidden_helps[#util._hidden_helps+1] = {
bsw/jbe@4 64 id = id,
bsw/jbe@4 65 title = title
bsw/jbe@4 66 }
bsw/jbe@4 67 end
bsw/jbe@4 68 end

Impressum / About Us