summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-09-22 13:39:26 +0000
committerTed Trask <ttrask01@yahoo.com>2014-09-22 13:39:26 +0000
commit00e58e451fbfe8d197dbacaabd4cf5216dfe4dd0 (patch)
tree32e52a46593600709cf0447cd9d73e24f3f5db18
parent32cc2eeeeeb50d2b2218112effd1b2539eb7055c (diff)
downloadacf-freeradius3-00e58e451fbfe8d197dbacaabd4cf5216dfe4dd0.tar.bz2
acf-freeradius3-00e58e451fbfe8d197dbacaabd4cf5216dfe4dd0.tar.xz
Convert listpasswdfiles and viewpasswdfile HTML views back to older style to match acf-core-0.17
-rw-r--r--freeradius3-listpasswdfiles-html.lsp28
-rw-r--r--freeradius3-viewpasswdfile-html.lsp26
2 files changed, 16 insertions, 38 deletions
diff --git a/freeradius3-listpasswdfiles-html.lsp b/freeradius3-listpasswdfiles-html.lsp
index a3b454c..a651dde 100644
--- a/freeradius3-listpasswdfiles-html.lsp
+++ b/freeradius3-listpasswdfiles-html.lsp
@@ -3,20 +3,6 @@ htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>
-<%
-function convertsize(size)
- if string.find(size, "k$") then
- return tonumber(string.match(size, "[%d.]*")) * 1024.0
- elseif string.find(size, "M$") then
- return tonumber(string.match(size, "[%d.]*")) * 1024.0 * 1024.0
- elseif string.find(size, "G$") then
- return tonumber(string.match(size, "[%d.]*")) + 1024.0 * 1024.0 * 1024.0
- else
- return tonumber(string.match(size, "[%d.]*"))
- end
-end
-%>
-
<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>');
@@ -35,8 +21,8 @@ end
});
</script>
-<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Passwd Configuration"}), page_info) %>
-<table id="list" class="tablesorter"><thead>
+<h1>Passwd Configuration</h1>
+<dl><table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
<th>File</th>
@@ -44,20 +30,16 @@ end
<th>Last Modified</th>
</tr>
</thead><tbody>
-<% local filename = cfe({ type="hidden", value="" }) %>
-<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
- <% filename.value = v.filename %>
<% if viewlibrary.check_permission("viewpasswdfile") then %>
- <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="View", action="viewpasswdfile"}), page_info, -1) %>
+ <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/viewpasswdfile?filename="..v.filename, label="View "} %>
<% end %>
</td>
<td><%= html.html_escape(v.filename) %></td>
- <td><span class="hide"><%= convertsize(v.size) %>b</span><%= html.html_escape(v.size) %></td>
+ <td><span class="hide"><%= html.html_escape(v.orig_size) %>b</span><%= html.html_escape(v.size) %></td>
<td><%= html.html_escape(v.mtime) %></td>
</tr>
<% end %>
-</tbody></table>
-<% htmlviewfunctions.displaysectionend(header_level) %>
+</tbody></table></dl>
diff --git a/freeradius3-viewpasswdfile-html.lsp b/freeradius3-viewpasswdfile-html.lsp
index fe28b28..9fab448 100644
--- a/freeradius3-viewpasswdfile-html.lsp
+++ b/freeradius3-viewpasswdfile-html.lsp
@@ -25,9 +25,8 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"editpasswdentry", "deletepasswdentry", "editpasswd"}, session) %>
<% htmlviewfunctions.displaycommandresults({"createpasswdentry"}, session, true) %>
-<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% -- This is a hack to redirect back to viewing the same file
-redir.value = redir.value.."?filename="..html.url_encode(view.value.filename.value)
+local redir = page_info.orig_action.."?filename="..html.url_encode(view.value.filename.value)
%>
<%
@@ -37,12 +36,12 @@ if view.value.mode and string.match(view.value.mode.value, "^.w") then
end
%>
-<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
+<h1>Freeradius passwd file</h1>
<% htmlviewfunctions.displayitem(view.value.filename) %>
<% if view.value.mode then htmlviewfunctions.displayitem(view.value.mode) end %>
<% if view.value.data then %>
<% local containspasswd = 0 %>
-<table id="list" class="tablesorter"><thead>
+<dl><table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
<% for i,f in ipairs(view.value.fields.value) do %>
@@ -51,21 +50,18 @@ end
<% end %>
</tr>
</thead><tbody>
-<% local filename = cfe({ type="hidden", value=view.value.filename.value }) %>
-<% local entry = cfe({ type="hidden", value="" }) %>
<% for i,r in ipairs( view.value.data.value ) do %>
<tr>
<td>
<% if editable then %>
- <% entry.value = i %>
<% if viewlibrary.check_permission("editpasswdentry") then %>
- <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, entry=entry, redir=redir}, label="", option="Edit", action="editpasswdentry"}), page_info, -1) %>
+ <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editpasswdentry?filename="..view.value.filename.value.."&entry="..i.."&redir="..html.url_encode(redir), label="Edit "} %>
<% end %>
<% if viewlibrary.check_permission("deletepasswdentry") then %>
- <% htmlviewfunctions.displayitem(cfe({type="form", value={filename=filename, entry=entry}, label="", option="Delete", action="deletepasswdentry", class="deletepasswdentry"}), page_info, -1) %>
+ <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletepasswdentry?submit=true&filename="..view.value.filename.value.."&entry="..i, label="Delete "} %>
<% end %>
<% if 0 < containspasswd and r[containspasswd] ~= "" and viewlibrary.check_permission("editpasswd") then %>
- <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, entry=entry, redir=redir}, label="", option="Change Pass", action="editpasswd"}), page_info, -1) %>
+ <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editpasswd?filename="..view.value.filename.value.."&entry="..i.."&redir="..html.url_encode(redir), label="ChangePass "} %>
<% end %>
<% end %>
</td>
@@ -74,12 +70,12 @@ end
<% end %>
</tr>
<% end %>
-</tbody></table>
+</tbody></table></dl>
<% end %>
<% if editable and view.value.data and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createpasswdentry") then
- local createform = viewlibrary.dispatch_component("createpasswdentry", {filename=view.value.filename.value, redir=redir.value}, true)
- createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createpasswdentry"
- htmlviewfunctions.displayitem(createform, page_info, htmlviewfunctions.incrementheader(header_level))
+ local createform = viewlibrary.dispatch_component("createpasswdentry", {filename=view.value.filename.value, redir=redir}, true) %>
+<H2><%= html.html_escape(createform.label) %></H2>
+<% createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createpasswdentry"
+ htmlviewfunctions.displayform(createform)
end %>
-<% htmlviewfunctions.displaysectionend(header_level) %>