1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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 s:taboption("general", Value, "homes", translate("Share home-directories"),
17 translate("Allow system users to reach their home directories via " ..
20 tmpl = s:taboption("template", Value, "_tmpl",
21 translate("Edit the template that is used for generating the samba configuration."),
22 translate("This is the content of the file '/etc/samba/smb.conf.template' from which your samba configuration will be generated. " ..
23 "Values enclosed by pipe symbols ('|') should not be changed. They get their values from the 'General Settings' tab."))
25 tmpl.template = "cbi/tvalue"
28 function tmpl.cfgvalue(self, section)
29 return nixio.fs.readfile("/etc/samba/smb.conf.template")
32 function tmpl.write(self, section, value)
33 value = value:gsub("\r\n?", "\n")
34 nixio.fs.writefile("//etc/samba/smb.conf.template", value)
38 s = m:section(TypedSection, "sambashare", translate("Shared Directories"))
41 s.template = "cbi/tblsection"
43 s:option(Value, "name", translate("Name"))
44 pth = s:option(Value, "path", translate("Path"))
45 if nixio.fs.access("/etc/config/fstab") then
46 pth.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
49 s:option(Value, "users", translate("Allowed users")).rmempty = true
51 ro = s:option(Flag, "read_only", translate("Read-only"))
56 go = s:option(Flag, "guest_ok", translate("Allow guests"))
61 cm = s:option(Value, "create_mask", translate("Create mask"),
62 translate("Mask for new files"))
66 dm = s:option(Value, "dir_mask", translate("Directory mask"),
67 translate("Mask for new directories"))