diff options
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 %> |