convert luci.fs users to nixio.fs api
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_index / luci.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 require("luci.config")
15 m = Map("luci", translate("webui"), translate("a_i_luci1",
16 "Hier können Eigenschaften und die Funktionalität der Oberfläche angepasst werden."))
17
18 local fs = require "nixio.fs"
19
20 -- force reload of global luci config namespace to reflect the changes
21 function m.commit_handler(self)
22 package.loaded["luci.config"] = nil
23 require("luci.config")
24 end
25
26
27 c = m:section(NamedSection, "main", "core", translate("general"))
28
29 l = c:option(ListValue, "lang", translate("language"))
30 l:value("auto")
31
32 local i18ndir = luci.i18n.i18ndir .. "default."
33 for k, v in luci.util.kspairs(luci.config.languages) do
34 local file = i18ndir .. k:gsub("_", "-")
35 if k:sub(1, 1) ~= "." and (
36 fs.access(file .. ".lua") or
37 fs.access(file .. ".lua.gz")
38 ) then
39 l:value(k, v)
40 end
41 end
42
43 t = c:option(ListValue, "mediaurlbase", translate("design"))
44 for k, v in pairs(luci.config.themes) do
45 if k:sub(1, 1) ~= "." then
46 t:value(v, k)
47 end
48 end
49
50 u = m:section(NamedSection, "uci_oncommit", "event", translate("a_i_ucicommit"),
51 translate("a_i_ucicommit1"))
52 u.dynamic = true
53
54 f = m:section(NamedSection, "flash_keep", "extern", translate("a_i_keepflash"),
55 translate("a_i_keepflash1"))
56 f.dynamic = true
57
58 return m