diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-09-30 12:30:36 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-09-30 12:57:25 +0000 |
commit | 0ec29efff673e7219b6c85f9f086c62db39de1f5 (patch) | |
tree | 5ba4ce3516a2b2bed07609b52d146c56e937f398 | |
parent | 209771b0ba1845a53e1d5e8becf99abcb5e1db60 (diff) | |
download | acf-freeradius3-0ec29efff673e7219b6c85f9f086c62db39de1f5.tar.bz2 acf-freeradius3-0ec29efff673e7219b6c85f9f086c62db39de1f5.tar.xz |
Add links from editmacauthfile and viewpasswdfile HTML views to editfile
(cherry picked from commit d5363dd01400989078c25d355390ce1d34f5a8b1)
Conflicts:
freeradius3-editmacauthfile-html.lsp
freeradius3-viewpasswdfile-html.lsp
Also added displaycommandresults to avoid errors on second attempt
-rw-r--r-- | freeradius3-editmacauthfile-html.lsp | 17 | ||||
-rw-r--r-- | freeradius3-viewpasswdfile-html.lsp | 15 |
2 files changed, 30 insertions, 2 deletions
diff --git a/freeradius3-editmacauthfile-html.lsp b/freeradius3-editmacauthfile-html.lsp index 940abf2..5781544 100644 --- a/freeradius3-editmacauthfile-html.lsp +++ b/freeradius3-editmacauthfile-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info = ... %> +<% local form, viewlibrary, page_info, session = ... %> <% htmlviewfunctions = require("htmlviewfunctions") %> <% html = require("acf.html") %> @@ -71,6 +71,8 @@ }); </script> +<% htmlviewfunctions.displaycommandresults({"editfile"}, session) %> + <h1>Edit MAC Authentication File</h1> <dl> <% @@ -88,6 +90,7 @@ htmlviewfunctions.displayitem(form.value.mtime) form.value.filecontent.type = "hidden" htmlviewfunctions.displayformitem(form.value.filecontent, "filecontent") %> +<% if not form.value.filename.errtxt then %> <table id="entries"> <% for line in string.gmatch(html.html_escape(form.value.filecontent.value), "([^\n]*)\n?") do %> <tr><td><%= line %></td></tr> @@ -99,3 +102,15 @@ htmlviewfunctions.displayitem(form.value.mtime) htmlviewfunctions.displayformend(form) %> </dl> +<% end %> + +<% if not form.value.filename.errtxt and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("editfile") then %> +<h2>Expert</h2> + <dl> + <dt></dt> + <dd><form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. '/editfile') %>" method="post"> + <input type='hidden' name='filename' value='<%= html.html_escape(form.value.filename.value) %>'> + <input type='hidden' name='redir' value='<%= html.html_escape(page_info.orig_action.."?filename="..html.url_encode(form.value.filename.value)) %>'> + <input class='submit' type='submit' value='Edit'></form></dd> + </dl> +<% end %> diff --git a/freeradius3-viewpasswdfile-html.lsp b/freeradius3-viewpasswdfile-html.lsp index ac8739c..0a2e84b 100644 --- a/freeradius3-viewpasswdfile-html.lsp +++ b/freeradius3-viewpasswdfile-html.lsp @@ -22,7 +22,7 @@ html = require("acf.html") }); </script> -<% htmlviewfunctions.displaycommandresults({"editpasswdentry", "deletepasswdentry", "editpasswd"}, session) %> +<% htmlviewfunctions.displaycommandresults({"editpasswdentry", "deletepasswdentry", "editpasswd", "editfile"}, session) %> <% htmlviewfunctions.displaycommandresults({"createpasswdentry"}, session, true) %> <% -- This is a hack to redirect back to viewing the same file @@ -73,6 +73,19 @@ end </tbody></table></dl> <% end %> + + +<% if editable and view.value.data and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("editfile") then %> +<h2>Expert</h2> + <dl> + <dt></dt> + <dd><form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. '/editfile') %>" method="post"> + <input type='hidden' name='filename' value='<%= html.html_escape(view.value.filename.value) %>'> + <input type='hidden' name='redir' value='<%= html.html_escape(redir) %>'> + <input class='submit' type='submit' value='Edit'></form></dd> + </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}, true) %> <H2><%= html.html_escape(createform.label) %></H2> |