summaryrefslogtreecommitdiffstats
path: root/provisioning-listtemplates-html.lsp
diff options
context:
space:
mode:
Diffstat (limited to 'provisioning-listtemplates-html.lsp')
-rw-r--r--provisioning-listtemplates-html.lsp32
1 files changed, 25 insertions, 7 deletions
diff --git a/provisioning-listtemplates-html.lsp b/provisioning-listtemplates-html.lsp
index ee67b17..a649bec 100644
--- a/provisioning-listtemplates-html.lsp
+++ b/provisioning-listtemplates-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
+%>
+
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
@@ -25,7 +39,7 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"deletetemplate", "edittemplate"}, session) %>
<% htmlviewfunctions.displaycommandresults({"createtemplate"}, session, true) %>
-<h1>Templates</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -36,23 +50,26 @@ html = require("acf.html")
<th>Last Modified</th>
</tr>
</thead><tbody>
+<% local filename = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
- <% if viewlibrary.check_permission("deletetemplate") and v.label then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletetemplate?submit=true&filename="..v.filename, label="Delete ", class="deletetemplate"} %>
- <% end %>
+ <% filename.value = v.filename %>
<% if viewlibrary.check_permission("edittemplate") and v.label then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/edittemplate?filename="..v.filename.."&redir="..page_info.orig_action, label="Edit "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="edittemplate"}), page_info, -1) %>
+ <% end %>
+ <% if viewlibrary.check_permission("deletetemplate") and v.label then %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={filename=filename}, label="", option="Delete", action="deletetemplate", class="deletetemplate"}), page_info, -1) %>
<% end %>
<% if viewlibrary.check_permission("createtemplate") and not v.label then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/createtemplate?filename="..v.filename.."&redir="..page_info.orig_action, label="Create "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Create", action="createtemplate"}), page_info, -1) %>
<% end %>
</td>
<td><%= html.html_escape(v.filename) %></td>
<td><%= html.html_escape(v.label) %></td>
<td><%= html.html_escape(v.seq) %></td>
- <td><%= html.html_escape(v.filesize) %></td>
+ <td><span class="hide"><%= convertsize(v.filesize) %>b</span><%= html.html_escape(v.filesize) %></td>
<td><%= html.html_escape(v.mtime) %></td>
</tr>
<% end %>
@@ -65,6 +82,7 @@ html = require("acf.html")
<% if #view.value == 0 then %>
<p>No templates found</p>
<% end %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createtemplate") then
viewlibrary.dispatch_component("createtemplate")