WAN Mode Page to configure this page." end if (ButtonType and ButtonType == "config") then local inputTable = web.cgiToLuaTable(cgi) --automation part begin local tableIndex = 1 local errorFlag = "OK" validationTable = { function() return validations.ipv6AddrValidate(inputTable["ifStatic.StaticIp"],"IPv6Address error") end, function() return validations.preLenChk(inputTable["ifStatic.PrefixLength"],"Prefix Length error") end, function() return validations.checkboxValidate(inputTable["dhcpv6s.isEnabled"],"1",2) end, function() return validations.isEmpty(inputTable["dhcpv6s.domainName"],"Domain Name error") end, function() return validations.isEmpty(inputTable["dhcpv6s.serverPreference"],"Server pref error") end, function() return validations.checkboxValidate(inputTable["dhcpv6s.useDNSServersFrom"],"3",2) end, function() return validations.ipv6AddrValidate(inputTable["dhcpv6s.primaryDNSServer"],"Primanry DNS error","skip") end, function() return validations.ipv6AddrValidate(inputTable["dhcpv6s.secondaryDNSServer"],"Secondary DNS Error","skip") end, function() return validations.checkboxValidate(inputTable["dhcpv6s.isEnabled"],"1",1) end, function() return validations.v6RbnTimeChk(inputTable["dhcpv6s.leaseTime"],"Lease Time error") end } while (tableIndex <= #(validationTable)) do validationFunc = validationTable[tableIndex] errorFlag, statusCode,field,skipValidations = validationFunc() if(errorFlag==1 or errorFlag == "ERROR") then statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) or statusCode statusMessage = field .. ": " .. statusMessage break end if(skipValidations ~= "") then tableIndex = tableIndex + skipValidations + 1 else tableIndex = tableIndex + 1 end end if(errorFlag == "OK" or errorFlag == 0) then local where = "LogicalIfName = 'LAN' AND AddressFamily = '10'" local rowid = db.existsRowWhere ("ifStatic", where) errorFlag, statusCode = lan.obsoleteipv6LanConfig(inputTable, rowid , "edit") -- save db if no error if (errorFlag == "OK") then db.save() end statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) end web.goToPage(NextPage, true, true) elseif(ButtonType and ButtonType == "add") then configRowId= "-1" web.goToPage(NextPage, true, true) elseif(ButtonType and ButtonType == "edit") then -- if not allowed to edit if (ACCESS_LEVEL ~= 0) then NextPage = "lanConfigIpv6" statusMessage = db.getAttribute("stringsMap", "stringId", "ADMIN_REQD", LANGUAGE) else configRowId = RowId end web.goToPage(NextPage, true, true) elseif(ButtonType and ButtonType == "delete") then local field, splitted, rows = web.cgiSearch(cgi, "dhcpv6sLANAddrPool") -- if any rows to delete if (rows) then errorFlag, statusCode = lan.lanPoolsDelete(rows) end -- save db if no error if (errorFlag == "OK") then db.save() end statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) web.goToPage(NextPage, true, true) elseif(ButtonType and ButtonType == "deleteV6") then local field, splitted, rows = web.cgiSearch(cgi, "dhcpv6sLANPrefixPool") -- if any rows to delete if (rows) then errorFlag, statusCode = lan.lanPrefixPoolsDelete(rows) end -- save db if no error if (errorFlag == "OK") then db.save() end statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) or statusCode web.goToPage(NextPage, true, true) else configRow = db.getRow("dhcpv6s", "_ROWID_", "1") if (configRow == nil) then configRow = db.getDefaults(true, "dhcpv6s") end local staticRow = {} local where = "LogicalIfName = 'LAN' AND AddressFamily = '10'" local rowid = db.existsRowWhere ("ifStatic", where) staticRow = db.getRow("ifStatic", "_ROWID_", rowid ) if(staticRow ~= nil) then configRow["ifStatic.StaticIp"] = staticRow["ifStatic.StaticIp"] configRow["ifStatic.PrefixLength"] = staticRow["ifStatic.PrefixLength"] end ?>