From 0ec29efff673e7219b6c85f9f086c62db39de1f5 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 30 Sep 2014 12:30:36 +0000 Subject: 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 --- freeradius3-editmacauthfile-html.lsp | 17 ++++++++++++++++- 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 @@ }); +<% htmlviewfunctions.displaycommandresults({"editfile"}, session) %> +

Edit MAC Authentication File

<% @@ -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 %> <% for line in string.gmatch(html.html_escape(form.value.filecontent.value), "([^\n]*)\n?") do %> @@ -99,3 +102,15 @@ htmlviewfunctions.displayitem(form.value.mtime) htmlviewfunctions.displayformend(form) %> +<% end %> + +<% if not form.value.filename.errtxt and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("editfile") then %> +

Expert

+
+
+
+ + +
+
+<% 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") }); -<% 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
<%= line %>
<% end %> + + +<% if editable and view.value.data and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("editfile") then %> +

Expert

+
+
+
+ + +
+
+<% 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) %>

<%= html.html_escape(createform.label) %>

-- cgit v1.2.3