diff options
| -rw-r--r-- | tinydns-edit-html.lsp | 30 | ||||
| -rw-r--r-- | tinydns-listfiles-html.lsp | 54 | ||||
| -rw-r--r-- | tinydns-listpermissions-html.lsp | 51 | ||||
| -rw-r--r-- | tinydns-status-html.lsp | 20 | ||||
| -rw-r--r-- | tinydns-view-html.lsp | 51 | 
5 files changed, 121 insertions, 85 deletions
diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp index d251638..2dcfc81 100644 --- a/tinydns-edit-html.lsp +++ b/tinydns-edit-html.lsp @@ -121,7 +121,7 @@  					name = "testme";  			} -			form = form + '<dt>' + entryType.descriptions[i] + '</dt><dd><input type="text" value="' + value + '" name="' + name + '">' + extra + '</dd>'; +			form = form + '<div class='item'><p class='left'>' + entryType.descriptions[i] + '</p>\n<div class='right'>\n<input type="text" value="' + value + '" name="' + name + '">' + extra + '\n</div></div><!-- end .item -->';  		}  		form = form + "\n</dl>";  		entry.empty().append(form); @@ -192,32 +192,30 @@  	});  </script> -<H1>Configuration</H1> -<H2>Expert Configuration</H2> -<H3>File Details</H3> -<DL> +<h1>Configuration</h1> +<h2>Expert Configuration</h2> +<h3>File Details</h3>  <%   htmlviewfunctions.displayitem(form.value.filename)  htmlviewfunctions.displayitem(form.value.filesize)  htmlviewfunctions.displayitem(form.value.mtime)  %> -</DL> -<H3>File Entries</H3> -<% if form.descr then %><P CLASS='descr'><%= string.gsub(html.html_escape(form.descr), "\n", "<BR>") %></P><% end %> -<% if form.errtxt then %><P CLASS='error'><%= string.gsub(html.html_escape(form.errtxt), "\n", "<BR>") %></P><% end %> -<TABLE id="entries"> +<h3>File Entries</h3> +<% if form.descr then %><p class='descr'><%= string.gsub(html.html_escape(form.descr), "\n", "<br/>") %></p><% end %> +<% if form.errtxt then %><p class='error'><%= string.gsub(html.html_escape(form.errtxt), "\n", "<br/>") %></p><% end %> +<table id="entries">  <% for line in string.gmatch(html.html_escape(form.value.filecontent.value), "([^\n]*)\n?") do %> -	<TR> -	<TD><%= line %></TD> -	</TR> +	<tr> +	<td><%= line %></td> +	</tr>  <% end %> -</TABLE> -<% if form.value.filecontent.errtxt then %><P CLASS='error'><%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "<BR>") %></P><% end %> +</table> +<% if form.value.filecontent.errtxt then %><p class='error'><%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "<br/>") %></p><% end %>  <% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %>  <% htmlviewfunctions.displayformstart(form) %>  <input type="hidden" name="filename" value="<%= html.html_escape(form.value.filename.value) %>">  <input type="hidden" name="filecontent" value="<%= html.html_escape(form.value.filecontent.value) %>"> -<H2>Save and Apply Above Settings</H2> +<h2>Save and Apply Above Settings</h2>  <% htmlviewfunctions.displayformend(form) %> diff --git a/tinydns-listfiles-html.lsp b/tinydns-listfiles-html.lsp index 470693f..33c7860 100644 --- a/tinydns-listfiles-html.lsp +++ b/tinydns-listfiles-html.lsp @@ -3,42 +3,60 @@ htmlviewfunctions = require("htmlviewfunctions")  html = require("acf.html")  %> +<script type="text/javascript"> +	if (typeof jQuery == 'undefined') { +		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>'); +	} +</script> + +<script type="text/javascript"> +	if (typeof $.tablesorter == 'undefined') { +		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>'); +	} +</script> + +<script type="text/javascript"> +	$(document).ready(function() { +		$("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']}); +	}); +</script> +  <% htmlviewfunctions.displaycommandresults({"delete", "edit", "editfile"}, session) %>  <% htmlviewfunctions.displaycommandresults({"newfile", "startstop"}, session, true) %>  <h1>Configuration</h1> -<h2>Edit/View existing Domains</h2> -<DL><TABLE> -	<TR style="background:#eee;font-weight:bold;"> -		<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Action</TD> -		<TD style="padding-right:20px;white-space:nowrap;text-align:right;" class="header">Size</TD> -		<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Last Modified</TD> -		<TD style="white-space:nowrap;text-align:left;" class="header">File</TD> -	</TR>		 +<h2>Edit/View Existing Domains</h2> +<table id="list" class="tablesorter"><thead> +	<tr> +		<th>Action</th> +		<th>Size</th> +		<th>Last Modified</th> +		<th>File</th> +	</tr> +</thead><tbody>  <% for i,file in ipairs(form.value) do %> -	<TR> -		<TD style="padding-right:20px;white-space:nowrap;"> +	<tr> +		<td>  			<%  			if viewlibrary.check_permission("delete") then io.write(html.link{value = "delete?submit=true&filename=" .. file.value.filename.value, label="Delete " }) end  			io.write(html.link{value = "view?filename=" .. file.value.filename.value, label="View " })  			if viewlibrary.check_permission("edit") then io.write(html.link{value = "edit?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Edit " }) end  			if viewlibrary.check_permission("editfile") then io.write(html.link{value = "editfile?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Expert " }) end  			%> -		</TD> -		<TD style="padding-right:20px;white-space:nowrap;text-align:right;"><%= html.html_escape(file.value.filesize.value) %></TD> -		<TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(file.value.mtime.value) %></TD> -		<TD style="white-space:nowrap;" width="90%"><%= html.html_escape(string.gsub(file.value.filename.value, "^.*/", "")) %></TD> -	</TR> +		</td> +		<td><%= html.html_escape(file.value.filesize.value) %></td> +		<td><%= html.html_escape(file.value.mtime.value) %></td> +		<td><%= html.html_escape(string.gsub(file.value.filename.value, "^.*/", "")) %></td> +	</tr>  <% end %> -</TABLE> +</tbody></table>  <% if #form.value == 0 then %>  	No domains defined  <% end %> -</DL>  <% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("newfile") then  	local newfileform = viewlibrary.dispatch_component("newfile", nil, true) %> -<h2>Create new Domain</h2> +<h2>Create New Domain</h2>  <%  	newfileform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/newfile"  	htmlviewfunctions.displayform(newfileform) diff --git a/tinydns-listpermissions-html.lsp b/tinydns-listpermissions-html.lsp index f0f4379..0662aba 100644 --- a/tinydns-listpermissions-html.lsp +++ b/tinydns-listpermissions-html.lsp @@ -2,30 +2,51 @@  <% htmlviewfunctions = require("htmlviewfunctions") %>  <% html = require("acf.html") %> +<script type="text/javascript"> +	if (typeof jQuery == 'undefined') { +		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>'); +	} +</script> + +<script type="text/javascript"> +	if (typeof $.tablesorter == 'undefined') { +		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>'); +	} +</script> + +<script type="text/javascript"> +	$(document).ready(function() { +		$("#userlist").tablesorter({widgets: ['zebra']}); +		$("#rolelist").tablesorter({widgets: ['zebra']}); +	}); +</script> +  <% htmlviewfunctions.displaycommandresults({"edituserpermissions", "editrolepermissions"}, session) %> -<H1><%= html.html_escape(view.label) %></H1> +<h1><%= html.html_escape(view.label) %></h1> -<H2>User Permissions</H2> -<DL><TABLE> -<TR><TD CLASS='header'>User</TD><TD CLASS='header'>Permissions</TD> +<h2>User Permissions</h2> +<table id="userlist" class="tablesorter"><thead> +<tr><th>User</th><th>Permissions</th> +</thead><tbody>  <% for i,user in ipairs(view.value.user) do %> -	<TR><TD><%= html.link{value=page_info.script .. page_info.prefix .. page_info.controller .. "/edituserpermissions?userid=" .. user.id .. "&redir="..page_info.orig_action, label=user.id} %></TD><TD> +	<tr><td><%= html.link{value=page_info.script .. page_info.prefix .. page_info.controller .. "/edituserpermissions?userid=" .. user.id .. "&redir="..page_info.orig_action, label=user.id} %></td><td>  	<% for y,allowed in pairs(user.allowed) do -		print(html.html_escape(allowed), "<BR>") +		print(html.html_escape(allowed), "<br/>")  	end %> -	<TD></TR> +	</td></tr>  <% end %> -</TABLE></DL> +</tbody></table> -<H2>Role Permissions</H2> -<DL><TABLE> -<TR><TD CLASS='header'>Role</TD><TD CLASS='header'>Permissions</TD> +<h2>Role Permissions</h2> +<table id="rolelist" class="tablesorter"><thead> +<tr><th>Role</th><th>Permissions</th> +</thead><tbody>  <% for i,role in ipairs(view.value.role) do %> -	<TR><TD><%= html.link{value=page_info.script .. page_info.prefix .. page_info.controller .. "/editrolepermissions?role=" .. role.id .. "&redir="..page_info.orig_action, label=role.id} %></TD><TD> +	<tr><td><%= html.link{value=page_info.script .. page_info.prefix .. page_info.controller .. "/editrolepermissions?role=" .. role.id .. "&redir="..page_info.orig_action, label=role.id} %></td><td>  	<% for y,allowed in pairs(role.allowed) do -		print(html.html_escape(allowed), "<BR>") +		print(html.html_escape(allowed), "<br/>")  	end %> -	<TD></TR> +	</td></tr>  <% end %> -</TABLE></DL> +</tbody></table> diff --git a/tinydns-status-html.lsp b/tinydns-status-html.lsp index bdceb23..77050d8 100644 --- a/tinydns-status-html.lsp +++ b/tinydns-status-html.lsp @@ -6,36 +6,38 @@ html = require("acf.html")  <% htmlviewfunctions.displaycommandresults({"install","edit"}, session) %>  <% htmlviewfunctions.displaycommandresults({"startstop"}, session) %> -<H1>System Info</H1> -<DL> +<h1>System Info</h1>  <%  htmlviewfunctions.displayitem(data.value.status)  htmlviewfunctions.displayitem(data.value.version)  if data.value.version and data.value.version.errtxt and viewlibrary.check_permission("apk-tools/apk/install") then  %> -	<DT>Install package</DT> -	<DD><form action="<%= html.html_escape(page_info.script .. "/apk-tools/apk/install") %>" method="POST"> +	<div class='item'><p class='left'>Install package</p> +	<div class='right'> +	<form action="<%= html.html_escape(page_info.script .. "/apk-tools/apk/install") %>" method="post">  	<input type='hidden' name='package' value='<%= html.html_escape(data.value.version.name) %>'> -	<input class='submit' type='submit' name='submit' value='Install'></form></DD> +	<input class='submit' type='submit' name='submit' value='Install'></form> +	</div></div><!-- end .item -->  <%  end  htmlviewfunctions.displayitem(data.value.autostart)  if not (data.value.version and data.value.version.errtxt) and data.value.autostart and data.value.autostart.errtxt and viewlibrary.check_permission("alpine-baselayout/rc/edit") then  %> -	<DT>Enable autostart</DT> -	<DD><form action="<%= html.html_escape(page_info.script .. "/alpine-baselayout/rc/edit") %>" method="POST"> +	<div class='item'><p class='left'>Enable autostart</p> +	<div class='right'> +	<form action="<%= html.html_escape(page_info.script .. "/alpine-baselayout/rc/edit") %>" method="post">  	<input type='hidden' name='servicename' value='<%= html.html_escape(data.value.autostart.name) %>'>  	<input type='hidden' name='redir' value='<%= html.html_escape(page_info.orig_action) %>'> -	<input class='submit' type='submit' value='Enable'></form></DD> +	<input class='submit' type='submit' value='Enable'></form> +	</div></div><!-- end .item -->  <%  end  htmlviewfunctions.displayitem(data.value.configdir)  htmlviewfunctions.displayitem(data.value.listen)  %> -</DL>  <% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("startstop") then  	viewlibrary.dispatch_component("startstop") diff --git a/tinydns-view-html.lsp b/tinydns-view-html.lsp index d86fce6..24ba38b 100644 --- a/tinydns-view-html.lsp +++ b/tinydns-view-html.lsp @@ -47,12 +47,11 @@ html = require("acf.html")  	});  </script> -<H1>DNS Entries +<h1>DNS Entries  <% if view.filename then io.write(" for "..html.html_escape(string.gsub(view.filename, "^.*/", ""))) end %> -</H1> -<H2>Locations</H2> -<DL id="locations"> -<ul> +</h1> +<h2>Locations</h2> +<ul id="locations">  <% local currentloc = ""  for i,loc in ipairs(view.value) do  	if loc.type == '%' then @@ -60,23 +59,22 @@ for i,loc in ipairs(view.value) do  			if currentloc ~= "" then %>  				</ul>  			<% end %> -			<li><IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/places/start-here.png' width='16' height='16' alt> <B><%= html.html_escape(loc[1]) %></B></li> -			<ul STYLE='margin-left:30px';> +			<li><img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/places/start-here.png' width='16' height='16' alt> <b><%= html.html_escape(loc[1]) %></b></li> +			<ul style='margin-left:30px';>  		<% end  		currentloc = loc[1] %>  		<li id='filename=<%= html.html_escape(loc.filename) %>;linenumber=<%= html.html_escape(loc.linenumber) %>'>  		<%= html.html_escape(loc[2]) %><% if loc[2] == "" then io.write('*') end %> -		<% if (loc.errtxt) then %><P CLASS='error'><%= string.gsub(html.html_escape(loc.errtxt), "\n", "<BR>") %></P><% end %> +		<% if (loc.errtxt) then %><p class='error'><%= string.gsub(html.html_escape(loc.errtxt), "\n", "<br/>") %></p><% end %>  		</li>  	<% end  end %> +	</ul>  <% if currentloc == "" then %> -	No locations defined +	<p>No locations defined</p>  <% else %>  	</ul>  <% end %> -</ul> -</DL>  <%  local function doListIndents(next, indent) @@ -98,7 +96,7 @@ local function doListIndents(next, indent)  		io.write("</li></ul>\n")  	end  	for j=1,starting do -		io.write("<ul><li STYLE='margin-left:10px;'><strong>") +		io.write("<ul><li style='margin-left:10px;'><strong>")  		io.write(html.html_escape(table.concat(newentry, ".", #newentry-(i+j-2), #newentry)))  		io.write("</strong>\n")  	end @@ -106,36 +104,35 @@ local function doListIndents(next, indent)  end  %> -<H2>Records</H2> -<DL id="records"> +<h2>Records</h2>  <form id="filter-list">Filter: <input name="filter" id="filter" value="" maxlength="30" size="30" type="text"></form> -<ul> +<ul id="records">  <% 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=<%= html.html_escape(entry.filename) %>;linenumber=<%= html.html_escape(entry.linenumber) %>'> -		<IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/devices/computer.png' width='16' height='16'><%= html.html_escape(entry.label) %><BR> +		<ul><li style='margin-left:10px;' id='filename=<%= html.html_escape(entry.filename) %>;linenumber=<%= html.html_escape(entry.linenumber) %>'> +		<img src='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/devices/computer.png' width='16' height='16'><%= html.html_escape(entry.label) %><br/>  		<pre><%= html.html_escape(entry.configline) %></pre> -		<TABLE STYLE='margin-left:<%= html.html_escape(tostring(7-#indent)) %>0px;'> +		<table style='margin-left:<%= html.html_escape(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;'><%= html.html_escape(view.fieldlabels[entry.type][k]) %>:</TD> -				<TD STYLE='border:none;'><%= html.html_escape(option) %></TD></TR> +				<tr><td width='160px' style='border:none;'><%= html.html_escape(view.fieldlabels[entry.type][k]) %>:</td> +				<td style='border:none;'><%= html.html_escape(option) %></td></tr>  			<% end  		end %> -		</TABLE> +		</table>  		<% if entry.errtxt then %> -			<P CLASS='error'><%= string.gsub(html.html_escape(entry.errtxt), "\n", "<BR>") %></P> +			<p class='error'><%= string.gsub(html.html_escape(entry.errtxt), "\n", "<br/>") %></p>  		<% end %>  		</li></ul>  	<% end   end  if #indent == 0 then %> -	No records defined +	</ul> +	<p>No records defined</p>  <% else -	doListIndents("", indent) -end %> -</ul> -</DL> +	doListIndents("", indent) %> +	</ul> +<% end %>  | 
