summaryrefslogtreecommitdiffstats
path: root/tinydns-edit-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2010-01-04 16:19:26 +0000
committerTed Trask <ttrask01@yahoo.com>2010-01-04 16:19:26 +0000
commita72ace4b33a35dbf322372b781ee7797da0a225a (patch)
treed532a02e7e71010cd655df6804ef63bbcdbb4f96 /tinydns-edit-html.lsp
parenteaa04340a159c0ba366a787883d2dabfa803093a (diff)
downloadacf-tinydns-a72ace4b33a35dbf322372b781ee7797da0a225a.tar.bz2
acf-tinydns-a72ace4b33a35dbf322372b781ee7797da0a225a.tar.xz
Automatic conversion of octal escape sequences in NAPTR regular expressions.
Diffstat (limited to 'tinydns-edit-html.lsp')
-rw-r--r--tinydns-edit-html.lsp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp
index da18048..19fdf25 100644
--- a/tinydns-edit-html.lsp
+++ b/tinydns-edit-html.lsp
@@ -36,6 +36,13 @@
entryTypes[12]=new Entry("S","Service location",8,"Domain Service", "IP address", "Server", "Port", "Weight", "Priority", "Time to live", "Timestamp");
entryTypes[13]=new Entry("N","Naming authority pointer",9,"Domain", "Order", "Preference", "Flags", "Service", "Regular expression", "Replacement", "Time to live", "Timestamp");
+ function octal_to_char(val){
+ return String.fromCharCode(parseInt(val.substring(1), 8))
+ }
+ function char_to_octal(val){
+ var code = "000" + val.charCodeAt(0).toString(8)
+ return "\\" + code.slice(-3)
+ }
function finishForm(entry){
var entrytext = entry.find("select").val() + entry.find("input:not(.submit)").map(function(){
if (this.name == "fixme") {
@@ -43,6 +50,8 @@
return $(this).val() + ".<%= html.html_escape(domain) %>";
else
return "<%= html.html_escape(domain) %>";
+ } else if (this.name == "convertme") {
+ return $(this).val().replace(/[\\:\r\n ]/g, char_to_octal);
} else {
return $(this).val();
}
@@ -76,6 +85,8 @@
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>';
else
form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + entries[i] + '"></dd>';
}