diff options
Diffstat (limited to 'db-listdatabases-html.lsp')
-rw-r--r-- | db-listdatabases-html.lsp | 59 |
1 files changed, 45 insertions, 14 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") %> -<H1><%= html.html_escape(form.label) %></H1> -<DL> -<% if form.errtxt then %><P CLASS='error'><%= string.gsub(html.html_escape(form.errtxt), "\n", "<BR>") %></P><% end %> -<% for i,database in ipairs(form.value) do %> - <li> - <% 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 %> +<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>'); + } +</script> + +<script type="text/javascript"> + if (typeof $.tablesorter == 'undefined') { + document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>'); + } +</script> + +<script type="text/javascript"> + $(document).ready(function() { + $("#listdatabases").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']}); + }); +</script> +<% end %> + +<% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %> +<% htmlviewfunctions.displayinfo(form) %> +<% if #form.value>0 then %> +<table id="listdatabases" class="tablesorter"><thead> + <tr> + <th>Action</th> + <th>Database</th> + </tr> +</thead><tbody> +<% local database = cfe({ type="hidden" }) %> +<% for i,dbase in ipairs(form.value) do %> + <% database.value = dbase %> + <tr> + <td> + <% if viewlibrary.check_permission("listtables") then %> + <% htmlviewfunctions.displayitem(cfe({type="link", value={database=database}, label="", option="View", action="listtables"}), page_info, -1) %> + <% end %> + </td> + <td><%= html.html_escape(dbase) %></td> + </tr> <% end %> -<% if #form.value == 0 then %> -No databases found +</tbody></table> +<% else %> +<p>No databases found</p> <% end %> -</DL> +<% htmlviewfunctions.displaysectionend(header_level) %> |