diff options
Diffstat (limited to 'app/acf-util/roles-read-html.lsp')
-rw-r--r-- | app/acf-util/roles-read-html.lsp | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/app/acf-util/roles-read-html.lsp b/app/acf-util/roles-read-html.lsp index 9d1a003..c0fbaab 100644 --- a/app/acf-util/roles-read-html.lsp +++ b/app/acf-util/roles-read-html.lsp @@ -1,32 +1,48 @@ -<% local view= ... %> +<% local view, viewlibrary, page_info, session = ... %> <% 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() { + $("#permissions").tablesorter({headers: {1:{sorter: false}}, widgets: ['zebra']}); + }); +</script> + <% if view.value.userid then %> - <H1>Roles/Permission list for <%= html.html_escape(view.value.userid.value) %>:</H1> + <h1>Roles/Permission list for <%= html.html_escape(view.value.userid.value) %>:</h1> <% elseif view.value.role then %> - <H1>Permission list for <%= html.html_escape(view.value.role.value) %>:</H1> + <h1>Permission list for <%= html.html_escape(view.value.role.value) %>:</h1> <% else %> - <H1>Complete permission list:</H1> + <h1>Complete permission list:</h1> <% end %> <% if view.value.roles then %> - <H2><%= html.html_escape(view.value.userid.value) %> is valid in these roles</H2> - <DL> + <h2><%= html.html_escape(view.value.userid.value) %> is valid in these roles</h2> <% for a,b in pairs(view.value.roles.value) do - print("<dt>",html.html_escape(b),"</dt><dd> </dd>") + print("<p>",html.html_escape(b),"</p>") end %> - </DL> <% end %> <% if view.value.permissions then %> <% if view.value.userid then %> - <H2><%= html.html_escape(view.value.userid.value) %>'s full permissions are</H2> + <h2><%= html.html_escape(view.value.userid.value) %>'s full permissions are</h2> <% elseif view.value.role then %> - <H2><%= html.html_escape(view.value.role.value) %>'s full permissions are</H2> + <h2><%= html.html_escape(view.value.role.value) %>'s full permissions are</h2> <% end %> - <DL> - <TABLE> - <TR><TD CLASS='header'>Controller</TD><TD CLASS='header'>Action(s)</TD></TR> + <table id="permissions" class="tablesorter"><thead> + <tr><th>Controller</th><th>Action(s)</th></tr> + </thead><tbody> <% local prefixes = {} -- It's nice to have it in alphabetical order for pref in pairs(view.value.permissions.value) do @@ -41,7 +57,7 @@ end table.sort(controllers) for x,cont in ipairs(controllers) do - print("<TR><TD STYLE='font-weight:bold;'>",html.html_escape(pref..cont),"</TD><TD>") + print("<tr><td style='font-weight:bold;'>",html.html_escape(pref..cont),"</td><td>") -- Again, alphabetical order local actions = {} for act in pairs(view.value.permissions.value[pref][cont]) do @@ -51,10 +67,9 @@ for y,act in pairs(actions) do print((html.html_escape(act))) end - io.write("<TD></TR>") + io.write("</td></tr>") end end %> - </TABLE> - </DL> + </tbody></table> <% end %> |