summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openvpn-listcerts-html.lsp28
-rw-r--r--openvpn-model.lua6
-rw-r--r--openvpn-statusinfo-html.lsp6
-rw-r--r--openvpn-uploadcert-html.lsp9
-rw-r--r--openvpn-viewcert-html.lsp5
-rw-r--r--openvpn-viewconfig-html.lsp115
6 files changed, 95 insertions, 74 deletions
diff --git a/openvpn-listcerts-html.lsp b/openvpn-listcerts-html.lsp
index 74cc45c..ece24fb 100644
--- a/openvpn-listcerts-html.lsp
+++ b/openvpn-listcerts-html.lsp
@@ -16,43 +16,43 @@
<script type="text/javascript">
$(document).ready(function() {
- $("#list").tablesorter({widgets: ['zebra']});
+ $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
});
</script>
<% htmlviewfunctions.displaycommandresults({"deletecert", "generatedhparams"}, session) %>
<% htmlviewfunctions.displaycommandresults({"uploadcert"}, session, true) %>
-<h1><%= html.html_escape(view.label) %></h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
<th>Certificate</th>
</tr>
</thead><tbody>
-<% for i,cert in ipairs(view.value) do %>
+<% local cert = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
+<% for i,crt in ipairs(view.value) do %>
<tr>
<td>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletecert?submit=true&cert="..cert.."&redir="..page_info.orig_action, label="Delete "} %>
- <% if not string.find(cert, "%-key") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/viewcert?cert="..cert.."&redir="..page_info.orig_action, label="View "} %>
+ <% cert.value = crt %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={cert=cert}, label="", option="Delete", action="deletecert" }), page_info, -1) %>
+ <% if not string.find(crt, "%-key") then %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={cert=cert, redir=redir}, label="", option="View", action="viewcert"}), page_info, -1) %>
<% end %>
</td>
- <td><%= html.html_escape(cert) %></td>
+ <td><%= html.html_escape(crt) %></td>
</tr>
<% end %>
</tbody></table>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if viewlibrary.dispatch_component and viewlibrary.check_permission("uploadcert") then
viewlibrary.dispatch_component("uploadcert")
end %>
<% if viewlibrary.check_permission("generatedhparams") then %>
-<h1>Diffie Hellman Parameters</h1>
-<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/generatedhparams") %>">
-<div class='item'><p class='left'>Generate Diffie Hellman parameters</p>
-<div class='right'>
-<input class="submit" type="submit" name="submit" value="Generate">
-</div></div><!-- end .item -->
-</form>
+<% htmlviewfunctions.displaysectionstart(cfe({label="Diffie Hellman Parameters"}), page_info, header_level) %>
+<% htmlviewfunctions.displayitem(cfe({type="form", value={}, label="Generate Diffie Hellman parameters", option="Generate", action="generatedhparams" }), page_info, 0) %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% end %>
diff --git a/openvpn-model.lua b/openvpn-model.lua
index 3c8ce6f..b85c4d9 100644
--- a/openvpn-model.lua
+++ b/openvpn-model.lua
@@ -232,9 +232,9 @@ end
function mymodule.new_upload_cert()
local value = {}
- value.cert = cfe({ type="raw", value=0, label="Certificate", descr='File must be a password protected ".pfx" file' })
- value.password = cfe({ label="Certificate Password" })
- value.name = cfe({ label="Certificate Local Name" })
+ value.cert = cfe({ type="raw", value=0, label="Certificate", descr='File must be a password protected ".pfx" file', seq=1 })
+ value.password = cfe({ type="password", label="Certificate Password", seq=2 })
+ value.name = cfe({ label="Certificate Local Name", seq=3 })
return cfe({ type="group", value=value })
end
diff --git a/openvpn-statusinfo-html.lsp b/openvpn-statusinfo-html.lsp
index ba9881e..68e7b1e 100644
--- a/openvpn-statusinfo-html.lsp
+++ b/openvpn-statusinfo-html.lsp
@@ -23,8 +23,8 @@
<% viewlibrary.dispatch_component("viewconfig") %>
-<h1>Status</h1>
-<h2>Connected clients</h2>
+<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Status"}), page_info) %>
+<% local header_level2 = htmlviewfunctions.displaysectionstart(cfe({label="Connected clients"}), page_info, htmlviewfunctions.incrementheader(header_level)) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Common Name<br/>Connected at</th>
@@ -48,3 +48,5 @@
<% end %>
</tbody></table>
+<% htmlviewfunctions.displaysectionend(header_level2) %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
diff --git a/openvpn-uploadcert-html.lsp b/openvpn-uploadcert-html.lsp
index 41048e4..68dd7a5 100644
--- a/openvpn-uploadcert-html.lsp
+++ b/openvpn-uploadcert-html.lsp
@@ -1,13 +1,8 @@
-<% local form, viewlibrary, page_info = ... %>
+<% local form, viewlibrary, page_info, session = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
-<% html = require("acf.html") %>
-<h1><%= html.html_escape(form.label) %></h1>
<%
- form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action
form.enctype = "multipart/form-data"
form.value.cert.type="file"
- form.value.password.type="password"
- local order = {"cert", "password"}
- htmlviewfunctions.displayform(form, order)
+ htmlviewfunctions.displayitem(form, page_info)
%>
diff --git a/openvpn-viewcert-html.lsp b/openvpn-viewcert-html.lsp
index dcfb7d6..97edd4e 100644
--- a/openvpn-viewcert-html.lsp
+++ b/openvpn-viewcert-html.lsp
@@ -1,5 +1,6 @@
-<% local view, viewlibrary = ... %>
+<% local view, viewlibrary, page_info, session = ... %>
<% html = require("acf.html") %>
-<h1>Certificate Details</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Certificate Details"}), page_info) %>
<pre><%= html.html_escape(view.value.value) %></pre>
+<% htmlviewfunctions.displaysectionend(header_level) %>
diff --git a/openvpn-viewconfig-html.lsp b/openvpn-viewconfig-html.lsp
index cbb4ae0..9b93472 100644
--- a/openvpn-viewconfig-html.lsp
+++ b/openvpn-viewconfig-html.lsp
@@ -3,97 +3,120 @@
<% html = require("acf.html") %>
<% local shortname = string.gsub(view.value.name, "^.*/", "") %>
-<h1><%= html.html_escape(format.cap_begin_word(view.value.type)) %> Config</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label=format.cap_begin_word(view.value.type).." Config"}), page_info) %>
+<% local header_level2 = htmlviewfunctions.displaysectionstart(cfe({label=format.cap_begin_word(view.value.type).." settings"}), page_info, htmlviewfunctions.incrementheader(header_level)) %>
-<h2><%= html.html_escape(format.cap_begin_word(view.value.type)) %> settings</h2>
-<div class='item'><p class='left'>Mode</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+Mode
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.type) %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
-<div class='item'><p class='left'>User device</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+User device
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.dev) %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% if view.value.type == "server" then %>
-<div class='item'><p class='left'>Listens on</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+Listens on
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value["local"]) %>:<%= html.html_escape(view.value.port) %> (<%= html.html_escape(view.value.proto) %>)
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% end %>
<% if view.value.type == "client" then %>
-<div class='item'><p class='left'>Remote server</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+Remote server
+<% htmlviewfunctions.displayitemmiddle() %>
<% if string.find(view.value.remote, "%s") then io.write(html.html_escape(string.gsub(view.value.remote, "%s+", ":"))) else io.write(html.html_escape(view.value.remote .. (view.value.rport or view.value.port or "1194"))) end %> (<%= html.html_escape(view.value.proto) %>)
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% end %>
-<div class='item'><p class='left'>Logfile</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+Logfile
+<% htmlviewfunctions.displayitemmiddle() %>
<% if ( view.value.log ) then %><%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/logfile?name=" .. view.value.name, label=view.value.log } %><% else %>Syslog<% end %> (Verbosity level: <%= html.html_escape(view.value.verb) %>)
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% if view.value.type == "server" then %>
-<h3>Connected clients status</h3>
-<div class='item'><p class='left'>Last status was recorded</p>
-<div class='right'>
+<% local header_level3 = htmlviewfunctions.displaysectionstart(cfe({label="Connected clients status"}), page_info, htmlviewfunctions.incrementheader(header_level2)) %>
+
+<% htmlviewfunctions.displayitemstart() %>
+Last status was recorded
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.client_lastupdate) %> (This was <b><%= html.html_escape(view.value.client_lastdatechangediff) %></b> ago)
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
-<div class='item'><p class='left'>Maximum clients</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+Maximum clients
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value["max-clients"]) %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
-<div class='item'><p class='left'>Connected clients</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+Connected clients
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.client_count) %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
+
+<% htmlviewfunctions.displaysectionend(header_level3) %>
<% end %>
+
<% if view.value.dh or view.value.ca or view.value.cert or view.value.key or view.value.tls or view.value.crl then %>
-<h2>Certificate files</h2>
+<% htmlviewfunctions.displaysectionend(header_level2) %>
+<% htmlviewfunctions.displaysectionstart(cfe({label="Certificate files"}), page_info, header_level2) %>
+
<% if (view.value.dh) then %>
-<div class='item'><p class='left'>DH</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+DH
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/viewcert?cert=" .. view.value.dh, label=view.value.dh } %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% end %>
<% if (view.value.ca) then %>
-<div class='item'><p class='left'>CA Certificate</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+CA Certificate
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/viewcert?cert=" .. view.value.ca, label=view.value.ca } %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% end %>
<% if (view.value.cert) then %>
-<div class='item'><p class='left'>Certificate</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+Certificate
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/viewcert?cert=" .. view.value.cert, label=view.value.cert } %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% end %>
<% if (view.value.key) then %>
-<div class='item'><p class='left'>Private Key</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+Private Key
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.key) %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% end %>
<% if (view.value.tls) then %>
-<div class='item'><p class='left'>TLS Authentication</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+TLS Authentication
<%= html.html_escape(view.value.tls) %><% -- html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/pem_info?name=" .. view.value.tls , label=view.value.tls } %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% end %>
<% if (view.value.crl) then %>
-<div class='item'><p class='left'>CRL Verify File</p>
-<div class='right'>
+<% htmlviewfunctions.displayitemstart() %>
+CRL Verify File
+<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.crl) %><% -- html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/pem_info?name=" .. view.value.crl , label=view.value.crl } %>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitemend() %>
<% end %>
+
<% end %>
+
+<% htmlviewfunctions.displaysectionend(header_level2) %>
+<% htmlviewfunctions.displaysectionend(header_level) %>