diff options
Diffstat (limited to 'provisioning-listtemplates-html.lsp')
-rw-r--r-- | provisioning-listtemplates-html.lsp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/provisioning-listtemplates-html.lsp b/provisioning-listtemplates-html.lsp new file mode 100644 index 0000000..09e76df --- /dev/null +++ b/provisioning-listtemplates-html.lsp @@ -0,0 +1,59 @@ +<% local view, viewlibrary, page_info, session = ... +require("viewfunctions") +%> + +<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script> +<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"></script> +<script type="text/javascript"> + $(document).ready(function() { + $("#list").tablesorter({headers: {0:{sorter: false}}}); + }); +</script> + +<% displaycommandresults({"deletetemplate", "edittemplate"}, session) %> +<% displaycommandresults({"createtemplate"}, session, true) %> + +<h1>Templates</h1> +<DL> +<TABLE id="list" class="tablesorter"><THEAD> + <TR style="background:#eee;font-weight:bold;"> + <TH>Action</TH> + <TH>File Name</TH> + <TH>Label</TH> + <TH>File Size</TH> + <TH>Last Modified</TH> + </TR> +</THEAD><TBODY> +<% for k,v in ipairs( view.value ) do %> + <TR> + <TD> + <% if viewlibrary.check_permission("deletetemplate") and v.template_id then %> + <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletetemplate?template_id="..v.template_id, label="Delete "} %> + <% end %> + <% if viewlibrary.check_permission("edittemplate") and v.template_id then %> + <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/edittemplate?template_id="..v.template_id.."&redir="..page_info.orig_action, label="Edit "} %> + <% end %> + <% if viewlibrary.check_permission("createtemplate") and not v.template_id then %> + <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/createtemplate?filename="..v.filename.."&redir="..page_info.orig_action, label="Create "} %> + <% end %> + </TD> + <TD><%= html.html_escape(v.filename) %></TD> + <TD><%= html.html_escape(v.label) %></TD> + <TD><%= html.html_escape(v.filesize) %></TD> + <TD><%= html.html_escape(v.mtime) %></TD> + </TR> +<% end %> +</TBODY> +</TABLE> + +<% if view.errtxt then %> +<p class="error"><%= html.html_escape(view.errtxt) %></p> +<% end %> +<% if #view.value == 0 then %> +<p>No templates found</p> +<% end %> + +<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createtemplate") then + viewlibrary.dispatch_component("createtemplate") +end %> +</DL> |