Module: Help

Included in:
DrbDb
Defined in:
lib/DrbDB/Help.rb

Overview

this file is part of manqod manqod is distributed under the CDDL licence the owner of manqod is Dobai-Pataky Balint([email protected])

Instance Method Summary collapse

Instance Method Details

#load_all_helpObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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) ⇒ Object



43
44
45
46
# 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) ⇒ Object



31
32
33
34
# 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) ⇒ Object



36
37
38
39
40
41
# 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) ⇒ Object



26
27
28
29
# 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