summaryrefslogtreecommitdiffstats
path: root/tinydns-edit-html.lsp
diff options
context:
space:
mode:
Diffstat (limited to 'tinydns-edit-html.lsp')
-rw-r--r--tinydns-edit-html.lsp45
1 files changed, 26 insertions, 19 deletions
diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp
index 6a19c65..95b2fa0 100644
--- a/tinydns-edit-html.lsp
+++ b/tinydns-edit-html.lsp
@@ -16,21 +16,19 @@
this.descriptions[0]=descr0;this.descriptions[1]=descr1;this.descriptions[2]=descr2;this.descriptions[3]=descr3;this.descriptions[4]=descr4;this.descriptions[5]=descr5;this.descriptions[6]=descr6;this.descriptions[7]=descr7;this.descriptions[8]=descr8;this.descriptions[9]=descr9;this.descriptions[10]=descr10;
}
- var entryTypes = new Array(14);
- entryTypes[0]=new Entry("","Empty line",0);
- entryTypes[1]=new Entry(";","Comment line",1,"Comment");
- entryTypes[2]=new Entry("#","Comment line",1,"Comment");
- entryTypes[3]=new Entry(".","Name server",6,"Domain","IP address","Name server","Time to live","Timestamp","Location");
- entryTypes[4]=new Entry("&","Delegate subdomain",6,"Domain","IP address","Name server","Time to live","Timestamp","Location");
- entryTypes[5]=new Entry("=","Host",5,"Host","IP address","Time to live","Timestamp","Location");
- entryTypes[6]=new Entry("+","Alias",5,"Alias","IP address","Time to live","Timestamp","Location");
- entryTypes[7]=new Entry("@","Mail exchanger",7,"Domain","IP address","Mail exchanger","Distance","Time to live","Timestamp","Location");
- entryTypes[8]=new Entry("'","Text record",5,"Domain","Text Record","Time to live","Timestamp","Location");
- entryTypes[9]=new Entry("^","Reverse record",5,"PTR","Domain name","Time to live","Timestamp","Location");
- entryTypes[10]=new Entry("C","Canonical name",5,"Domain","Canonical name","Time to live","Timestamp","Location");
- entryTypes[11]=new Entry("Z","SOA record",11,"Domain","Primary name server","Contact address","Serial number","Refresh time","Retry time","Expire time","Minimum time","Time to live","Timestamp","Location");
- entryTypes[12]=new Entry(":","Generic record",6,"Domain","Record type","Record data","Time to live","Timestamp","Location");
- entryTypes[13]=new Entry("%","Client location",2,"Location","IP prefix");
+ var entryTypes = new Array(12);
+ entryTypes[0]=new Entry("","Comment line",1,"Comment");
+ entryTypes[1]=new Entry(".","Name server",6,"Domain","IP address","Name server","Time to live","Timestamp","Location");
+ entryTypes[2]=new Entry("&","Delegate subdomain",6,"Domain","IP address","Name server","Time to live","Timestamp","Location");
+ entryTypes[3]=new Entry("=","Host",5,"Host","IP address","Time to live","Timestamp","Location");
+ entryTypes[4]=new Entry("+","Alias",5,"Alias","IP address","Time to live","Timestamp","Location");
+ entryTypes[5]=new Entry("@","Mail exchanger",7,"Domain","IP address","Mail exchanger","Distance","Time to live","Timestamp","Location");
+ entryTypes[6]=new Entry("'","Text record",5,"Domain","Text Record","Time to live","Timestamp","Location");
+ entryTypes[7]=new Entry("^","Reverse record",5,"PTR","Domain name","Time to live","Timestamp","Location");
+ entryTypes[8]=new Entry("C","Canonical name",5,"Domain","Canonical name","Time to live","Timestamp","Location");
+ entryTypes[9]=new Entry("Z","SOA record",11,"Domain","Primary name server","Contact address","Serial number","Refresh time","Retry time","Expire time","Minimum time","Time to live","Timestamp","Location");
+ entryTypes[10]=new Entry(":","Generic record",6,"Domain","Record type","Record data","Time to live","Timestamp","Location");
+ entryTypes[11]=new Entry("%","Client location",2,"Location","IP prefix");
function finishForm(entry){
var entrytext = entry.find("select").val() + entry.find("input").map(function(){
@@ -44,17 +42,23 @@
var form = '<select>';
var typechar = entrytext.charAt(0);
if (typechar === null) { typechar = ""; }
- for (i=0; i<14; i++) {
+ for (i=0; i<12; i++) {
form = form + '<option ';
if (typechar == entryTypes[i].entryType){
entryType=entryTypes[i];
form = form + 'selected ';
}
- form = form + 'value="' + entryTypes[i].entryType + '">' + entryTypes[i].entryType + ' (' + entryTypes[i].descr + ')</option>';
+ form = form + 'value="' + entryTypes[i].entryType + '">' + entryTypes[i].descr + '</option>';
}
form = form + "</select><br><dl>";
- entrytext = entrytext.substring(1,entrytext.length) + "::::::::::";
- var entries = entrytext.split(":");
+ var entries;
+ if (entryType.entryType == ""){
+ entries = new Array(1);
+ entries[0] = entrytext;
+ } else {
+ entrytext = entrytext.substring(1,entrytext.length) + "::::::::::";
+ entries = entrytext.split(":");
+ }
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>';
@@ -110,6 +114,9 @@
$(function(){
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();
+ <? end ?>
});
</script>