diff options
author | Manuel Munz <freifunk@somakoma.de> | 2011-04-13 15:14:42 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2011-04-13 15:14:42 +0000 |
commit | 707701df743e2d17b54a947aed8053f22ed98c53 (patch) | |
tree | 61919c560cd0bca22226e0bc6251da79383e8776 /applications/luci-samba/luasrc | |
parent | bb2d7517eb3d2229331e11aab5c6c900259e0742 (diff) |
applications/luci-samba: Add textbox to edit the template for config generation (#122)
Diffstat (limited to 'applications/luci-samba/luasrc')
-rw-r--r-- | applications/luci-samba/luasrc/model/cbi/samba.lua | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/applications/luci-samba/luasrc/model/cbi/samba.lua b/applications/luci-samba/luasrc/model/cbi/samba.lua index b73c29e07d..91526374a4 100644 --- a/applications/luci-samba/luasrc/model/cbi/samba.lua +++ b/applications/luci-samba/luasrc/model/cbi/samba.lua @@ -18,13 +18,33 @@ m = Map("samba", translate("Network Shares")) s = m:section(TypedSection, "samba", "Samba") s.anonymous = true -s:option(Value, "name", translate("Hostname")) -s:option(Value, "description", translate("Description")) -s:option(Value, "workgroup", translate("Workgroup")) -s:option(Flag, "homes", translate("Share home-directories"), +s:tab("general", translate("General Settings")) +s:tab("template", translate("Edit Template")) + +s:taboption("general", Value, "name", translate("Hostname")) +s:taboption("general", Value, "description", translate("Description")) +s:taboption("general", Value, "workgroup", translate("Workgroup")) +s:taboption("general", Value, "homes", translate("Share home-directories"), translate("Allow system users to reach their home directories via " .. "network shares")) +tmpl = s:taboption("template", Value, "_tmpl", + translate("Edit the template that is used for generating the samba configuration."), + translate("This is the content of the file '/etc/samba/smb.conf.template' from which your samba configuration will be generated. " .. + "Values enclosed by pipe symbols ('|') should not be changed. They get their values from the 'General Settings' tab.")) + +tmpl.template = "cbi/tvalue" +tmpl.rows = 20 + +function tmpl.cfgvalue(self, section) + return nixio.fs.readfile("/etc/samba/smb.conf.template") +end + +function tmpl.write(self, section, value) + value = value:gsub("\r\n?", "\n") + nixio.fs.writefile("//etc/samba/smb.conf.template", value) +end + s = m:section(TypedSection, "sambashare", translate("Shared Directories")) s.anonymous = true |