diff options
author | Ted Trask <ttrask01@yahoo.com> | 2010-03-18 14:28:10 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2010-03-18 14:28:10 +0000 |
commit | 15d1aabd32f71166a02642d5c61821fc48636127 (patch) | |
tree | 3f979290c12cb1ae0808fde5d69e5395e7c9918e | |
parent | 9dd269bd5327389f7bee9ec58fd4833b19ac4ab7 (diff) | |
download | acf-tinydns-15d1aabd32f71166a02642d5c61821fc48636127.tar.bz2 acf-tinydns-15d1aabd32f71166a02642d5c61821fc48636127.tar.xz |
Add octal escape code handling to all fields except comment.
-rw-r--r-- | tinydns-edit-html.lsp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp index 55fe7aa..cbde5b4 100644 --- a/tinydns-edit-html.lsp +++ b/tinydns-edit-html.lsp @@ -45,16 +45,17 @@ } function finishForm(entry){ var entrytext = entry.find("select").val() + entry.find("input:not(.submit)").map(function(){ + var val = $(this).val().replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + if (this.name != "dontconvertme") { + val = val.replace(/[\\:\r\n ]/g, char_to_octal); + } if (this.name == "fixme") { - if ($(this).val() != "") - return $(this).val().replace(/^\s\s*/, '').replace(/\s\s*$/, '') + ".<%= html.html_escape(domain) %>"; + if (val != "") + val = val + ".<%= html.html_escape(domain) %>"; else - return "<%= html.html_escape(domain) %>"; - } else if (this.name == "convertme") { - return $(this).val().replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/[\\:\r\n ]/g, char_to_octal); - } else { - return $(this).val().replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + val = "<%= html.html_escape(domain) %>"; } + return val }).get().join(":"); entry.empty().append(entrytext); } @@ -84,11 +85,11 @@ for (i=0; i<entryType.num; i++){ if (entries[i] === null) { entries[i] = ""; } if (entryType.descriptions[i] == "Domain" || entryType.descriptions[i] == "Alias" || entryType.descriptions[i] == "Host" || entryType.descriptions[i] == "Domain Service" ) - form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i].replace(/\.?<%= string.gsub(html.html_escape(domain), "[\\%[%]%.%*%?%+%{%^%$]", "\\%1") %>$/i, "") + '" name="fixme"> . <%= html.html_escape(domain) %></dd>'; - else if (entryType.descriptions[i] == "Regular expression") - form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i].replace(/\\\d{3}/g, octal_to_char) + '" name="convertme"></dd>'; + form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i].replace(/\\\d{3}/g, octal_to_char).replace(/\.?<%= string.gsub(html.html_escape(domain), "[\\%[%]%.%*%?%+%{%^%$]", "\\%1") %>$/i, "") + '" name="fixme"> . <%= html.html_escape(domain) %></dd>'; + else if (entryType.descriptions[i] == "Comment") + form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i] + '" name="dontconvertme"></dd>'; else - form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i] + '"></dd>'; + form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i].replace(/\\\d{3}/g, octal_to_char) + '"></dd>'; } form = form + "\n</dl>"; entry.empty().append(form); |