1 <%- luci.i18n.loadc("upnp") -%>
3 <script type="text/javascript">//<![CDATA[
4 function upnp_delete_fwd(idx) {
5 XHR.get('<%=luci.dispatcher.build_url("admin", "services", "upnp", "delete")%>/' + idx, null,
8 var tb = document.getElementById('upnp_status_table');
9 if (tb && (idx < tb.rows.length))
10 tb.rows[0].parentNode.removeChild(tb.rows[idx]);
15 XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "upnp", "status")%>', null,
18 var tb = document.getElementById('upnp_status_table');
22 while( tb.rows.length > 1 )
25 for( var i = 0; i < st.length; i++ )
27 var tr = tb.insertRow(-1);
28 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
30 tr.insertCell(-1).innerHTML = st[i].proto;
31 tr.insertCell(-1).innerHTML = st[i].extport;
32 tr.insertCell(-1).innerHTML = st[i].intaddr;
33 tr.insertCell(-1).innerHTML = st[i].intport;
35 tr.insertCell(-1).innerHTML = String.format(
36 '<input class="cbi-button cbi-input-remove" type="button" value="<%:Delete Redirect%>" onclick="upnp_delete_fwd(%d)" />',
41 if( tb.rows.length == 1 )
43 var tr = tb.insertRow(-1);
44 tr.className = 'cbi-section-table-row';
46 var td = tr.insertCell(-1);
48 td.innerHTML = '<em><br /><%:There are no active redirects.%></em>';
55 <fieldset class="cbi-section">
56 <legend><%:Active UPnP Redirects%></legend>
57 <table class="cbi-section-table" id="upnp_status_table">
58 <tr class="cbi-section-table-titles">
59 <th class="cbi-section-table-cell"><%:Protocol%></th>
60 <th class="cbi-section-table-cell"><%:External Port%></th>
61 <th class="cbi-section-table-cell"><%:Client Address%></th>
62 <th class="cbi-section-table-cell"><%:Client Port%></th>
63 <th class="cbi-section-table-cell"> </th>
65 <tr class="cbi-section-table-row">
66 <td colspan="5"><em><br /><%:Collecting data...%></em></td>