From 2e9893a02d83e1b0c93756ae16dd67e91ef5f2c3 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sat, 28 Jun 2014 20:59:24 +0000 Subject: [PATCH] Cleanup HTML including removing DL/DT/DD, use tablesorter where possible, use lowercase tags, remove styling, and use new htmlviewfunctions functions --- db-listdatabases-html.lsp | 59 +++++++++++++++++++++++++-------- db-listtables-html.lsp | 64 +++++++++++++++++++++++++---------- db-viewtable-html.lsp | 70 +++++++++++++++++++++++---------------- 3 files changed, 134 insertions(+), 59 deletions(-) diff --git a/db-listdatabases-html.lsp b/db-listdatabases-html.lsp index 4fd9362..b4c6694 100644 --- a/db-listdatabases-html.lsp +++ b/db-listdatabases-html.lsp @@ -1,19 +1,50 @@ <% local form, viewlibrary, page_info, session = ... %> -<% require("htmlviewfunctions") %> +<% htmlviewfunctions = require("htmlviewfunctions") %> <% html = require("acf.html") %> -

<%= html.html_escape(form.label) %>

-
-<% if form.errtxt then %>

<%= string.gsub(html.html_escape(form.errtxt), "\n", "
") %>

<% end %> -<% for i,database in ipairs(form.value) do %> -
  • - <% if viewlibrary.check_permission("listtables") then %> - <%= html.link{value = "listtables?database=" .. database, label=database} %> - <% else %> - <%= html.html_escape(database) %> - <% end %> +<% if #form.value>0 then %> + + + + + +<% end %> + +<% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %> +<% htmlviewfunctions.displayinfo(form) %> +<% if #form.value>0 then %> + + + + + + +<% local database = cfe({ type="hidden" }) %> +<% for i,dbase in ipairs(form.value) do %> + <% database.value = dbase %> + + + + <% end %> -<% if #form.value == 0 then %> -No databases found +
    ActionDatabase
    + <% if viewlibrary.check_permission("listtables") then %> + <% htmlviewfunctions.displayitem(cfe({type="link", value={database=database}, label="", option="View", action="listtables"}), page_info, -1) %> + <% end %> + <%= html.html_escape(dbase) %>
    +<% else %> +

    No databases found

    <% end %> -
  • +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/db-listtables-html.lsp b/db-listtables-html.lsp index fec3ac4..23ecfc4 100644 --- a/db-listtables-html.lsp +++ b/db-listtables-html.lsp @@ -1,24 +1,54 @@ <% local form, viewlibrary, page_info, session = ... %> -<% require("htmlviewfunctions") %> +<% htmlviewfunctions = require("htmlviewfunctions") %> <% html = require("acf.html") %> +<% if #form.value>0 then %> + + + + + +<% end %> + <% htmlviewfunctions.displaycommandresults({"createdatabase"}, session) %> -

    <%= html.html_escape(form.label) %>

    -
    -<% for i,table in ipairs(form.value) do %> -
  • - <% if viewlibrary.check_permission("viewtable") then %> - <%= html.link{value = "viewtable?table=" .. table, label=table} %> - <% else %> - <%= html.html_escape(table) %> - <% end %> +<% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %> +<% htmlviewfunctions.displayinfo(form) %> +<% if #form.value>0 then %> + + + + + + +<% local table = cfe({ type="hidden" }) %> +<% for i,tab in ipairs(form.value) do %> + <% table.value = tab %> + + + + <% end %> -<% if #form.value == 0 and viewlibrary.check_permission("createdatabase") then %> -
    Create Database
    -
    "> -
    - - +
    ActionTable
    + <% if viewlibrary.check_permission("viewtable") then %> + <% htmlviewfunctions.displayitem(cfe({type="link", value={table=table}, 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) %> diff --git a/db-viewtable-html.lsp b/db-viewtable-html.lsp index e1531d0..1d64ece 100644 --- a/db-viewtable-html.lsp +++ b/db-viewtable-html.lsp @@ -1,54 +1,68 @@ <% local form, viewlibrary, page_info, session = ... %> -<% require("htmlviewfunctions") %> +<% htmlviewfunctions = require("htmlviewfunctions") %> <% html = require("acf.html") %> + + + + + + <% htmlviewfunctions.displaycommandresults({"deletetableentry", "updatetableentry"}, session) %> <% htmlviewfunctions.displaycommandresults({"createtableentry"}, session, true) %> -

    <%= html.html_escape(form.label) %> - <%= html.html_escape(form.value.table.value) %>

    -
    - - +<% form.label = form.label.." - "..form.value.table.value %> +<% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %> +
    + <% if viewlibrary.check_permission("deletetableentry") or viewlibrary.check_permission("updatetableentry") then %> - + <% end %> <% for i,f in ipairs(form.value.fields.value) do %> - + <% end %> - - + + +<% local redir = cfe({ type="hidden", value=page_info.orig_action.."?table="..form.value.table.value }) %> +<% local table = cfe({ type="hidden", value=form.value.table.value }) %> +<% local id = cfe({ type="hidden" }) %> <% for i,tableentry in ipairs(form.value.entries.value) do %> - + <% if viewlibrary.check_permission("deletetableentry") or viewlibrary.check_permission("updatetableentry") then %> - + <% end %> <% for i,f in ipairs(form.value.fields.value) do %> - + <% end %> - -<% end %> -
    ActionAction<%= html.html_escape(f) %><%= html.html_escape(f) %>
    + <% id.value = tableentry.id %> + <% if viewlibrary.check_permission("updatetableentry") then %> -
    - - - -
    + <% htmlviewfunctions.displayitem(cfe({type="link", value={table=table, id=id, redir=redir}, label="", option="Update", action="updatetableentry"}), page_info, -1) %> <% end %> <% if viewlibrary.check_permission("deletetableentry") then %> -
    - - -
    + <% htmlviewfunctions.displayitem(cfe({type="form", value={table=table, id=id}, label="", option="Delete", action="deletetableentry", class="deletetableentry"}), page_info, -1) %> <% end %> -
    <%= html.html_escape(tableentry[f]) %><%= html.html_escape(tableentry[f]) %>
    -<% if form.errtxt then %> -

    <%= html.html_escape(form.errtxt) %>

    + <% end %> + +<% htmlviewfunctions.displayinfo(form) %> <% if #form.value.entries.value == 0 then %>

    No entries found

    <% end %> -
    +<% htmlviewfunctions.displaysectionend(header_level) %> <% if page_info.action == "viewtable" and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createtableentry") then viewlibrary.dispatch_component("createtableentry", {table=form.value.table.value}) -- GitLab