diff options
Diffstat (limited to 'tinydns-view-html.lsp')
-rw-r--r-- | tinydns-view-html.lsp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/tinydns-view-html.lsp b/tinydns-view-html.lsp index 8ec8b9e..354b199 100644 --- a/tinydns-view-html.lsp +++ b/tinydns-view-html.lsp @@ -19,6 +19,10 @@ require("viewfunctions") }); } } + function toggleEntry(){ + $(this).find("table").toggle(); + $(this).find("pre").toggle(); + } function editEntry(){ window.location.href = "edit?" + this.id; } @@ -31,6 +35,8 @@ require("viewfunctions") $("#filter-list").submit(function(){ return false; }).focus(); + $("#records pre").hide(); + $("#records li").not(":has(ul)").click(toggleEntry); $("#records li").not(":has(ul)").dblclick(editEntry); $("#locations li").not(":has(ul)").dblclick(editEntry); }); @@ -49,14 +55,10 @@ io.write("</span>") </H1> <H2>Locations</H2> <DL id="locations"> -<? -if (view.value) and (view.value['%']) then - local val = view.value['%'] ?> - <DT<? if (val.errtxt) then io.write(" class='error'") end ?>><?= val.label ?></DT> - - <DD><ul> - <? local currentloc = "" - for i,loc in ipairs(val) do +<ul> +<? local currentloc = "" +for i,loc in ipairs(view.value) do + if loc.type == '%' then if currentloc ~= loc[1] then if currentloc ~= "" then ?> </ul> @@ -70,14 +72,13 @@ if (view.value) and (view.value['%']) then <? if (loc.errtxt) then ?><P CLASS='error'><?= string.gsub(loc.errtxt, "\n", "<BR>") ?></P><? end ?> </li> <? end - if currentloc ~= "" then ?> - </ul> - <? end ?> - </ul> - </DD> -<? else ?> +end ?> +<? if currentloc == "" then ?> No locations defined +<? else ?> + </ul> <? end ?> +</ul> </DL> <? @@ -111,34 +112,33 @@ end <H2>Records</H2> <form id="filter-list">Filter: <input name="filter" id="filter" value="" maxlength="30" size="30" type="text"></form> <DL id="records"> -<? -local tags = {".", "&", "=", "+", "@", "'", "^", "C", "Z", ":" } -for i,entrytype in ipairs(tags) do - local myview = view.value[entrytype] - if (myview) then ?> - <DT><?= myview.label ?></DT> - <DD><ul> - <? local indent = {} - for j,entry in ipairs(myview) do - indent = doListIndents(entry[1], indent) ?> - <ul><li STYLE='margin-left:10px;' id='filename=<?= entry.filename ?>;linenumber=<?= entry.linenumber ?>'> - <IMG SRC='/skins/static/tango/16x16/devices/computer.png' width='16' height='16'><?= tostring(entry[1]) ?><BR> - <TABLE STYLE='margin-left:<?= tostring(7-#indent) ?>0px;'> - <? for k=2,#entry do - local option = entry[k] - if (option) and option ~= "" then ?> - <TR><TD WIDTH='160px' STYLE='border:none;'><?= myview.fieldlabels[k] ?>:</TD> - <TD STYLE='border:none;'><?= option ?></TD></TR> - <? end - end ?> - </TABLE> - <? if entry.errtxt then ?> - <P CLASS='error'><?= string.gsub(entry.errtxt, "\n", "<BR>") ?></P> - <? end ?> - </li></ul> - <? end - doListIndents("", indent) ?> - </ul></DD> - <? end +<ul> +<? local indent = {} +for j,entry in ipairs(view.value) do + if entry.type ~= '%' then + indent = doListIndents(entry[1], indent) ?> + <ul><li STYLE='margin-left:10px;' id='filename=<?= entry.filename ?>;linenumber=<?= entry.linenumber ?>'> + <IMG SRC='/skins/static/tango/16x16/devices/computer.png' width='16' height='16'><?= entry.label ?><BR> + <pre><?= entry.configline ?></pre> + <TABLE STYLE='margin-left:<?= tostring(7-#indent) ?>0px;'> + <? for k=2,#entry do + local option = entry[k] + if (option) and option ~= "" then ?> + <TR><TD WIDTH='160px' STYLE='border:none;'><?= view.fieldlabels[entry.type][k] ?>:</TD> + <TD STYLE='border:none;'><?= option ?></TD></TR> + <? end + end ?> + </TABLE> + <? if entry.errtxt then ?> + <P CLASS='error'><?= string.gsub(entry.errtxt, "\n", "<BR>") ?></P> + <? end ?> + </li></ul> + <? end +end +if #indent == 0 then ?> + No records defined +<? else + doListIndents("", indent) end ?> +</ul> </DL> |