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