diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-09-03 17:22:25 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-09-03 17:22:25 +0000 |
commit | b8e60067b91a429fbe6b53bf2fd206ee69c9881b (patch) | |
tree | 1a550802315bf52745a71baf754a698ac3d9527c | |
parent | 41161ae581b877e2469f86457febdfe18b170137 (diff) | |
download | acf-tinydns-b8e60067b91a429fbe6b53bf2fd206ee69c9881b.tar.bz2 acf-tinydns-b8e60067b91a429fbe6b53bf2fd206ee69c9881b.tar.xz |
Modified tinydns to fix an exception when saving file, fix scrolling to line number, and HTML escape the filecontent.
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@1444 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | tinydns-edit-html.lsp | 8 | ||||
-rw-r--r-- | tinydns-model.lua | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp index a100c27..ddb4ae4 100644 --- a/tinydns-edit-html.lsp +++ b/tinydns-edit-html.lsp @@ -116,7 +116,9 @@ addLinks($("#entries").find("tr")); $("input.submit").click(submitFile); <% if form.value.filecontent.linenumber then %> - $("#entries tr:eq(<%= form.value.filecontent.linenumber - 1 %>)").find("a:eq(2)").click().parent().next().focus(); + $("#entries tr:eq(<%= form.value.filecontent.linenumber - 1 %>)").find("a:eq(2)").click(); + var top = $("#entries tr:eq(<%= form.value.filecontent.linenumber - 1 %>)").offset().top; + $("html,body").scrollTop(top); <% end %> }); </script> @@ -144,7 +146,7 @@ displayitem(form.value.mtime) <% if form.descr then %><P CLASS='descr'><%= string.gsub(form.descr, "\n", "<BR>") %></P><% end %> <% if form.errtxt then %><P CLASS='error'><%= string.gsub(form.errtxt, "\n", "<BR>") %></P><% end %> <TABLE id="entries"> -<% for line in string.gmatch(form.value.filecontent.value.."\n", "([^\n]*)\n") do %> +<% for line in string.gmatch(html.html_escape(form.value.filecontent.value).."\n", "([^\n]*)\n") do %> <TR> <TD><%= line %></TD> </TR> @@ -154,7 +156,7 @@ displayitem(form.value.mtime) <form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %>" method="POST"> <input type="hidden" name="filename" value="<%= form.value.filename.value %>"> -<input type="hidden" name="filecontent" value="<%= form.value.filecontent.value %>"> +<input type="hidden" name="filecontent" value="<%= html.html_escape(form.value.filecontent.value) %>"> <H2>Save and Apply Above Settings</H2> <DL><DT></DT><DD><input class="submit" type="submit" name="<%= form.option %>" value="<%= form.option %>"></DD></DL> </form> diff --git a/tinydns-model.lua b/tinydns-model.lua index 7399c54..07a8579 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -275,7 +275,7 @@ function set_filedetails (self, filedetails, userid) local success, errtxt = validfilename(filedetails.value.filename.value) if success then fs.write_file(filedetails.value.filename.value, filedetails.value.filecontent.value) - filedetails = get_filedetails(filedetails.value.filename.value) + filedetails = get_filedetails(self, filedetails.value.filename.value, userid) else filedetails.value.filename.errtxt = errtxt filedetails.errtxt = "Failed to set config file" |