diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-02-04 17:02:41 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-02-04 17:02:41 +0000 |
commit | 50b8c1bd4d52e53ab9ce98c67550b995a5682865 (patch) | |
tree | 56edbca0c20eac5ea6b7ea1c3932c344a502ec1f /kamailio-viewtable-html.lsp | |
parent | b535cc71e1b2fa53b0ca3a422522d2a8f45287e0 (diff) | |
download | acf-kamailio-50b8c1bd4d52e53ab9ce98c67550b995a5682865.tar.bz2 acf-kamailio-50b8c1bd4d52e53ab9ce98c67550b995a5682865.tar.xz |
Cleanup HTML including removing DL/DT/DD, use tablesorter where possible, and use lowercase tags
Diffstat (limited to 'kamailio-viewtable-html.lsp')
-rw-r--r-- | kamailio-viewtable-html.lsp | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/kamailio-viewtable-html.lsp b/kamailio-viewtable-html.lsp index 5e8f83a..41b9b82 100644 --- a/kamailio-viewtable-html.lsp +++ b/kamailio-viewtable-html.lsp @@ -2,53 +2,73 @@ <% htmlviewfunctions = require("htmlviewfunctions") %> <% html = require("acf.html") %> +<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() { + <% if viewlibrary.check_permission("deletetableentry") or viewlibrary.check_permission("updatetableentry") then %> + $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']}); + <% else %> + $("#list").tablesorter({widgets: ['zebra']}); + <% end %> + }); +</script> + <% htmlviewfunctions.displaycommandresults({"deletetableentry", "updatetableentry"}, session) %> <% htmlviewfunctions.displaycommandresults({"createtableentry"}, session, true) %> -<H1><%= html.html_escape(form.label) %> - <%= html.html_escape(form.value.table.value) %></H1> -<DL> -<TABLE> - <TR style="background:#eee;font-weight:bold;"> +<h1><%= html.html_escape(form.label) %> - <%= html.html_escape(form.value.table.value) %></h1> +<table id="list" class="tablesorter"><thead> + <tr> <% if viewlibrary.check_permission("deletetableentry") or viewlibrary.check_permission("updatetableentry") then %> - <TD style="padding-right:20px;white-space:nowrap;" class="header">Action</TD> + <th>Action</th> <% end %> <% for i,f in ipairs(form.value.fields.value) do %> - <TD style="padding-right:20px;white-space:nowrap;" class="header"><%= html.html_escape(f) %></TD> + <th><%= html.html_escape(f) %></th> <% end %> - </TR> - + </tr> +</thead><tbody> <% for i,tableentry in ipairs(form.value.entries.value) do %> - <TR> + <tr> <% if viewlibrary.check_permission("deletetableentry") or viewlibrary.check_permission("updatetableentry") then %> - <TD style="padding-right:20px;white-space:nowrap;"> + <td> <% if viewlibrary.check_permission("updatetableentry") then %> - <form action="updatetableentry" method="POST"> + <form action="updatetableentry" method="post"> <input class="hidden" type="hidden" name="table" value="<%= html.html_escape(form.value.table.value) %>"> <input class="hidden" type="hidden" name="id" value="<%= html.html_escape(tableentry.id) %>"> <input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action.."?table="..form.value.table.value) %>"> <input class="submit" type="submit" value="Update"></form> <% end %> <% if viewlibrary.check_permission("deletetableentry") then %> - <form action="deletetableentry" method="POST"> + <form action="deletetableentry" method="post"> <input class="hidden" type="hidden" name="table" value="<%= html.html_escape(form.value.table.value) %>"> <input class="hidden" type="hidden" name="id" value="<%= html.html_escape(tableentry.id) %>"> <input class="submit" type="submit" name="submit" value="Delete"></form> <% end %> - </TD> + </td> <% end %> <% for i,f in ipairs(form.value.fields.value) do %> - <TD><%= html.html_escape(tableentry[f]) %></TD> + <td><%= html.html_escape(tableentry[f]) %></td> <% end %> - </TR> + </tr> <% end %> -</TABLE> +</tbody></table> <% if form.errtxt then %> <p class="error"><%= html.html_escape(form.errtxt) %></p> <% end %> <% if #form.value.entries.value == 0 then %> <p>No entries found</p> <% end %> -</DL> <% 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}) |