summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-core/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-13 14:09:33 +0000
committerSteven Barth <steven@midlink.org>2008-08-13 14:09:33 +0000
commit5a92c0fc089f8af4cdd5c35e94a563526c872ffd (patch)
tree50dedc13d40efbcad813f61d1b64eb9a87c9e7f6 /modules/admin-core/luasrc
parenta59044df9b87c7e4ce668649726aa2d355206965 (diff)
libs/cbi: Improved user interface draft #1
Diffstat (limited to 'modules/admin-core/luasrc')
-rw-r--r--modules/admin-core/luasrc/tools/webadmin.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/admin-core/luasrc/tools/webadmin.lua b/modules/admin-core/luasrc/tools/webadmin.lua
index 45bd910ac..b9f18ac40 100644
--- a/modules/admin-core/luasrc/tools/webadmin.lua
+++ b/modules/admin-core/luasrc/tools/webadmin.lua
@@ -14,6 +14,18 @@ $Id$
]]--
module("luci.tools.webadmin", package.seeall)
+require("luci.model.uci")
+
+function byte_format(byte)
+ local suff = {"B", "KB", "MB", "GB", "TB"}
+ for i=1, 5 do
+ if byte > 1024 and i < 5 then
+ byte = byte / 1024
+ else
+ return string.format("%.2f %s", byte, suff[i])
+ end
+ end
+end
function cbi_add_networks(field)
luci.model.uci.foreach("network", "interface",