From a15984cf2eacb65eed22a39cacc9641a7b39032a Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 25 Apr 2014 07:00:06 +0000 Subject: Changes to use new htmlviewfunctions functions --- tinydns-edit-html.lsp | 55 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 16 deletions(-) (limited to 'tinydns-edit-html.lsp') diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp index 2dcfc81..3ea17a7 100644 --- a/tinydns-edit-html.lsp +++ b/tinydns-edit-html.lsp @@ -18,6 +18,8 @@ var addEntry = ' \ \ '; + <% local replaceableItem = cfe({label="ReplaceLabel", value="ReplaceValue", name="ReplaceName", descr="ReplaceExtra"}) %> + var replaceableEntry = '<% htmlviewfunctions.displayformitem(replaceableItem) %>'; function Entry(entryType,descr,num,descr0,descr1,descr2,descr3,descr4,descr5,descr6,descr7,descr8,descr9,descr10){ this.entryType=entryType; @@ -121,7 +123,7 @@ name = "testme"; } - form = form + '

' + entryType.descriptions[i] + '

\n
\n' + extra + '\n
'; + form = form + replaceableEntry.replace("ReplaceLabel", entryType.descriptions[i]).replace("ReplaceValue", value).replace("ReplaceName", name).replace("ReplaceExtra", extra); } form = form + "\n"; entry.empty().append(form); @@ -192,18 +194,34 @@ }); -

Configuration

-

Expert Configuration

-

File Details

-<% +<% +local header_level0, header_level, header_level2 +if form.type == "form" then + header_level0 = htmlviewfunctions.displaysectionstart(cfe({label="Configuration"}), page_info) + header_level = htmlviewfunctions.displaysectionstart(cfe({label="Expert Configuration"}), page_info, htmlviewfunctions.incrementheader(header_level0)) +else + header_level = htmlviewfunctions.displaysectionstart(cfe({label="View File"}), page_info) +end +header_level2 = htmlviewfunctions.displaysectionstart(cfe({label="File Details"}), page_info, htmlviewfunctions.incrementheader(header_level)) + htmlviewfunctions.displayitem(form.value.filename) htmlviewfunctions.displayitem(form.value.filesize) htmlviewfunctions.displayitem(form.value.mtime) -%> +if form.value.grep and form.value.grep.value and form.value.grep.value ~= "" then + htmlviewfunctions.displayitem(form.value.grep) +end + +htmlviewfunctions.displaysectionend(header_level2) -

File Entries

-<% if form.descr then %>

<%= string.gsub(html.html_escape(form.descr), "\n", "
") %>

<% end %> -<% if form.errtxt then %>

<%= string.gsub(html.html_escape(form.errtxt), "\n", "
") %>

<% end %> +htmlviewfunctions.displaysectionstart(cfe({label="File Entries"}), page_info, header_level2) +if form.type == "form" then + htmlviewfunctions.displayformstart(form, page_info) + form.value.filename.type = "hidden" + htmlviewfunctions.displayformitem(form.value.filename, "filename") + form.value.filecontent.type = "hidden" + htmlviewfunctions.displayformitem(form.value.filecontent, "filecontent") +end +%> <% for line in string.gmatch(html.html_escape(form.value.filecontent.value), "([^\n]*)\n?") do %> @@ -211,11 +229,16 @@ htmlviewfunctions.displayitem(form.value.mtime) <% end %>
-<% if form.value.filecontent.errtxt then %>

<%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "
") %>

<% end %> +<% +htmlviewfunctions.displayinfo(form.value.filecontent) + +if form.type == "form" then + htmlviewfunctions.displayformend(form) +end +htmlviewfunctions.displaysectionend(header_level2) -<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> -<% htmlviewfunctions.displayformstart(form) %> - - -

Save and Apply Above Settings

-<% htmlviewfunctions.displayformend(form) %> +htmlviewfunctions.displaysectionend(header_level) +if form.type == "form" then + htmlviewfunctions.displaysectionend(header_level0) +end +%> -- cgit v1.2.3