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.
5 m = Map("samba", translate("Network Shares"))
7 s = m:section(TypedSection, "samba", "Samba")
10 s:tab("general", translate("General Settings"))
11 s:tab("template", translate("Edit Template"))
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 " ..
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."))
26 tmpl.template = "cbi/tvalue"
29 function tmpl.cfgvalue(self, section)
30 return nixio.fs.readfile("/etc/samba/smb.conf.template")
33 function tmpl.write(self, section, value)
34 value = value:gsub("\r\n?", "\n")
35 nixio.fs.writefile("//etc/samba/smb.conf.template", value)
39 s = m:section(TypedSection, "sambashare", translate("Shared Directories"))
42 s.template = "cbi/tblsection"
44 s:option(Value, "name", translate("Name"))
45 pth = s:option(Value, "path", translate("Path"))
46 if nixio.fs.access("/etc/config/fstab") then
47 pth.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
50 s:option(Value, "users", translate("Allowed users")).rmempty = true
52 ro = s:option(Flag, "read_only", translate("Read-only"))
57 go = s:option(Flag, "guest_ok", translate("Allow guests"))
62 cm = s:option(Value, "create_mask", translate("Create mask"),
63 translate("Mask for new files"))
67 dm = s:option(Value, "dir_mask", translate("Directory mask"),
68 translate("Mask for new directories"))