NIU: More restructuring, Add: change password, hostname
[project/luci.git] / modules / niu / luasrc / model / cbi / niu / network / routes1.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
15 m = Map("network", translate("Routes"), translate("a_n_routes1"))
16
17 local routes6 = luci.sys.net.routes6()
18 local bit = require "bit"
19
20 s = m:section(TypedSection, "route", translate("Static IPv4 Routes"))
21 s.addremove = true
22 s.anonymous = true
23
24 s.template  = "cbi/tblsection"
25
26 iface1 = s:option(ListValue, "interface", translate("Interface"))
27
28 s:option(Value, "target", translate("Target"), translate("Host-<abbr title=\"Internet Protocol Address\">IP</abbr> or Network"))
29 s:option(Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"), translate("if target is a network")).rmemepty = true
30 s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway"))
31
32 if routes6 then
33         s = m:section(TypedSection, "route6", translate("Static IPv6 Routes"))
34         s.addremove = true
35         s.anonymous = true
36
37         s.template  = "cbi/tblsection"
38
39         iface2 = s:option(ListValue, "interface", translate("Interface"))
40
41         s:option(Value, "target", translate("Target"), translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address or Network (CIDR)"))
42         s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")).rmempty = true
43 end
44
45 m.uci:foreach("network", "interface", function(s)
46         if s[".name"] ~= "loopback" then
47                 iface:value(s[".name"])
48                 if iface2 then
49                         iface2:value(s[".name"])
50                 end
51         end
52 end)
53
54
55 return m