From 282d068aced3f88956af4182a353f8ea150caa2b Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 28 Oct 2014 19:03:59 +0000 Subject: Move the lib files into a subdirectory in preparation for creating a generic controller/model --- lib/db-listtables-html.lsp | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 lib/db-listtables-html.lsp (limited to 'lib/db-listtables-html.lsp') diff --git a/lib/db-listtables-html.lsp b/lib/db-listtables-html.lsp new file mode 100644 index 0000000..f0db6b7 --- /dev/null +++ b/lib/db-listtables-html.lsp @@ -0,0 +1,66 @@ +<% local form, viewlibrary, page_info, session = ... %> +<% htmlviewfunctions = require("htmlviewfunctions") %> +<% html = require("acf.html") %> + +<% if form.value.tables and #form.value.tables.value>0 then %> + + + + + +<% end %> + +<% htmlviewfunctions.displaycommandresults({"createdatabase"}, session) %> + +<% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %> +<% if form.value.connection and next(form.value.connection.value) ~= nil then + htmlviewfunctions.displayformstart(form, page_info) + htmlviewfunctions.displayitem(form.value.connection, page_info, htmlviewfunctions.incrementheader(header_level), "connection") + form.option = "Update" + htmlviewfunctions.displayformend(form, htmlviewfunctions.incrementheader(header_level)) +end %> +<% if form.value.tables and #form.value.tables.value>0 then %> + + + + + + +<% -- We will reuse the form connection structure to pass key values to viewtable +local formvalues = {} +if form.value.connection then + formvalues.connection = form.value.connection + for n,v in pairs(form.value.connection.value) do v.type="hidden" end +end +formvalues.table = cfe({ type="hidden" }) +%> +<% for i,tab in ipairs(form.value.tables.value) do %> + <% formvalues.table.value = tab %> + + + + +<% end %> +
ActionTable
+ <% if viewlibrary.check_permission("viewtable") then %> + <% htmlviewfunctions.displayitem(cfe({type="link", value=formvalues, label="", option="View", action="viewtable"}), page_info, -1) %> + <% end %> + <%= html.html_escape(tab) %>
+<% elseif viewlibrary.check_permission("createdatabase") then %> + <% htmlviewfunctions.displayitem(cfe({type="form", value={}, label="Create Database", option="Create", action="createdatabase" }), page_info, 0) %> +<% else %> +

No tables found

+<% end %> +<% htmlviewfunctions.displaysectionend(header_level) %> -- cgit v1.2.3