--
-- (C) 2013-17 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
require "graph_utils"
local template = require "template_utils"
local host_pools_utils = require("host_pools_utils")
interface.select(ifname)
local ifstats = interface.getStats()
sendHTTPContentTypeHeader('text/html')
ntop.dumpFile(dirs.installdir .. "/httpdocs/inc/header.inc")
active_page = "devices_stats"
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
local base_url = ntop.getHttpPrefix() .. "/lua/unknown_devices.lua"
local page_params = {}
local macs_filter = ""
if isAdministrator() and (_POST["member"] ~= nil) and (_POST["pool"] ~= nil) then
-- change member pool
host_pools_utils.changeMemberPool(ifstats.id, _POST["member"], _POST["pool"])
interface.reloadHostPools()
end
--[[local manufacturer = nil
local manufacturer_filter = ""
if(not isEmptyString(_GET["manufacturer"])) then
manufacturer = _GET["manufacturer"]
page_params["manufacturer"] = manufacturer
manufacturer_filter = ''
end
page_params["host_macs_only"] = "true"
]]
local pools = host_pools_utils.getPoolsList(ifstats.id, true --[[no info]])
local no_pools = (#pools < 2)
print(
template.gen("modal_confirm_dialog.html", {
dialog={
id = "assign_device_dialog",
action = "assignDevicePool(mac_to_assign)",
title = i18n("unknown_devices.assign_device_pool"),
message = i18n("unknown_devices.select_pool", {mac=""}) ..
'
'..ternary(no_pools, "
"..i18n("unknown_devices.create_pools_first", {url=ntop.getHttpPrefix().."/lua/if_stats.lua?page=pools#create"}), ""),
custom_alert_class = "",
confirm = i18n("unknown_devices.assign_pool"),
confirm_button = "btn-primary "..ternary(no_pools, "disabled", ""),
}
})
)
print [[