luci-app-travelmate: bugfixes 1723/head
authorDirk Brenken <dev@brenken.org>
Thu, 5 Apr 2018 20:39:46 +0000 (22:39 +0200)
committerDirk Brenken <dev@brenken.org>
Thu, 5 Apr 2018 20:39:46 +0000 (22:39 +0200)
* use the form() action to invoke the SimpleForm models
* fix 'wifi_add' input form

Signed-off-by: Dirk Brenken <dev@brenken.org>
applications/luci-app-travelmate/luasrc/controller/travelmate.lua
applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua

index b2b877347c198e4e0a9647db694b4c2975020514..493a387c3e363390b341f0047db1625376146d0a 100644 (file)
@@ -16,17 +16,17 @@ function index()
        entry({"admin", "services", "travelmate", "stations"}, template("travelmate/stations"), _("Wireless Stations"), 20).leaf = true
        entry({"admin", "services", "travelmate", "logfile"}, call("logread"), _("View Logfile"), 30).leaf = true
        entry({"admin", "services", "travelmate", "advanced"}, firstchild(), _("Advanced"), 100)
-       entry({"admin", "services", "travelmate", "advanced", "configuration"}, cbi("travelmate/configuration_tab"), _("Edit Travelmate Configuration"), 110).leaf = true
-       entry({"admin", "services", "travelmate", "advanced", "cfg_wireless"}, cbi("travelmate/cfg_wireless_tab"), _("Edit Wireless Configuration"), 120).leaf = true
-       entry({"admin", "services", "travelmate", "advanced", "cfg_network"}, cbi("travelmate/cfg_network_tab"), _("Edit Network Configuration"), 130).leaf = true
-       entry({"admin", "services", "travelmate", "advanced", "cfg_firewall"}, cbi("travelmate/cfg_firewall_tab"), _("Edit Firewall Configuration"), 140).leaf = true
+       entry({"admin", "services", "travelmate", "advanced", "configuration"}, form("travelmate/configuration_tab"), _("Edit Travelmate Configuration"), 110).leaf = true
+       entry({"admin", "services", "travelmate", "advanced", "cfg_wireless"}, form("travelmate/cfg_wireless_tab"), _("Edit Wireless Configuration"), 120).leaf = true
+       entry({"admin", "services", "travelmate", "advanced", "cfg_network"}, form("travelmate/cfg_network_tab"), _("Edit Network Configuration"), 130).leaf = true
+       entry({"admin", "services", "travelmate", "advanced", "cfg_firewall"}, form("travelmate/cfg_firewall_tab"), _("Edit Firewall Configuration"), 140).leaf = true
 
        entry({"admin", "services", "travelmate", "apqr"}, template("travelmate/ap_qr")).leaf = true
        entry({"admin", "services", "travelmate", "wifiscan"}, template("travelmate/wifi_scan")).leaf = true
-       entry({"admin", "services", "travelmate", "wifiadd"}, cbi("travelmate/wifi_add", {hideresetbtn=true, hidesavebtn=true})).leaf = true
-       entry({"admin", "services", "travelmate", "wifiedit"}, cbi("travelmate/wifi_edit", {hideresetbtn=true, hidesavebtn=true})).leaf = true
-       entry({"admin", "services", "travelmate", "wifidelete"}, cbi("travelmate/wifi_delete", {hideresetbtn=true, hidesavebtn=true})).leaf = true
-       entry({"admin", "services", "travelmate", "wifiorder"}, cbi("travelmate/wifi_order", {hideresetbtn=true, hidesavebtn=true})).leaf = true
+       entry({"admin", "services", "travelmate", "wifiadd"}, form("travelmate/wifi_add", {hideresetbtn=true, hidesavebtn=true})).leaf = true
+       entry({"admin", "services", "travelmate", "wifiedit"}, form("travelmate/wifi_edit", {hideresetbtn=true, hidesavebtn=true})).leaf = true
+       entry({"admin", "services", "travelmate", "wifidelete"}, form("travelmate/wifi_delete", {hideresetbtn=true, hidesavebtn=true})).leaf = true
+       entry({"admin", "services", "travelmate", "wifiorder"}, form("travelmate/wifi_order", {hideresetbtn=true, hidesavebtn=true})).leaf = true
 end
 
 function logread()
index 991e75a7e47c1938c02e4db2d3ad441e8bdda4e7..f1adae28541aef960c49bc3b07f065de8feb4e7d 100644 (file)
@@ -30,22 +30,19 @@ if m.hidden.ssid == "" then
        wssid = m:field(Value, "ssid", translate("SSID (hidden)"))
 else
        wssid = m:field(Value, "ssid", translate("SSID"))
-       wssid.datatype = "rangelength(1,32)"
-       wssid.default = m.hidden.ssid or ""
 end
+wssid.datatype = "rangelength(1,32)"
+wssid.default = m.hidden.ssid or ""
 
-nobssid = m:field(Flag, "no_bssid", translate("Ignore BSSID"))
+bssid = m:field(Value, "bssid", translate("BSSID"),
+       translatef("The BSSID information '%s' is optional and only required for hidden networks", m.hidden.bssid or ""))
+bssid.datatype = "macaddr"
 if m.hidden.ssid == "" then
-       nobssid.default = nobssid.disabled
+       bssid.default = m.hidden.bssid or ""
 else
-       nobssid.default = nobssid.enabled
+       bssid.default = ""
 end
 
-bssid = m:field(Value, "bssid", translate("BSSID"))
-bssid:depends("no_bssid", 0)
-bssid.datatype = "macaddr"
-bssid.default = m.hidden.bssid or ""
-
 if (tonumber(m.hidden.wep) or 0) == 1 then
        encr = m:field(ListValue, "encryption", translate("Encryption"))
        encr:value("wep", "WEP")