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")
40 , translate("Please add directories to share. Each directory refers to a folder on a mounted device."))
43 s.template = "cbi/tblsection"
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")
51 s:option(Value, "users", translate("Allowed users")).rmempty = true
53 ro = s:option(Flag, "read_only", translate("Read-only"))
58 br = s:option(Flag, "browseable", translate("Browseable"))
64 go = s:option(Flag, "guest_ok", translate("Allow guests"))
69 cm = s:option(Value, "create_mask", translate("Create mask"),
70 translate("Mask for new files"))
74 dm = s:option(Value, "dir_mask", translate("Directory mask"),
75 translate("Mask for new directories"))