luci-app-travelmate: bugfixes
[project/luci.git] / applications / luci-app-travelmate / luasrc / view / travelmate / stations.htm
1 <%#
2 Copyright 2017 Dirk Brenken (dev@brenken.org)
3 This is free software, licensed under the Apache License, Version 2.0
4 -%>
5
6 <%-
7   local write = io.write
8   local uci = require "luci.model.uci".cursor()
9   local trmiface = uci:get("travelmate", "global", "trm_iface") or "trm_wwan"
10 -%>
11
12 <%+header%>
13
14 <div class="cbi-map">
15 <h2 name="content"><%:Wireless Stations%></h2>
16 <div class="cbi-map-descr">
17   <%=translatef("Provides an overview of all configured uplinks for the travelmate interface (%s). You can edit, delete or re-order existing uplinks or scan for a new one. The currently used uplink is emphasized in blue.", trmiface)%>
18 </div>
19
20 <fieldset class="cbi-section">
21   <table class="cbi-section-table" style="empty-cells:hide">
22     <tr class="cbi-section-table-titles">
23       <th class="cbi-section-table-cell" style="text-align:left"><%:Device%></th>
24       <th class="cbi-section-table-cell" style="text-align:left"><%:SSID%></th>
25       <th class="cbi-section-table-cell" style="text-align:left"><%:Encryption%></th>
26       <th class="cbi-section-table-cell" style="text-align:center" colspan="2"><%:Actions%></th>
27     </tr>
28 <%
29   local pos = -1
30   uci:foreach("wireless", "wifi-device", function(s)
31     pos = pos + 1
32   end)
33   uci:foreach("wireless", "wifi-iface", function(s)
34     pos = pos + 1
35     local section = s['.name']
36     local device = s.device or ""
37     local mode = s.mode or ""
38     local iface = s.network or ""
39     local ssid = s.ssid or ""
40     local encryption = s.encryption or ""
41     local disabled = s.disabled or ""
42     local style = "color:#000000"
43     if disabled == "0" then
44       style = "color:#0069d6;font-weight:bold"
45     end
46     if iface == trmiface then
47 %>
48     <tr class="cbi-section-table-row cbi-rowstyle-1" style="<%=style%>">
49       <td style="text-align:left"><%=device%></td>
50       <td style="text-align:left"><%=ssid%></td>
51       <td style="text-align:left"><%=encryption%></td>
52       <td class="cbi-value-field" style="width:70px;text-align:right">
53         <input class="cbi-button cbi-button-up" type="button" value="" onclick="location.href='<%=url('admin/services/travelmate/wifiorder')%>?cfg=<%=section%>;pos=<%=pos%>;dir=up'" alt="<%:Move up%>" title="<%:Move up%>"/>
54         <input class="cbi-button cbi-button-down" type="button" value="" onclick="location.href='<%=url('admin/services/travelmate/wifiorder')%>?cfg=<%=section%>;pos=<%=pos%>;dir=down'" alt="<%:Move down%>" title="<%:Move down%>"/>
55       </td>
56       <td class="cbi-value-field" style="width:150px;text-align:right">
57         <input type="button" class="cbi-button cbi-button-edit" onclick="location.href='<%=url('admin/services/travelmate/wifiedit')%>?cfg=<%=section%>'" title="<%:Edit this Uplink%>" value="<%:Edit%>"/>
58         <input type="button" class="cbi-button cbi-button-remove" onclick="location.href='<%=url('admin/services/travelmate/wifidelete')%>?cfg=<%=section%>'" title="<%:Delete this Uplink%>" value="<%:Delete%>"/>
59       </td>
60     </tr>
61 <% 
62     end
63   end)
64 %>
65   </table>
66 </fieldset>
67 <div class="cbi-page-actions right">
68 <%
69   uci:foreach("wireless", "wifi-device", function(s)
70     local device = s[".name"]
71 %>
72   <form class="inline" action="<%=url('admin/services/travelmate/wifiscan')%>" method="post">
73     <input type="hidden" name="device" value="<%=device%>"/>
74     <input type="hidden" name="token" value="<%=token%>"/>
75     <input type="submit" class="cbi-button cbi-button-find" title="<%:Find and join network on %><%=device%>" value="<%:Scan %><%=device%>"/>
76   </form>
77 <%
78   end)
79 %>
80 </div>
81 </div>
82
83 <%+footer%>