summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-samba/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-12-03 15:17:05 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-08 16:26:20 +0100
commit1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch)
tree35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-app-samba/luasrc
parent9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff)
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-samba/luasrc')
-rw-r--r--applications/luci-app-samba/luasrc/controller/samba.lua27
-rw-r--r--applications/luci-app-samba/luasrc/model/cbi/samba.lua83
2 files changed, 110 insertions, 0 deletions
diff --git a/applications/luci-app-samba/luasrc/controller/samba.lua b/applications/luci-app-samba/luasrc/controller/samba.lua
new file mode 100644
index 000000000..ee7d44aa4
--- /dev/null
+++ b/applications/luci-app-samba/luasrc/controller/samba.lua
@@ -0,0 +1,27 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
+
+module("luci.controller.samba", package.seeall)
+
+function index()
+ if not nixio.fs.access("/etc/config/samba") then
+ return
+ end
+
+ local page
+
+ page = entry({"admin", "services", "samba"}, cbi("samba"), _("Network Shares"))
+ page.dependent = true
+end
diff --git a/applications/luci-app-samba/luasrc/model/cbi/samba.lua b/applications/luci-app-samba/luasrc/model/cbi/samba.lua
new file mode 100644
index 000000000..91526374a
--- /dev/null
+++ b/applications/luci-app-samba/luasrc/model/cbi/samba.lua
@@ -0,0 +1,83 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
+
+m = Map("samba", translate("Network Shares"))
+
+s = m:section(TypedSection, "samba", "Samba")
+s.anonymous = true
+
+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
+s.addremove = true
+s.template = "cbi/tblsection"
+
+s:option(Value, "name", translate("Name"))
+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", translate("Allowed users")).rmempty = true
+
+ro = s:option(Flag, "read_only", translate("Read-only"))
+ro.rmempty = false
+ro.enabled = "yes"
+ro.disabled = "no"
+
+go = s:option(Flag, "guest_ok", translate("Allow guests"))
+go.rmempty = false
+go.enabled = "yes"
+go.disabled = "no"
+
+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", translate("Directory mask"),
+ translate("Mask for new directories"))
+dm.rmempty = true
+dm.size = 4
+
+
+return m