diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-11-25 19:27:55 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-11-25 19:27:55 +0000 |
commit | 3459e6bf19a13f35e419b0adabf8c3456a0a5025 (patch) | |
tree | 9330301f44a88ee2f3cb8b5d0271204294aa99c6 /openvpn-listconfigs-html.lsp | |
parent | 99b9d1c5e938d818ca3e78a1f37d6a80da4b88f1 (diff) | |
download | acf-openvpn-3459e6bf19a13f35e419b0adabf8c3456a0a5025.tar.bz2 acf-openvpn-3459e6bf19a13f35e419b0adabf8c3456a0a5025.tar.xz |
Rewrite of openvpn to use cfes and new style. Added ability to edit/create/delete configs. Combined three view functions into one. Added a new status and moved old status to listconfigs. Still needs work, including ability to start/stop/restart.v0.3.0
git-svn-id: svn://svn.alpinelinux.org/acf/openvpn/trunk@1611 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'openvpn-listconfigs-html.lsp')
-rw-r--r-- | openvpn-listconfigs-html.lsp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/openvpn-listconfigs-html.lsp b/openvpn-listconfigs-html.lsp new file mode 100644 index 0000000..1e67f4b --- /dev/null +++ b/openvpn-listconfigs-html.lsp @@ -0,0 +1,51 @@ +<% local view, viewlibrary, page_info, session = ... %> +<% require("viewfunctions") %> + +<% displaycommandresults({"editconfig", "deleteconfig"}, session) %> +<% displaycommandresults({"createconfig"}, session, true) %> + +<% if viewlibrary.dispatch_component then + viewlibrary.dispatch_component("status") +end %> + +<H2>Available configs</H2> +<TABLE> + <TR style="background:#eee;font-weight:bold;vertical-align:top;"> + <TD class="header">Actions</TD> + <TD class="header">Config</TD> + <TD class="header">Type</TD> + <TD class="header">Status</TD> + <TD class="header">Connected<BR>Clients</TD> + </TR> + +<% for i,config in ipairs(view.value) do %> + <TR > + <TD> + <%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/viewconfig?name=" .. config.name, label="View " } %> + <% if session.permissions.openvpn.editconfig then %> + <%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/editconfig?name=" .. config.name.."&redir="..page_info.orig_action, label="Expert " } %> + <% end %> + <% if session.permissions.openvpn.deleteconfig then %> + <%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/deleteconfig?name=" .. config.name.."&redir="..page_info.orig_action, label="Delete " } %> + <% end %> + </TD> + <TD><%= string.gsub(config.name, "^.*/", "") %></TD> + <TD <% if config.errtxt then io.write('class="error"') end %>><%= config.type %></TD> + <TD><%= config.status %></TD> + <TD><% if ( config.type == "server" ) then %><% if ( config.clients > 0 ) then %><%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/status_info?name=" .. config.name, label = config.clients } %><% else %><%= config.clients %><% end %><% end %></TD> + </TR> + <% if config.errtxt then %> + <TR class="error"><TD colspan=5><%= config.errtxt %></TD></TR> + <% end %> +<% end %> + +<% if (#view.value == 0) then %> + <TR> + <TD colspan=3>(No existing config-files)</TD> + </TR> +<% end %> +</TABLE> + +<% if viewlibrary.dispatch_component and session.permissions.openvpn.createconfig then + viewlibrary.dispatch_component("createconfig") +end %> |