root/luci/branches/luci-0.10/applications/luci-samba/luasrc/model/cbi/samba.lua @ 7038

Revision 7038, 2.5 KB (checked in by jow, 2 years ago)

luci-0.10: merge trunk

  • Property svn:keywords set to Id
Line 
1--[[
2LuCI - Lua Configuration Interface
3
4Copyright 2008 Steven Barth <steven@midlink.org>
5Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
6
7Licensed under the Apache License, Version 2.0 (the "License");
8you may not use this file except in compliance with the License.
9You may obtain a copy of the License at
10
11    http://www.apache.org/licenses/LICENSE-2.0
12
13$Id$
14]]--
15
16m = Map("samba", translate("Network Shares"))
17
18s = m:section(TypedSection, "samba", "Samba")
19s.anonymous = true
20
21s:tab("general",  translate("General Settings"))
22s:tab("template", translate("Edit Template"))
23
24s:taboption("general", Value, "name", translate("Hostname"))
25s:taboption("general", Value, "description", translate("Description"))
26s:taboption("general", Value, "workgroup", translate("Workgroup"))
27s:taboption("general", Value, "homes", translate("Share home-directories"),
28        translate("Allow system users to reach their home directories via " ..
29                "network shares"))
30
31tmpl = s:taboption("template", Value, "_tmpl",
32    translate("Edit the template that is used for generating the samba configuration."), 
33    translate("This is the content of the file '/etc/samba/smb.conf.template' from which your samba configuration will be generated. " ..
34        "Values enclosed by pipe symbols ('|') should not be changed. They get their values from the 'General Settings' tab."))
35
36tmpl.template = "cbi/tvalue"
37tmpl.rows = 20
38
39function tmpl.cfgvalue(self, section)
40    return nixio.fs.readfile("/etc/samba/smb.conf.template")
41end
42
43function tmpl.write(self, section, value)
44    value = value:gsub("\r\n?", "\n")
45    nixio.fs.writefile("//etc/samba/smb.conf.template", value)
46end
47
48
49s = m:section(TypedSection, "sambashare", translate("Shared Directories"))
50s.anonymous = true
51s.addremove = true
52s.template = "cbi/tblsection"
53
54s:option(Value, "name", translate("Name"))
55pth = s:option(Value, "path", translate("Path"))
56if nixio.fs.access("/etc/config/fstab") then
57        pth.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
58end
59
60s:option(Value, "users", translate("Allowed users")).rmempty = true
61
62ro = s:option(Flag, "read_only", translate("Read-only"))
63ro.rmempty = false
64ro.enabled = "yes"
65ro.disabled = "no"
66
67go = s:option(Flag, "guest_ok", translate("Allow guests"))
68go.rmempty = false
69go.enabled = "yes"
70go.disabled = "no"
71
72cm = s:option(Value, "create_mask", translate("Create mask"),
73        translate("Mask for new files"))
74cm.rmempty = true
75cm.size = 4
76
77dm = s:option(Value, "dir_mask", translate("Directory mask"),
78        translate("Mask for new directories"))
79dm.rmempty = true
80dm.size = 4
81
82
83return m
Note: See TracBrowser for help on using the browser.