luci-app-samba: Shared directory help text.
[project/luci.git] / applications / luci-app-samba / luasrc / model / cbi / samba.lua
1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
3 -- Licensed to the public under the Apache License 2.0.
4
5 m = Map("samba", translate("Network Shares"))
6
7 s = m:section(TypedSection, "samba", "Samba")
8 s.anonymous = true
9
10 s:tab("general",  translate("General Settings"))
11 s:tab("template", translate("Edit Template"))
12
13 s:taboption("general", Value, "name", translate("Hostname"))
14 s:taboption("general", Value, "description", translate("Description"))
15 s:taboption("general", Value, "workgroup", translate("Workgroup"))
16 h = s:taboption("general", Flag, "homes", translate("Share home-directories"),
17         translate("Allow system users to reach their home directories via " ..
18                 "network shares"))
19 h.rmempty = false
20
21 tmpl = s:taboption("template", Value, "_tmpl",
22         translate("Edit the template that is used for generating the samba configuration."), 
23         translate("This is the content of the file '/etc/samba/smb.conf.template' from which your samba configuration will be generated. " ..
24                 "Values enclosed by pipe symbols ('|') should not be changed. They get their values from the 'General Settings' tab."))
25
26 tmpl.template = "cbi/tvalue"
27 tmpl.rows = 20
28
29 function tmpl.cfgvalue(self, section)
30         return nixio.fs.readfile("/etc/samba/smb.conf.template")
31 end
32
33 function tmpl.write(self, section, value)
34         value = value:gsub("\r\n?", "\n")
35         nixio.fs.writefile("//etc/samba/smb.conf.template", value)
36 end
37
38
39 s = m:section(TypedSection, "sambashare", translate("Shared Directories")
40   , translate("Please add directories to share. Each directory refers to a folder on a mounted device."))
41 s.anonymous = true
42 s.addremove = true
43 s.template = "cbi/tblsection"
44
45 s:option(Value, "name", translate("Name"))
46 pth = s:option(Value, "path", translate("Path"))
47 if nixio.fs.access("/etc/config/fstab") then
48         pth.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
49 end
50
51 s:option(Value, "users", translate("Allowed users")).rmempty = true
52
53 ro = s:option(Flag, "read_only", translate("Read-only"))
54 ro.rmempty = false
55 ro.enabled = "yes"
56 ro.disabled = "no"
57
58 br = s:option(Flag, "browseable", translate("Browseable"))
59 br.rmempty = false
60 br.default = "yes"
61 br.enabled = "yes"
62 br.disabled = "no"
63
64 go = s:option(Flag, "guest_ok", translate("Allow guests"))
65 go.rmempty = false
66 go.enabled = "yes"
67 go.disabled = "no"
68
69 cm = s:option(Value, "create_mask", translate("Create mask"),
70         translate("Mask for new files"))
71 cm.rmempty = true
72 cm.size = 4
73
74 dm = s:option(Value, "dir_mask", translate("Directory mask"),
75         translate("Mask for new directories"))
76 dm.rmempty = true
77 dm.size = 4
78
79
80 return m