summaryrefslogtreecommitdiffstats
path: root/rrdtool-model.lua
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2009-07-09 11:54:27 +0000
committerMika Havela <mika.havela@gmail.com>2009-07-09 11:54:27 +0000
commita08c1bd2894983d7453af0118795edf85788cf0f (patch)
tree2dd600c5bdd63fbaa10909bf0d13868d5d26dd39 /rrdtool-model.lua
parentc6b5228ab2bdf1578a32ffb9cb06b2962cfcb5c6 (diff)
downloadacf-rrdtool-a08c1bd2894983d7453af0118795edf85788cf0f.tar.bz2
acf-rrdtool-a08c1bd2894983d7453af0118795edf85788cf0f.tar.xz
Edit existing and create new graph-files
Putting back full path on graph-files to get standard functions to work propperly
Diffstat (limited to 'rrdtool-model.lua')
-rw-r--r--rrdtool-model.lua24
1 files changed, 18 insertions, 6 deletions
diff --git a/rrdtool-model.lua b/rrdtool-model.lua
index 16ba2be..e915a4a 100644
--- a/rrdtool-model.lua
+++ b/rrdtool-model.lua
@@ -228,21 +228,33 @@ function getgraphlist()
end
function getgraphfile(path)
- if (path) then
- path = graphpath .. "/" .. path
- end
if (path) and not (validfilename(path)) then
path = nil
end
local filedetails = modelfunctions.getfiledetails(path)
local output = {value={filename=filedetails.value.filename,
filecontent=filedetails.value.filecontent,}}
- output.value.filename.value = string.gsub(filedetails.value.filename.value, "^.*/", "")
-- output.value.filecontent.rows="30" -- FIXME: For some reason I can't control the size of a textarea
if not (path) then
output.value.filename.errtxt=nil
- else
- output.value.filename.disabled="true"
end
return output
end
+
+function set_filedetails (self, filedetails, userid)
+ if not (string.match(filedetails.value.filename.value, "^" .. graphpath)) then
+ filedetails.value.filename.value = graphpath .. "/" .. string.gsub(filedetails.value.filename.value,"^.*/", "")
+ end
+ if not (string.match(filedetails.value.filename.value, "\.graph$")) then
+ filedetails.value.filename.value = filedetails.value.filename.value .. ".graph"
+ end
+
+ filedetails = modelfunctions.setfiledetails(filedetails, getgraphlist)
+ filedetails.value.filesize = nil
+ filedetails.value.mtime = nil
+ return filedetails
+end
+
+function setgraphfile(filedetails,file)
+ return modelfunctions.setfiledetails(filedetails, {file})
+end