applications/luci-upnp: load language file in status template
[project/luci.git] / applications / luci-upnp / luasrc / view / upnp_status.htm
1 <%- luci.i18n.loadc("upnp") -%>
2
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,
6                         function(x)
7                         {
8                                 var tb = document.getElementById('upnp_status_table');
9                                 if (tb && (idx < tb.rows.length))
10                                         tb.rows[0].parentNode.removeChild(tb.rows[idx]);
11                         }
12                 );
13         }
14
15         XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "upnp", "status")%>', null,
16                 function(x, st)
17                 {
18                         var tb = document.getElementById('upnp_status_table');
19                         if (st && tb)
20                         {
21                                 /* clear all rows */
22                                 while( tb.rows.length > 1 )
23                                         tb.deleteRow(1);
24
25                                 for( var i = 0; i < st.length; i++ )
26                                 {
27                                         var tr = tb.insertRow(-1);
28                                                 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
29
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;
34
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)" />',
37                                                         st[i].num
38                                         );
39                                 }
40
41                                 if( tb.rows.length == 1 )
42                                 {
43                                         var tr = tb.insertRow(-1);
44                                                 tr.className = 'cbi-section-table-row';
45
46                                         var td = tr.insertCell(-1);
47                                                 td.colSpan = 5;
48                                                 td.innerHTML = '<em><br /><%:There are no active redirects.%></em>';
49                                 }
50                         }
51                 }
52         );
53 //]]></script>
54
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">&#160;</th>
64                 </tr>
65                 <tr class="cbi-section-table-row">
66                         <td colspan="5"><em><br /><%:Collecting data...%></em></td>
67                 </tr>
68         </table>
69 </fieldset>