diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-10-21 17:23:10 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-10-21 17:23:10 +0000 |
commit | 83f91021bea9203fa8fe0877846a299c296df97d (patch) | |
tree | 725c9e70a7b69da2ea655ebb4df511288286db98 /tinydns-edit-html.lsp | |
parent | 5484e1fff4c4a8c9c2ae557a5c322f50299aae60 (diff) | |
download | acf-tinydns-83f91021bea9203fa8fe0877846a299c296df97d.tar.bz2 acf-tinydns-83f91021bea9203fa8fe0877846a299c296df97d.tar.xz |
Modified TinyDNS to include more intelligence. Changed listfiles and newfile to not display / require directory. Made edit function in controller to allow control independent from expert. Modified edit to limit entries to the domain indicated by the file name.
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@1557 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'tinydns-edit-html.lsp')
-rw-r--r-- | tinydns-edit-html.lsp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp index ddb4ae4..a4754e1 100644 --- a/tinydns-edit-html.lsp +++ b/tinydns-edit-html.lsp @@ -1,7 +1,7 @@ <% local form, viewlibrary, page_info = ... %> <% require("viewfunctions") %> -<% form = viewlibrary.dispatch_component(page_info.prefix .. page_info.controller .. "/editfile", form, true) %> +<% local domain = string.gsub(form.value.filename.value, "^.*/", "") %> <script type="text/javascript" src="/js/jquery-latest.js"></script> <script type="text/javascript"> var editEntry = '<td> \ @@ -32,8 +32,15 @@ entryTypes[11]=new Entry("%","Client location",2,"Location","IP prefix"); function finishForm(entry){ - var entrytext = entry.find("select").val() + entry.find("input").map(function(){ - return $(this).val(); + var entrytext = entry.find("select").val() + entry.find("input:not(.submit)").map(function(){ + if (this.name == "fixme") { + if ($(this).val() != "") + return $(this).val() + ".<%= domain %>"; + else + return "<%= domain %>"; + } else { + return $(this).val(); + } }).get().join(":"); entry.empty().append(entrytext); } @@ -62,15 +69,22 @@ } for (i=0; i<entryType.num; i++){ if (entries[i] === null) { entries[i] = ""; } - form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i] + '"></dd>'; + if (entryType.descriptions[i] == "Domain" || entryType.descriptions[i] == "Alias" || entryType.descriptions[i] == "Host" ) + form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i].replace(/\.?<%= string.gsub(domain, "[\\%[%]%.%*%?%+%{%^%$]", "\\%1") %>$/i, "") + '" name="fixme"> . <%= domain %></dd>'; + else + form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i] + '"></dd>'; } - form = form + "</dl>"; + form = form + '\n<DT></DT><DD><input class="submit" type="submit" value="<%= form.option %>"></DD>'; + form = form + "\n</dl>"; entry.empty().append(form); entry.find("select").change(function(){ var entry = $(this).parent(); finishForm(entry); createForm(entry); }); + entry.find("input.submit").click(function() { + $("input[name='<%= form.option %>']").click(); + }); } function editLine(){ var parent = $(this).parent(); |