diff options
author | Mika Havela <mika.havela@gmail.com> | 2009-07-08 13:11:02 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2009-07-08 13:11:02 +0000 |
commit | 4fd29b69a10f27c6a48e5bba9d55a10241e6eb5c (patch) | |
tree | 87dfa004f3edefce0b015c52ad9d0864c60caf06 /rrdtool-listgraphcfg-html.lsp | |
parent | a3275e686b437a0ace8d29294f5d3051dbf5bf10 (diff) | |
download | acf-rrdtool-4fd29b69a10f27c6a48e5bba9d55a10241e6eb5c.tar.bz2 acf-rrdtool-4fd29b69a10f27c6a48e5bba9d55a10241e6eb5c.tar.xz |
List graph-files (created the view-file)
Updated the validfilename() to be able to modify/delete graph-files too.
Diffstat (limited to 'rrdtool-listgraphcfg-html.lsp')
-rw-r--r-- | rrdtool-listgraphcfg-html.lsp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/rrdtool-listgraphcfg-html.lsp b/rrdtool-listgraphcfg-html.lsp new file mode 100644 index 0000000..b2ad204 --- /dev/null +++ b/rrdtool-listgraphcfg-html.lsp @@ -0,0 +1,68 @@ +<% local form, viewlibrary, page_info, session = ... +require("viewfunctions") +%> +<% +--[[ DEBUG INFORMATION +io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") +io.write(html.cfe_unpack(form)) +io.write("</span>") +--]] +%> + +<% displaycommandresults({"delete"}, session) %> + +<script type="text/javascript"> +function javascript_confirm_graph(formID,filename) { + var message = "Are you sure you want to remove '" + filename + "'?"; + var return_value = confirm(message); + if ( return_value === true ) { + location.href="delete?filename=" + filename; + } +} +</script> + +<h2><%= form.label %></h2> + +<form id="confirmDisplay" action="#" onsubmit="return false"></form> + +<TABLE> + <TR style="background:#eee;font-weight:bold;"> + <TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Action</TD> + <TD style="padding-right:20px;white-space:nowrap;text-align:right;" class="header">Size</TD> + <TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Last Modified</TD> + <TD style="white-space:nowrap;text-align:left;" class="header">File</TD> + </TR> +<% for i,file in ipairs(form.value) do %> + <TR> + <TD style="padding-right:20px;white-space:nowrap;"> + <% if session.permissions[page_info.controller].delete then %> + <A STYLE="cursor: pointer;" onclick="javascript_confirm_graph('confirmDisplay','<% io.write(file.value.filename.value) %>')">Delete</A> + <% end %> + <% + if session.permissions[page_info.controller].edit then io.write(html.link{value = "edit?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Edit " }) end + %> + </TD> + <TD style="padding-right:20px;white-space:nowrap;text-align:right;"><%= html.html_escape(file.value.filesize.value) %></TD> + <TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(file.value.mtime.value) %></TD> + <TD style="white-space:nowrap;" width="90%"><%= html.html_escape(string.gsub(file.value.filename.value, "^.*/", "")) %></TD> + </TR> +<% end %> + + <% if session.permissions[page_info.controller].createrrd then %> + <TR> + <TD style="padding-right:20px;white-space:nowrap;"> + <% io.write(html.link{value = "createrrd", label="Create new DB " }) %> + </TD> + <TD> </TD><TD> </TD><TD> </TD> + </TR> + <% end %> + +</TABLE> + +<% if viewlibrary and viewlibrary.dispatch_component and session.permissions[page_info.controller].newfile then + local newfileform = viewlibrary.dispatch_component("newfile", nil, true) %> +<h2>Create new Domain</h2> +<% + newfileform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/newfile" + displayform(newfileform) +end %> |