Merge pull request #1794 from dibdot/adblock
[project/luci.git] / applications / luci-app-firewall / luasrc / model / cbi / firewall / zone-details.lua
index e5bcb34..a42c149 100644 (file)
@@ -1,17 +1,6 @@
---[[
-LuCI - Lua Configuration Interface
-
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2010-2011 Jo-Philipp Wich <xm@subsignal.org>
-
-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$
-]]--
+-- Copyright 2008 Steven Barth <steven@midlink.org>
+-- Copyright 2010-2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
 
 local nw = require "luci.model.network"
 local fw = require "luci.model.firewall"
@@ -32,7 +21,7 @@ nw.init(m.uci)
 
 local zone = fw:get_zone(arg[1])
 if not zone then
-       luci.http.redirect(dsp.build_url("admin/network/firewall/zones"))
+       luci.http.redirect(ds.build_url("admin/network/firewall/zones"))
        return
 else
        m.title = "%s - %s" %{
@@ -71,7 +60,7 @@ s:tab("advanced", translate("Advanced Settings"))
 name = s:taboption("general", Value, "name", translate("Name"))
 name.optional = false
 name.forcewrite = true
-name.datatype = "uciname"
+name.datatype = "and(uciname,maxlength(11))"
 
 function name.write(self, section, value)
        if zone:name() ~= value then
@@ -79,12 +68,6 @@ function name.write(self, section, value)
                out.exclude = value
                inp.exclude = value
        end
-
-       m.redirect = ds.build_url("admin/network/firewall/zones", value)
-       m.title = "%s - %s" %{
-               translate("Firewall - Zone Settings"),
-               translatef("Zone %q", value or "?")
-       }
 end
 
 p = {
@@ -137,7 +120,7 @@ msrc = s:taboption("advanced", DynamicList, "masq_src",
        translate("Restrict Masquerading to given source subnets"))
 
 msrc.optional = true
-msrc.datatype = "list(neg(or(uciname,hostname,ip4addr)))"
+msrc.datatype = "list(neg(or(uciname,hostname,ipmask4)))"
 msrc.placeholder = "0.0.0.0/0"
 msrc:depends("family", "")
 msrc:depends("family", "ipv4")
@@ -146,7 +129,7 @@ mdest = s:taboption("advanced", DynamicList, "masq_dest",
        translate("Restrict Masquerading to given destination subnets"))
 
 mdest.optional = true
-mdest.datatype = "list(neg(or(uciname,hostname,ip4addr)))"
+mdest.datatype = "list(neg(or(uciname,hostname,ipmask4)))"
 mdest.placeholder = "0.0.0.0/0"
 mdest:depends("family", "")
 mdest:depends("family", "ipv4")