2 Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
3 This is free software, licensed under the Apache License, Version 2.0
7 local uci = require("luci.model.uci").cursor()
8 local trmiface = uci:get("travelmate", "global", "trm_iface") or "trm_wwan"
13 <script type="text/javascript">
15 function status_update(json)
22 var status = json.data.travelmate_status;
23 var faulty = json.data.faulty_stations;
27 var faulty_array = faulty.split(' ');
28 for (i = 0; i < faulty_array.length; i++)
30 for (j = 1; j <= 5; j++)
32 search = j + "_" + faulty_array[i];
33 view = document.getElementById(search);
36 view.setAttribute("name", "station_nok");
37 view.setAttribute("style", "text-align: left !important; color: #a22; font-weight: bold");
44 list = document.getElementsByName("station_nok");
47 for (i = 0; i < list.length; i++)
49 list[i].removeAttribute("style");
54 if (status.startsWith("connected"))
56 for (i = 1; i <= 5; i++)
58 search = i + "_" + json.data.station_id;
59 view = document.getElementById(search);
62 view.setAttribute("style", "text-align: left !important; color: #37c; font-weight: bold");
68 list = document.getElementsByName("station_ok");
71 for (i = 0; i < list.length; i++)
73 list[i].removeAttribute("style");
79 XHR.get('<%=luci.dispatcher.build_url("admin", "services", "travelmate", "status")%>', null,
80 function(x, json_info)
86 status_update(json_info)
89 XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "travelmate", "status")%>', null,
90 function(x, json_info)
96 status_update(json_info)
101 <div class="cbi-map">
102 <div class="cbi-map-descr">
103 <%=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, faulty stations in red.", trmiface)%>
106 <div class="cbi-section">
107 <div class="table cbi-section-table">
108 <div class="tr cbi-section-table-titles">
109 <div class="th left"><%:Device%></div>
110 <div class="th left"><%:SSID%></div>
111 <div class="th left"><%:BSSID%></div>
112 <div class="th left"><%:Encryption%></div>
113 <div class="th center"><%:Action%></div>
115 <%- uci:foreach("wireless", "wifi-iface", function(s)
116 local iface = s.network or ""
117 if iface == trmiface then
118 local section = s['.name'] or ""
119 local device = s.device or "-"
120 local ssid = s.ssid or "-"
121 local bssid = s.bssid or "-"
122 local encr = s.encryption or "-"
124 <div class="tr cbi-section-table-row cbi-rowstyle-1" name="station_ok" id="1_<%=device%>/<%=ssid%>/<%=bssid%>">
125 <div class="td left" style="text-align: left !important" name="station_ok" id="2_<%=device%>/<%=ssid%>/<%=bssid%>"><%=device%></div>
126 <div class="td left" style="text-align: left !important" name="station_ok" id="3_<%=device%>/<%=ssid%>/<%=bssid%>"><%=ssid%></div>
127 <div class="td left" style="text-align: left !important" name="station_ok" id="4_<%=device%>/<%=ssid%>/<%=bssid%>"><%=bssid%></div>
128 <div class="td left" style="text-align: left !important" name="station_ok" id="5_<%=device%>/<%=ssid%>/<%=bssid%>"><%=encr%></div>
129 <div class="td middle cbi-section-actions">
131 <input class="cbi-button cbi-button-up" type="button" value="<%:Up%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifiorder')%>?cfg=<%=section%>&dir=up'" alt="<%:Move up%>" title="<%:Move up%>" />
132 <input class="cbi-button cbi-button-down" type="button" value="<%:Down%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifiorder')%>?cfg=<%=section%>&dir=down'" alt="<%:Move down%>" title="<%:Move down%>" />
133 <input class="cbi-button cbi-button-edit" type="button" value="<%:Edit%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifiedit')%>?cfg=<%=section%>'" title="<%:Edit this Uplink%>" />
134 <input class="cbi-button cbi-button-remove" type="button" value="<%:Delete%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifidelete')%>?cfg=<%=section%>'" title="<%:Delete this Uplink%>" />
141 <div class="cbi-page-actions right">
142 <%- uci:foreach("wireless", "wifi-device", function(s)
143 local device = s[".name"]
144 local hwmode = s.hwmode or "-" -%>
145 <form class="inline" action="<%=luci.dispatcher.build_url('admin/services/travelmate/wifiscan')%>" method="post">
146 <input type="hidden" name="device" value="<%=device%>" />
147 <input type="hidden" name="token" value="<%=token%>" />
148 <input type="submit" class="cbi-button cbi-button-action important" title="<%:Find and join network on%> <%=device%>" value="<%:Scan%> <%=device%> (<%=hwmode%>)" />