X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=applications%2Fluci-samba%2Fluasrc%2Fmodel%2Fcbi%2Fsamba.lua;h=91526374a49eae57c345949f725511801c978e5c;hb=9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4;hp=dda4976f98176699378d04aa5c37d682f80222da;hpb=7c765875884d6866c53b63757731b079bace2e9b;p=project%2Fluci.git diff --git a/applications/luci-samba/luasrc/model/cbi/samba.lua b/applications/luci-samba/luasrc/model/cbi/samba.lua index dda4976f9..91526374a 100644 --- a/applications/luci-samba/luasrc/model/cbi/samba.lua +++ b/applications/luci-samba/luasrc/model/cbi/samba.lua @@ -13,42 +13,69 @@ You may obtain a copy of the License at $Id$ ]]-- -m = Map("samba") +m = Map("samba", translate("Network Shares")) s = m:section(TypedSection, "samba", "Samba") s.anonymous = true -s:option(Value, "name") -s:option(Value, "description") -s:option(Value, "workgroup") -s:option(Flag, "homes") +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")) -s = m:section(TypedSection, "sambashare") +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 s.addremove = true s.template = "cbi/tblsection" s:option(Value, "name", translate("Name")) -s:option(Value, "path").titleref = luci.dispatcher.build_url("admin", "system", "fstab") +pth = s:option(Value, "path", translate("Path")) +if nixio.fs.access("/etc/config/fstab") then + pth.titleref = luci.dispatcher.build_url("admin", "system", "fstab") +end -s:option(Value, "users").rmempty = true +s:option(Value, "users", translate("Allowed users")).rmempty = true -ro = s:option(Flag, "read_only") +ro = s:option(Flag, "read_only", translate("Read-only")) ro.rmempty = false ro.enabled = "yes" ro.disabled = "no" -go = s:option(Flag, "guest_ok") +go = s:option(Flag, "guest_ok", translate("Allow guests")) go.rmempty = false go.enabled = "yes" go.disabled = "no" -cm = s:option(Value, "create_mask") +cm = s:option(Value, "create_mask", translate("Create mask"), + translate("Mask for new files")) cm.rmempty = true cm.size = 4 -dm = s:option(Value, "dir_mask") +dm = s:option(Value, "dir_mask", translate("Directory mask"), + translate("Mask for new directories")) dm.rmempty = true dm.size = 4