From 5c241915dc49b7ecee0fd3f09d34dd2b0766904b Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 4 Mar 2014 02:44:06 +0000 Subject: Fix sort by filesize in logfiles/status --- dhcp-listfiles-html.lsp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dhcp-listfiles-html.lsp b/dhcp-listfiles-html.lsp index 3b9b2fe..3e1bb65 100644 --- a/dhcp-listfiles-html.lsp +++ b/dhcp-listfiles-html.lsp @@ -3,6 +3,20 @@ htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> +<% +function convertsize(size) + if string.find(size, "k$") then + return tonumber(string.match(size, "[%d.]*")) * 1024.0 + elseif string.find(size, "M$") then + return tonumber(string.match(size, "[%d.]*")) * 1024.0 * 1024.0 + elseif string.find(size, "G$") then + return tonumber(string.match(size, "[%d.]*")) + 1024.0 * 1024.0 * 1024.0 + else + return tonumber(string.match(size, "[%d.]*")) + end +end +%> +