diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-12-03 15:17:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:26:20 +0100 |
commit | 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch) | |
tree | 35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-diag-devinfo/luasrc | |
parent | 9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff) |
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
* Make each LuCI module its own standalone package
* Deploy a shared luci.mk which is used by each module Makefile
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-diag-devinfo/luasrc')
15 files changed, 0 insertions, 921 deletions
diff --git a/applications/luci-diag-devinfo/luasrc/controller/luci_diag/devinfo_common.lua b/applications/luci-diag-devinfo/luasrc/controller/luci_diag/devinfo_common.lua deleted file mode 100644 index c124cd310..000000000 --- a/applications/luci-diag-devinfo/luasrc/controller/luci_diag/devinfo_common.lua +++ /dev/null @@ -1,195 +0,0 @@ ---[[ - -Luci diag - Diagnostics controller module -(c) 2009 Daniel Dickinson - -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 - -]]-- - -module("luci.controller.luci_diag.devinfo_common", package.seeall) - -require("luci.i18n") -require("luci.util") -require("luci.sys") -require("luci.cbi") -require("luci.model.uci") - -local translate = luci.i18n.translate -local DummyValue = luci.cbi.DummyValue -local SimpleSection = luci.cbi.SimpleSection - -function index() - return -- no-op -end - -function run_processes(outnets, cmdfunc) - i = next(outnets, nil) - while (i) do - outnets[i]["output"] = luci.sys.exec(cmdfunc(outnets, i)) - i = next(outnets, i) - end -end - -function parse_output(devmap, outnets, haslink, type, mini, debug) - local curnet = next(outnets, nil) - - while (curnet) do - local output = outnets[curnet]["output"] - local subnet = outnets[curnet]["subnet"] - local ports = outnets[curnet]["ports"] - local interface = outnets[curnet]["interface"] - local netdevs = {} - devlines = luci.util.split(output) - if not devlines then - devlines = {} - table.insert(devlines, output) - end - - local j = nil - j = next(devlines, j) - - local found_a_device = false - - while (j) do - if devlines[j] and ( devlines[j] ~= "" ) then - found_a_device = true - local devtable - local row = {} - devtable = luci.util.split(devlines[j], ' | ') - row["ip"] = devtable[1] - if (not mini) then - row["mac"] = devtable[2] - end - if ( devtable[4] == 'unknown' ) then - row["vendor"] = devtable[3] - else - row["vendor"] = devtable[4] - end - row["type"] = devtable[5] - if (not mini) then - row["model"] = devtable[6] - end - if (haslink) then - row["config_page"] = devtable[7] - end - - if (debug) then - row["raw"] = devlines[j] - end - table.insert(netdevs, row) - end - j = next(devlines, j) - end - if not found_a_device then - local row = {} - row["ip"] = curnet - if (not mini) then - row["mac"] = "" - end - if (type == "smap") then - row["vendor"] = luci.i18n.translate("No SIP devices") - else - row["vendor"] = luci.i18n.translate("No devices detected") - end - row["type"] = luci.i18n.translate("check other networks") - if (not mini) then - row["model"] = "" - end - if (haslink) then - row["config_page"] = "" - end - if (debug) then - row["raw"] = output - end - table.insert(netdevs, row) - end - local s - if (type == "smap") then - if (mini) then - s = devmap:section(luci.cbi.Table, netdevs, luci.i18n.translate("SIP devices discovered for") .. " " .. curnet) - else - local interfacestring = "" - if ( interface ~= "" ) then - interfacestring = ", " .. interface - end - s = devmap:section(luci.cbi.Table, netdevs, luci.i18n.translate("SIP devices discovered for") .. " " .. curnet .. " (" .. subnet .. ":" .. ports .. interfacestring .. ")") - end - s.template = "diag/smapsection" - else - if (mini) then - s = devmap:section(luci.cbi.Table, netdevs, luci.i18n.translate("Devices discovered for") .. " " .. curnet) - else - local interfacestring = "" - if ( interface ~= "" ) then - interfacestring = ", " .. interface - end - s = devmap:section(luci.cbi.Table, netdevs, luci.i18n.translate("Devices discovered for") .. " " .. curnet .. " (" .. subnet .. interfacestring .. ")") - end - end - s:option(DummyValue, "ip", translate("IP Address")) - if (not mini) then - s:option(DummyValue, "mac", translate("MAC Address")) - end - s:option(DummyValue, "vendor", translate("Vendor")) - s:option(DummyValue, "type", translate("Device Type")) - if (not mini) then - s:option(DummyValue, "model", translate("Model")) - end - if (haslink) then - s:option(DummyValue, "config_page", translate("Link to Device")) - end - if (debug) then - s:option(DummyValue, "raw", translate("Raw")) - end - curnet = next(outnets, curnet) - end -end - -function get_network_device(interface) - local state = luci.model.uci.cursor_state() - state:load("network") - local dev - - return state:get("network", interface, "ifname") -end - - -function cbi_add_networks(field) - uci.cursor():foreach("network", "interface", - function (section) - if section[".name"] ~= "loopback" then - field:value(section[".name"]) - end - end - ) - field.titleref = luci.dispatcher.build_url("admin", "network", "network") -end - -function config_devinfo_scan(map, scannet) - local o - o = scannet:option(luci.cbi.Flag, "enable", translate("Enable")) - o.optional = false - o.rmempty = false - - o = scannet:option(luci.cbi.Value, "interface", translate("Interface")) - o.optional = false - luci.controller.luci_diag.devinfo_common.cbi_add_networks(o) - - local scansubnet - scansubnet = scannet:option(luci.cbi.Value, "subnet", translate("Subnet")) - scansubnet.optional = false - - o = scannet:option(luci.cbi.Value, "timeout", translate("Timeout"), translate("Time to wait for responses in seconds (default 10)")) - o.optional = true - - o = scannet:option(luci.cbi.Value, "repeat_count", translate("Repeat Count"), translate("Number of times to send requests (default 1)")) - o.optional = true - - o = scannet:option(luci.cbi.Value, "sleepreq", translate("Sleep Between Requests"), translate("Milliseconds to sleep between requests (default 100)")) - o.optional = true -end diff --git a/applications/luci-diag-devinfo/luasrc/controller/luci_diag/luci_diag_devinfo.lua b/applications/luci-diag-devinfo/luasrc/controller/luci_diag/luci_diag_devinfo.lua deleted file mode 100644 index 7a2fbd91a..000000000 --- a/applications/luci-diag-devinfo/luasrc/controller/luci_diag/luci_diag_devinfo.lua +++ /dev/null @@ -1,56 +0,0 @@ ---[[ - -Luci diag - Diagnostics controller module -(c) 2009 Daniel Dickinson - -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 - -]]-- - -module("luci.controller.luci_diag.luci_diag_devinfo", package.seeall) - -function index() - local e - - e = entry({"admin", "voice", "diag", "phones"}, arcombine(cbi("luci_diag/smap_devinfo"), cbi("luci_diag/smap_devinfo_config")), _("Phones"), 10) - e.leaf = true - e.subindex = true - e.dependent = true - - e = entry({"admin", "voice", "diag", "phones", "config"}, cbi("luci_diag/smap_devinfo_config"), _("Configure"), 10) - - e = entry({"admin", "status", "smap_devinfo"}, cbi("luci_diag/smap_devinfo"), _("SIP Devices on Network"), 120) - e.leaf = true - e.dependent = true - - e = entry({"admin", "network", "diag_config", "netdiscover_devinfo_config"}, cbi("luci_diag/netdiscover_devinfo_config"), _("Network Device Scan"), 100) - e.leaf = true - e.dependent = true - - e = entry({"admin", "network", "diag_config", "smap_devinfo_config"}, cbi("luci_diag/smap_devinfo_config"), _("SIP Device Scan")) - e.leaf = true - e.dependent = true - - e = entry({"admin", "status", "netdiscover_devinfo"}, cbi("luci_diag/netdiscover_devinfo"), _("Devices on Network"), 90) - e.dependent = true - - e = entry({"admin", "network", "mactodevinfo"}, cbi("luci_diag/mactodevinfo"), _("MAC Device Info Overrides"), 190) - e.dependent = true - - e = entry({"mini", "diag", "phone_scan"}, cbi("luci_diag/smap_devinfo_mini"), _("Phone Scan"), 100) - e.dependent = true - - e = entry({"mini", "voice", "phones", "phone_scan_config"}, cbi("luci_diag/smap_devinfo_config_mini"), _("Config Phone Scan"), 90) - e.dependent = true - - e = entry({"mini", "diag", "netdiscover_devinfo"}, cbi("luci_diag/netdiscover_devinfo_mini"), _("Network Device Scan"), 10) - e.dependent = true - - e = entry({"mini", "network", "netdiscover_devinfo_config"}, cbi("luci_diag/netdiscover_devinfo_config_mini"), _("Device Scan Config")) - e.dependent = true - -end diff --git a/applications/luci-diag-devinfo/luasrc/controller/luci_diag/netdiscover_common.lua b/applications/luci-diag-devinfo/luasrc/controller/luci_diag/netdiscover_common.lua deleted file mode 100644 index 592ca1eaa..000000000 --- a/applications/luci-diag-devinfo/luasrc/controller/luci_diag/netdiscover_common.lua +++ /dev/null @@ -1,101 +0,0 @@ ---[[ - -Luci diag - Diagnostics controller module -(c) 2009 Daniel Dickinson - -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 - -]]-- - -module("luci.controller.luci_diag.netdiscover_common", package.seeall) - -require("luci.i18n") -require("luci.util") -require("luci.sys") -require("luci.cbi") -require("luci.model.uci") - -local translate = luci.i18n.translate -local DummyValue = luci.cbi.DummyValue -local SimpleSection = luci.cbi.SimpleSection - -function index() - return -- no-op -end - -function get_params() - - local netdiscover_uci = luci.model.uci.cursor() - netdiscover_uci:load("luci_devinfo") - local nettable = netdiscover_uci:get_all("luci_devinfo") - - local i - local subnet - local netdout - - local outnets = {} - - i = next(nettable, nil) - - while (i) do - if (netdiscover_uci:get("luci_devinfo", i) == "netdiscover_scannet") then - local scannet = netdiscover_uci:get_all("luci_devinfo", i) - if scannet["subnet"] and (scannet["subnet"] ~= "") and scannet["enable"] and ( scannet["enable"] == "1") then - local output = "" - local outrow = {} - outrow["interface"] = scannet["interface"] - outrow["timeout"] = 10 - local timeout = tonumber(scannet["timeout"]) - if timeout and ( timeout > 0 ) then - outrow["timeout"] = scannet["timeout"] - end - - outrow["repeat_count"] = 1 - local repcount = tonumber(scannet["repeat_count"]) - if repcount and ( repcount > 0 ) then - outrow["repeat_count"] = scannet["repeat_count"] - end - - outrow["sleepreq"] = 100 - local repcount = tonumber(scannet["sleepreq"]) - if repcount and ( repcount > 0 ) then - outrow["sleepreq"] = scannet["sleepreq"] - end - - outrow["subnet"] = scannet["subnet"] - outrow["output"] = output - outnets[i] = outrow - end - end - i = next(nettable, i) - end - return outnets -end - -function command_function(outnets, i) - local interface = luci.controller.luci_diag.devinfo_common.get_network_device(outnets[i]["interface"]) - - return "/usr/bin/netdiscover-to-devinfo " .. outnets[i]["subnet"] .. " " .. interface .. " " .. outnets[i]["timeout"] .. " -r " .. outnets[i]["repeat_count"] .. " -s " .. outnets[i]["sleepreq"] .. " </dev/null" -end - -function action_links(netdiscovermap, mini) - s = netdiscovermap:section(SimpleSection, "", translate("Actions")) - b = s:option(DummyValue, "_config", translate("Configure Scans")) - b.value = "" - if (mini) then - b.titleref = luci.dispatcher.build_url("mini", "network", "netdiscover_devinfo_config") - else - b.titleref = luci.dispatcher.build_url("admin", "network", "diag_config", "netdiscover_devinfo_config") - end - b = s:option(DummyValue, "_scans", translate("Repeat Scans (this can take a few minutes)")) - b.value = "" - if (mini) then - b.titleref = luci.dispatcher.build_url("mini", "diag", "netdiscover_devinfo") - else - b.titleref = luci.dispatcher.build_url("admin", "status", "netdiscover_devinfo") - end -end diff --git a/applications/luci-diag-devinfo/luasrc/controller/luci_diag/smap_common.lua b/applications/luci-diag-devinfo/luasrc/controller/luci_diag/smap_common.lua deleted file mode 100644 index e9aeaa621..000000000 --- a/applications/luci-diag-devinfo/luasrc/controller/luci_diag/smap_common.lua +++ /dev/null @@ -1,112 +0,0 @@ ---[[ - -Luci diag - Diagnostics controller module -(c) 2009 Daniel Dickinson - -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 - -]]-- - -module("luci.controller.luci_diag.smap_common", package.seeall) - -require("luci.i18n") -require("luci.util") -require("luci.sys") -require("luci.cbi") -require("luci.model.uci") - -local translate = luci.i18n.translate -local DummyValue = luci.cbi.DummyValue -local SimpleSection = luci.cbi.SimpleSection - -function index() - return -- no-op -end - -function get_params() - - local smapnets_uci = luci.model.uci.cursor() - smapnets_uci:load("luci_devinfo") - local nettable = smapnets_uci:get_all("luci_devinfo") - - local i - local subnet - local smapout - - local outnets = {} - - i = next(nettable, nil) - - while (i) do - if (smapnets_uci:get("luci_devinfo", i) == "smap_scannet") then - local scannet = smapnets_uci:get_all("luci_devinfo", i) - if scannet["subnet"] and (scannet["subnet"] ~= "") and scannet["enable"] and ( scannet["enable"] == "1") then - local output = "" - local outrow = {} - outrow["subnet"] = scannet["subnet"] - ports = "5060" - if scannet["ports"] and ( scannet["ports"] ~= "" ) then - ports = scannet["ports"] - end - outrow["timeout"] = 10 - local timeout = tonumber(scannet["timeout"]) - if timeout and ( timeout > 0 ) then - outrow["timeout"] = scannet["timeout"] - end - - outrow["repeat_count"] = 1 - local repcount = tonumber(scannet["repeat_count"]) - if repcount and ( repcount > 0 ) then - outrow["repeat_count"] = scannet["repeat_count"] - end - - outrow["sleepreq"] = 100 - local repcount = tonumber(scannet["sleepreq"]) - if repcount and ( repcount > 0 ) then - outrow["sleepreq"] = scannet["sleepreq"] - end - - if scannet["interface"] and ( scannet["interface"] ~= "" ) then - outrow["interface"] = scannet["interface"] - else - outrow["interface"] = "" - end - - outrow["ports"] = ports - outrow["output"] = output - outnets[i] = outrow - end - end - i = next(nettable, i) - end - return outnets -end - -function command_function(outnets, i) - - local interface = luci.controller.luci_diag.devinfo_common.get_network_device(outnets[i]["interface"]) - - return "/usr/bin/netsmap-to-devinfo -r " .. outnets[i]["subnet"] .. " -t " .. outnets[i]["timeout"] .. " -i " .. interface .. " -x -p " .. outnets[i]["ports"] .. " -c " .. outnets[i]["repeat_count"] .. " -s " .. outnets[i]["sleepreq"] .. " </dev/null" -end - -function action_links(smapmap, mini) - s = smapmap:section(SimpleSection, "", translate("Actions")) - b = s:option(DummyValue, "_config", translate("Configure Scans")) - b.value = "" - if (mini) then - b.titleref = luci.dispatcher.build_url("mini", "voice", "phones", "phone_scan_config") - else - b.titleref = luci.dispatcher.build_url("admin", "network", "diag_config", "smap_devinfo_config") - end - b = s:option(DummyValue, "_scans", translate("Repeat Scans (this can take a few minutes)")) - b.value = "" - if (mini) then - b.titleref = luci.dispatcher.build_url("mini", "diag", "phone_scan") - else - b.titleref = luci.dispatcher.build_url("admin", "status", "smap_devinfo") - end -end diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/mactodevinfo.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/mactodevinfo.lua deleted file mode 100644 index baf02c89c..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/mactodevinfo.lua +++ /dev/null @@ -1,36 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -m = Map("mactodevinfo", luci.i18n.translate("MAC Device Info Overrides"), translate("Override the information returned by the MAC to Device Info Script (mac-to-devinfo) for a specified range of MAC Addresses")) - -s = m:section(TypedSection, "mactodevinfo", translate("MAC Device Override"), translate("MAC range and information used to override system and IEEE databases")) -s.addremove = true -s.anonymous = true - -v = s:option(Value, "name", translate("Name")) -v.optional = true -v = s:option(Value, "maclow", translate("Beginning of MAC address range")) -v.optional = false -v = s:option(Value, "machigh", translate("End of MAC address range")) -v.optional = false -v = s:option(Value, "vendor", translate("Vendor")) -v.optional = false -v = s:option(Value, "devtype", translate("Device Type")) -v.optional = false -v = s:option(Value, "model", translate("Model")) -v.optional = false -v = s:option(Value, "ouiowneroverride", translate("OUI Owner")) -v.optional = true - -return m diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo.lua deleted file mode 100644 index 535c46ba7..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo.lua +++ /dev/null @@ -1,33 +0,0 @@ ---[[ -netdiscover_devinfo - SIP Device Information - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -require("luci.i18n") -require("luci.util") -require("luci.sys") -require("luci.model.uci") -require("luci.controller.luci_diag.netdiscover_common") -require("luci.controller.luci_diag.devinfo_common") - -local debug = false - -m = SimpleForm("luci_devinfo", translate("Network Device Scan"), translate("Scans for devices on specified networks.")) -m.reset = false -m.submit = false - -local outnets = luci.controller.luci_diag.netdiscover_common.get_params() -luci.controller.luci_diag.devinfo_common.run_processes(outnets, luci.controller.luci_diag.netdiscover_common.command_function) -luci.controller.luci_diag.devinfo_common.parse_output(m, outnets, false, "netdiscover", false, debug) -luci.controller.luci_diag.netdiscover_common.action_links(m, false) - -return m diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_config.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_config.lua deleted file mode 100644 index e982bcef6..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_config.lua +++ /dev/null @@ -1,30 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -require("luci.controller.luci_diag.devinfo_common") - -m = Map("luci_devinfo", translate("Network Device Scanning Configuration"), translate("Configure scanning for devices on specified networks. Decreasing \'Timeout\', \'Repeat Count\', and/or \'Sleep Between Requests\' may speed up scans, but also may fail to find some devices.")) - -s = m:section(SimpleSection, "", translate("Use Configuration")) -b = s:option(DummyValue, "_scans", translate("Perform Scans (this can take a few minutes)")) -b.value = "" -b.titleref = luci.dispatcher.build_url("admin", "status", "netdiscover_devinfo") - -scannet = m:section(TypedSection, "netdiscover_scannet", translate("Scanning Configuration"), translate("Networks to scan for devices")) -scannet.addremove = true -scannet.anonymous = false - -luci.controller.luci_diag.devinfo_common.config_devinfo_scan(m, scannet) - -return m diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_config_mini.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_config_mini.lua deleted file mode 100644 index a99ddf9b8..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_config_mini.lua +++ /dev/null @@ -1,30 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -require("luci.controller.luci_diag.devinfo_common") - -m = Map("luci_devinfo", translate("Network Device Scanning Configuration"), translate("Configure scanning for devices on specified networks. Decreasing \'Timeout\', \'Repeat Count\', and/or \'Sleep Between Requests\' may speed up scans, but also may fail to find some devices.")) - -s = m:section(SimpleSection, "", translate("Use Configuration")) -b = s:option(DummyValue, "_scans", translate("Perform Scans (this can take a few minutes)")) -b.value = "" -b.titleref = luci.dispatcher.build_url("mini", "diag", "netdiscover_devinfo") - -scannet = m:section(TypedSection, "netdiscover_scannet", translate("Scanning Configuration"), translate("Networks to scan for devices")) -scannet.addremove = true -scannet.anonymous = false - -luci.controller.luci_diag.devinfo_common.config_devinfo_scan(m, scannet) - -return m diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_mini.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_mini.lua deleted file mode 100644 index 271c114d2..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/netdiscover_devinfo_mini.lua +++ /dev/null @@ -1,33 +0,0 @@ ---[[ -netdiscover_devinfo - SIP Device Information - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -require("luci.i18n") -require("luci.util") -require("luci.sys") -require("luci.model.uci") -require("luci.controller.luci_diag.netdiscover_common") -require("luci.controller.luci_diag.devinfo_common") - -local debug = false - -m = SimpleForm("luci_devinfo", translate("Network Device Scan"), translate("Scan for devices on specified networks.")) -m.reset = false -m.submit = false - -local outnets = luci.controller.luci_diag.netdiscover_common.get_params() -luci.controller.luci_diag.devinfo_common.run_processes(outnets, luci.controller.luci_diag.netdiscover_common.command_function) -luci.controller.luci_diag.devinfo_common.parse_output(m, outnets, false, "netdiscover", true, debug) -luci.controller.luci_diag.netdiscover_common.action_links(m, true) - -return m diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo.lua deleted file mode 100644 index ff808d9ef..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo.lua +++ /dev/null @@ -1,33 +0,0 @@ ---[[ -smap_devinfo - SIP Device Information - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -require("luci.i18n") -require("luci.util") -require("luci.sys") -require("luci.model.uci") -require("luci.controller.luci_diag.smap_common") -require("luci.controller.luci_diag.devinfo_common") - -local debug = false - -m = SimpleForm("luci-smap-to-devinfo", translate("SIP Device Information"), translate("Scan for supported SIP devices on specified networks.")) -m.reset = false -m.submit = false - -local outnets = luci.controller.luci_diag.smap_common.get_params() -luci.controller.luci_diag.devinfo_common.run_processes(outnets, luci.controller.luci_diag.smap_common.command_function) -luci.controller.luci_diag.devinfo_common.parse_output(m, outnets, true, "smap", false, debug) -luci.controller.luci_diag.smap_common.action_links(m, false) - -return m diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_config.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_config.lua deleted file mode 100644 index 20b6987f2..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_config.lua +++ /dev/null @@ -1,35 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -require("luci.controller.luci_diag.devinfo_common") - -m = Map("luci_devinfo", translate("SIP Device Scanning Configuration"), translate("Configure scanning for supported SIP devices on specified networks. Decreasing \'Timeout\', \'Repeat Count\', and/or \'Sleep Between Requests\' may speed up scans, but also may fail to find some devices.")) - -s = m:section(SimpleSection, "", translate("Use Configuration")) -b = s:option(DummyValue, "_scans", translate("Perform Scans (this can take a few minutes)")) -b.value = "" -b.titleref = luci.dispatcher.build_url("admin", "status", "smap_devinfo") - -scannet = m:section(TypedSection, "smap_scannet", translate("Scanning Configuration"), translate("Networks to scan for supported devices")) -scannet.addremove = true -scannet.anonymous = false - -local ports -ports = scannet:option(Value, "ports", translate("Ports")) -ports.optional = true -ports.rmempty = true - -luci.controller.luci_diag.devinfo_common.config_devinfo_scan(m, scannet) - -return m diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_config_mini.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_config_mini.lua deleted file mode 100644 index aff4a98ae..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_config_mini.lua +++ /dev/null @@ -1,36 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -require("luci.controller.luci_diag.devinfo_common") - -m = Map("luci_devinfo", translate("Phone Scanning Configuration"), translate("Configure scanning for supported SIP devices on specified networks. Decreasing \'Timeout\', \'Repeat Count\', and/or \'Sleep Between Requests\' may speed up scans, but also may fail to find some devices.")) - -s = m:section(SimpleSection, "", translate("Use Configuration")) -b = s:option(DummyValue, "_scans", translate("Perform Scans (this can take a few minutes)")) -b.value = "" -b.titleref = luci.dispatcher.build_url("mini", "diag", "phone_scan") - -scannet = m:section(TypedSection, "smap_scannet", translate("Scanning Configuration"), translate("Networks to scan for supported devices")) -scannet.addremove = true -scannet.anonymous = false - -local ports -ports = scannet:option(Value, "ports", translate("Ports")) -ports.optional = true -ports.rmempty = true - -luci.controller.luci_diag.devinfo_common.config_devinfo_scan(m, scannet) - - -return m diff --git a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_mini.lua b/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_mini.lua deleted file mode 100644 index 5b7bb0f0a..000000000 --- a/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_mini.lua +++ /dev/null @@ -1,33 +0,0 @@ ---[[ -smap_devinfo - SIP Device Information - -(c) 2009 Daniel Dickinson - -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$ -]]-- - -require("luci.i18n") -require("luci.util") -require("luci.sys") -require("luci.model.uci") -require("luci.controller.luci_diag.smap_common") -require("luci.controller.luci_diag.devinfo_common") - -local debug = false - -m = SimpleForm("luci-smap-to-devinfo", translate("Phone Information"), translate("Scan for supported SIP devices on specified networks.")) -m.reset = false -m.submit = false - -local outnets = luci.controller.luci_diag.smap_common.get_params() -luci.controller.luci_diag.devinfo_common.run_processes(outnets, luci.controller.luci_diag.smap_common.command_function) -luci.controller.luci_diag.devinfo_common.parse_output(m, outnets, true, "smap", true, debug) -luci.controller.luci_diag.smap_common.action_links(m, true) - -return m diff --git a/applications/luci-diag-devinfo/luasrc/view/diag/smapsection.htm b/applications/luci-diag-devinfo/luasrc/view/diag/smapsection.htm deleted file mode 100644 index 742f65957..000000000 --- a/applications/luci-diag-devinfo/luasrc/view/diag/smapsection.htm +++ /dev/null @@ -1,137 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -(c) 2009 Daniel Dickinson - -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$ - --%> -<%- -local rowcnt = 1 -function rowstyle() - rowcnt = rowcnt + 1 - return (rowcnt % 2) + 1 -end --%> - -<!-- smapsection --> -<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>"> - <% if self.title and #self.title > 0 then -%> - <legend><%=self.title%></legend> - <%- end %> - <div class="cbi-section-descr"><%=self.description%></div> - <div class="cbi-section-node"> - <%- local count = 0 -%> - <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <%- if not self.anonymous then -%> - <%- if self.sectionhead then -%> - <th class="cbi-section-table-cell"><%=self.sectionhead%></th> - <%- else -%> - <th> </th> - <%- end -%> - <%- end -%> - <%- for i, k in pairs(self.children) do if not k.optional then -%> - <th class="cbi-section-table-cell"> - <%- if k.titleref then -%><a title="<%=self.titledesc or translate('Go to relevant configuration page')%>" class="cbi-title-ref" href="<%=k.titleref%>"><%- end -%> - <%-=k.title-%> - <%- if k.titleref then -%></a><%- end -%> - </th> - <%- count = count + 1; end; end; if self.extedit or self.addremove then -%> - <th class="cbi-section-table-cell"> </th> - <%- count = count + 1; end -%> - </tr> - <tr class="cbi-section-table-descr"> - <%- if not self.anonymous then -%> - <%- if self.sectiondesc then -%> - <th class="cbi-section-table-cell"><%=self.sectiondesc%></th> - <%- else -%> - <th></th> - <%- end -%> - <%- end -%> - <%- for i, k in pairs(self.children) do if not k.optional then -%> - <th class="cbi-section-table-cell"><%=k.description%></th> - <%- end; end; if self.extedit or self.addremove then -%> - <th class="cbi-section-table-cell"></th> - <%- end -%> - </tr> - <%- local isempty = true - for i, k in ipairs(self:cfgsections()) do - section = k - isempty = false - scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" } - -%> - <tr class="cbi-section-table-row<% if self.extedit or self.rowcolors then %> cbi-rowstyle-<%=rowstyle()%><% end %>" id="cbi-<%=self.config%>-<%=section%>"> - <% if not self.anonymous then -%> - <th><h3><%=k%></h3></th> - <%- end %> - - <%- for k, node in ipairs(self.children) do -%> - <%- if not node.optional then -%> - <%- nodevalue = node:cfgvalue(section) -%> - <%- if nodevalue and ( nodevalue ~= "" ) and string.find(nodevalue, 'http://', 1, plain) then - node.href = nodevalue - node.template = "diag/smapvalue" - end - -%> - <%- node:render(section, scope or {}) -%> - <%- end -%> - <%- end -%> - - <%- if self.extedit or self.addremove then -%> - <td class="cbi-section-table-cell"> - <%- if self.extedit then -%> - <a href=" - <%- if type(self.extedit) == "string" then -%> - <%=self.extedit:format(section)%> - <%- elseif type(self.extedit) == "function" then -%> - <%=self:extedit(section)%> - <%- end -%> - " title="<%:Edit%>"><img style="border: none" src="<%=resource%>/cbi/edit.gif" alt="<%:Edit%>" /></a> - <%- end; if self.addremove then %> - <input type="image" value="<%:Delete%>" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:Delete%>" title="<%:Delete%>" src="<%=resource%>/cbi/remove.gif" /> - <%- end -%> - </td> - <%- end -%> - </tr> - <%- end -%> - - <%- if isempty then -%> - <tr class="cbi-section-table-row"> - <td colspan="<%=count%>"><em><br /><%:This section contains no values yet%></em></td> - </tr> - <%- end -%> - </table> - - <% if self.error then %> - <div class="cbi-section-error"> - <ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%> - <li><%=luci.util.pcdata(e):gsub("\n","<br />")%></li> - <%- end end %></ul> - </div> - <% end %> - - <%- if self.addremove then -%> - <% if self.template_addremove then include(self.template_addremove) else -%> - <div class="cbi-section-create cbi-smapsection-create"> - <% if self.anonymous then %> - <input class="cbi-button cbi-button-add" type="submit" value="<%:Add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" title="<%:Add%>" /> - <% else %> - <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %> - <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" /> - <input class="cbi-button cbi-button-add" type="submit" value="<%:Add%>" title="<%:Add%>" /> - <% if self.invalid_cts then -%> - <br /><%:Invalid%></div> - <%- end %> - <% end %> - </div> - <%- end %> - <%- end -%> - </div> -</fieldset> -<!-- /smapsection --> diff --git a/applications/luci-diag-devinfo/luasrc/view/diag/smapvalue.htm b/applications/luci-diag-devinfo/luasrc/view/diag/smapvalue.htm deleted file mode 100644 index 60aa70a30..000000000 --- a/applications/luci-diag-devinfo/luasrc/view/diag/smapvalue.htm +++ /dev/null @@ -1,21 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -(c) 2009 Daniel Dickinson - -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$ - --%> - -<%+cbi/valueheader%> -<% if self.href then %><a href="<%=self.href%>" target="_blank"><% end -%> - <%=luci.util.pcdata(self:cfgvalue(section))%> -<%- if self.href then %></a><%end%> -  -<input type="hidden" id="<%=cbid%>" value="<%=luci.util.pcdata(self:cfgvalue(section))%>" /> -<%+cbi/valuefooter%> |