luci-app-travelmate: enhancements & fixes
[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 <%-
8   local write = io.write
9   local uci = require "luci.model.uci".cursor()
10   local trmiface = uci:get("travelmate", "global", "trm_iface") or "trm_wwan"
11 -%>
12
13 <%+header%>
14
15 <div class="cbi-map">
16 <h2 name="content"><%:Wireless Stations%></h2>
17 <div class="cbi-map-descr"><%:Provides an overview of all configured uplink interfaces for travelmate. You can edit and delete existing interfaces or scan for new uplinks.%></div>
18
19 <fieldset class="cbi-section">
20   <table class="cbi-section-table" style="empty-cells:hide">
21     <tr class="cbi-section-table-titles">
22       <th class="cbi-section-table-cell" style="text-align:left"><%:Device%></th>
23       <th class="cbi-section-table-cell" style="text-align:left"><%:Mode%></th>
24       <th class="cbi-section-table-cell" style="text-align:left"><%:Uplink Interface%></th>
25       <th class="cbi-section-table-cell" style="text-align:left"><%:SSID%></th>
26       <th class="cbi-section-table-cell" style="text-align:left"><%:Encryption%></th>
27       <th class="cbi-section-table-cell" style="text-align:left" colspan="3"><%:Disabled%></th>
28     </tr>
29 <%
30     local pos = 1
31     uci:foreach("wireless", "wifi-iface", function(s)
32     pos = pos + 1
33     local section = s['.name']
34     local device = s.device or ""
35     local mode = s.mode or ""
36     local iface = s.network or ""
37     local ssid = s.ssid or ""
38     local encryption = s.encryption or ""
39     local disabled = s.disabled or ""
40     local style = "color:#000000"
41     if disabled == "0" then
42       style = "color:#0069d6"
43     end
44     if iface == trmiface then
45 %>
46     <tr class="cbi-section-table-row cbi-rowstyle-7" style="<%=style%>">
47       <td style="text-align:left"><%=device%></td>
48       <td style="text-align:left"><%=mode%></td>
49       <td style="text-align:left"><%=iface%></td>
50       <td style="text-align:left"><%=ssid%></td>
51       <td style="text-align:left"><%=encryption%></td>
52       <td style="text-align:left"><%=disabled%></td>
53       <td class="cbi-value-field" style="width:100px;text-align:right">
54         <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%>" />
55         <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%>" />
56       </td>
57       <td class="cbi-value-field" style="width:180px;text-align:right">
58         <input type="button" class="cbi-button cbi-button-edit" style="width:85px" onclick="location.href='<%=url('admin/services/travelmate/wifiedit')%>?cfg=<%=section%>'" title="<%:Edit this Uplink%>" value="<%:Edit%>" />
59         <input type="button" class="cbi-button cbi-button-remove" style="width:85px" onclick="location.href='<%=url('admin/services/travelmate/wifidelete')%>?cfg=<%=section%>'" title="<%:Delete this Uplink%>" value="<%:Delete%>"/>
60       </td>
61     </tr>
62 <% 
63     end
64   end)
65 %>
66   </table>
67 </fieldset>
68 <div class="cbi-page-actions right">
69 <%
70   uci:foreach("wireless", "wifi-device", function(s)
71     local device = s[".name"]
72 %>
73   <form class="inline" action="<%=url('admin/services/travelmate/wifiscan')%>" method="post">
74     <input type="hidden" name="device" value="<%=device%>" />
75     <input type="hidden" name="token" value="<%=token%>" />
76     <input type="submit" class="cbi-button cbi-button-find" style="width:110px" title="<%:Find and join network on %><%=device%>" value="<%:Scan %><%=device%>" />
77   </form>
78 <%
79   end)
80 %>
81 </div>
82
83 <%+footer%>