diff options
author | Ted Trask <ttrask01@yahoo.com> | 2010-08-05 07:23:35 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2010-08-05 07:23:35 +0000 |
commit | ca1a6c998ef02d7dff879d0d5cfee8937d75c902 (patch) | |
tree | ddde7bfba8c80e9b73fd484465138be548f8d225 /weblog-model.lua | |
parent | e145ec58601aaf593e2ded644dd37c8b2e815310 (diff) | |
download | acf-weblog-ca1a6c998ef02d7dff879d0d5cfee8937d75c902.tar.bz2 acf-weblog-ca1a6c998ef02d7dff879d0d5cfee8937d75c902.tar.xz |
Added shortreason to config, allowing users to choose whether they show full or short reason in log.
Diffstat (limited to 'weblog-model.lua')
-rw-r--r-- | weblog-model.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/weblog-model.lua b/weblog-model.lua index dc9591b..2222815 100644 --- a/weblog-model.lua +++ b/weblog-model.lua @@ -435,11 +435,13 @@ local listlogentries = function(logname, clientuserid, starttime, endtime, clien cur = assert (con:execute(sql)) row = cur:fetch ({}, "a") while row do - local uridescr = row.uri if config.shorturi == "true" then shorturi=string.gsub(row.uri, "[;?].*", "...") end entries[#entries+1] = {sourcename=row.sourcename, clientip=row.clientip, clientuserid=row.clientuserid, logdatetime=row.logdatetime, uri=row.uri, shorturi=shorturi, bytes=row.bytes, reason=row.reason, score=row.score, shortreason=row.shortreason} + if (config.shortreason ~= "true") then + entries[#entries].shortreason = nil + end row = cur:fetch (row, "a") end -- close everything @@ -1194,8 +1196,8 @@ function getconfig() result.purgedays = cfe({ value=config.purgedays or "30", label="Days before Purge", descr="Days to keep history, regardless of audit" }) result.historydays = cfe({ value=config.historydays or "14", label="Days to keep History", descr="Days beyond Audit Start Time to keep complete log history" }) result.groupby = cfe({ type="select", value=config.groupby or "clientuserid", label="Group results by", option={"clientuserid", "clientip"} }) - result.shorturi = cfe({ type="boolean", value=false, label="Truncate URLs", descr="You can limit the length of displayed URLs by enabling this option"}) - if config.shorturi == "true" then result.shorturi.value = true end + result.shorturi = cfe({ type="boolean", value=(config.shorturi == "true"), label="Truncate URLs", descr="You can limit the length of displayed URLs by enabling this option"}) + result.shortreason = cfe({ type="boolean", value=(config.shortreason == "true"), label="Short Reason", descr="Display a short reason (without objectional words)"}) return cfe({ type="group", value=result, label="Weblog Config" }) end @@ -1252,6 +1254,7 @@ function updateconfig(newconfig) configcontent = format.update_ini_file(configcontent, "", "historydays", newconfig.value.historydays.value) configcontent = format.update_ini_file(configcontent, "", "groupby", newconfig.value.groupby.value) configcontent = format.update_ini_file(configcontent, "", "shorturi", tostring(newconfig.value.shorturi.value)) + configcontent = format.update_ini_file(configcontent, "", "shortreason", tostring(newconfig.value.shortreason.value)) fs.write_file(configfile, configcontent) config = format.parse_ini_file(configcontent, "") or {} |