1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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><%= html.html_escape(string.gsub(config.name, "^.*/", "")) %></TD>
<TD <% if config.errtxt then io.write('class="error"') end %>><%= html.html_escape(config.type) %></TD>
<TD><%= html.html_escape(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 .. "/statusinfo?name=" .. config.name, label = config.clients } %><% else %><%= html.html_escape(config.clients) %><% end %><% end %> </TD>
</TR>
<% if config.errtxt then %>
<TR class="error"><TD colspan=5><%= html.html_escape(config.errtxt) %></TD></TR>
<% end %>
<% end %>
<% if (#view.value == 0) then %>
<TR>
<TD colspan=5>(No existing config-files)</TD>
</TR>
<% end %>
</TABLE>
<% if viewlibrary.dispatch_component and session.permissions.openvpn.createconfig then
viewlibrary.dispatch_component("createconfig")
end %>
|