module Help

this file is part of manqod manqod is distributed under the CDDL licence the owner of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)

Public Instance Methods

load_all_help() click to toggle source
# File lib/DrbDB/Help.rb, line 6
def load_all_help
        h=Hash.new
        admin.rows("select * from help_items").each{|item|
                h[item["index"]]=item["description"]
        }

        f=Hash.new
        admin.rows("select * from help_formats").each{|format|
                begin
                        f[format["name"]]=eval(format["format_dump"])
                rescue => err
                        eerror("loading Help Tag Format: #{err}")
                end
        }

        cache.set("help_items",h)
        cache.set("help_formats",f)
        einfo("ManqodHelp: loaded #{h.size} items and #{f.size} formats")
end
remove_help_format(name) click to toggle source
# File lib/DrbDB/Help.rb, line 43
def remove_help_format(name)
        admin.query("delete from help_formats where `name`='#{name}'")
        load_all_help
end
remove_help_item(index) click to toggle source
# File lib/DrbDB/Help.rb, line 31
def remove_help_item(index)
        admin.query("delete from help_items where `index`='#{index}'")
        load_all_help
end
save_help_format(name,format) click to toggle source
# File lib/DrbDB/Help.rb, line 36
def save_help_format(name,format)
        e=Hash.new
        format.each_pair{|key,val| e[key]=val}
        admin.query("replace into help_formats set `name`='#{name}', `format_dump`='#{e.inspect}'")
        load_all_help
end
save_help_item(index,description) click to toggle source
# File lib/DrbDB/Help.rb, line 26
def save_help_item(index,description)
        admin.query("replace into help_items set `index`='#{index}', `description`='#{description}'")
        load_all_help
end