1 <script type="text/javascript">//<![CDATA[
3 function ocserv_disconnect(idx) {
4 XHR.get('<%=luci.dispatcher.build_url("admin", "services", "ocserv", "disconnect")%>/' + idx, null,
7 var tb = document.getElementById('ocserv_status_table');
8 if (tb && (idx < tb.rows.length))
9 tb.rows[0].parentNode.removeChild(tb.rows[idx]);
14 XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "ocserv", "status")%>', null,
17 var tb = document.getElementById('ocserv_status_table');
21 while( tb.rows.length > 1 )
24 for( var i = 0; i < st.length; i++ )
26 var tr = tb.insertRow(-1);
27 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
29 tr.insertCell(-1).innerHTML = st[i].user;
30 tr.insertCell(-1).innerHTML = st[i].group;
31 tr.insertCell(-1).innerHTML = st[i].vpn_ip;
32 tr.insertCell(-1).innerHTML = st[i].ip;
33 tr.insertCell(-1).innerHTML = st[i].device;
34 tr.insertCell(-1).innerHTML = st[i].time;
35 tr.insertCell(-1).innerHTML = st[i].cipher;
36 tr.insertCell(-1).innerHTML = st[i].status;
38 tr.insertCell(-1).innerHTML = String.format(
39 '<input class="cbi-button cbi-input-remove" type="button" value="<%:Disconnect%>" onclick="ocserv_disconnect(%d)" />',
44 if( tb.rows.length == 1 )
46 var tr = tb.insertRow(-1);
47 tr.className = 'cbi-section-table-row';
49 var td = tr.insertCell(-1);
51 td.innerHTML = '<em><br /><%:There are no active users.%></em>';
58 <fieldset class="cbi-section">
59 <legend><%:Active OpenConnect Users%></legend>
60 <table class="cbi-section-table" id="ocserv_status_table">
61 <tr class="cbi-section-table-titles">
62 <th class="cbi-section-table-cell"><%:User%></th>
63 <th class="cbi-section-table-cell"><%:Group%></th>
64 <th class="cbi-section-table-cell"><%:IP Address%></th>
65 <th class="cbi-section-table-cell"><%:VPN IP Address%></th>
66 <th class="cbi-section-table-cell"><%:Device%></th>
67 <th class="cbi-section-table-cell"><%:Time%></th>
68 <th class="cbi-section-table-cell"><%:Cipher%></th>
69 <th class="cbi-section-table-cell"><%:Status%></th>
70 <th class="cbi-section-table-cell"> </th>
72 <tr class="cbi-section-table-row">
73 <td colspan="5"><em><br /><%:Collecting data...%></em></td>