luci-app-travelmate: bugfix

* fix bug in interface wizard during initial setup
* cosmetics

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken 2017-08-05 18:57:20 +02:00
parent b110746b98
commit 4e80499a02
8 changed files with 14 additions and 11 deletions

View file

@ -12,6 +12,7 @@ end
m = SimpleForm("input", nil) m = SimpleForm("input", nil)
m:append(Template("travelmate/config_css")) m:append(Template("travelmate/config_css"))
m.submit = translate("Save")
m.reset = false m.reset = false
s = m:section(SimpleSection, nil, s = m:section(SimpleSection, nil,

View file

@ -12,6 +12,7 @@ end
m = SimpleForm("input", nil) m = SimpleForm("input", nil)
m:append(Template("travelmate/config_css")) m:append(Template("travelmate/config_css"))
m.submit = translate("Save")
m.reset = false m.reset = false
s = m:section(SimpleSection, nil, s = m:section(SimpleSection, nil,

View file

@ -12,6 +12,7 @@ end
m = SimpleForm("input", nil) m = SimpleForm("input", nil)
m:append(Template("travelmate/config_css")) m:append(Template("travelmate/config_css"))
m.submit = translate("Save")
m.reset = false m.reset = false
s = m:section(SimpleSection, nil, s = m:section(SimpleSection, nil,

View file

@ -14,6 +14,7 @@ end
m = SimpleForm("input", nil) m = SimpleForm("input", nil)
m:append(Template("travelmate/config_css")) m:append(Template("travelmate/config_css"))
m.submit = translate("Save")
m.reset = false m.reset = false
s = m:section(SimpleSection, nil, s = m:section(SimpleSection, nil,

View file

@ -35,20 +35,17 @@ if uplink == "" then
o.default = "trm_wwan" o.default = "trm_wwan"
o.rmempty = false o.rmempty = false
function o.write(self, section, value)
iface = o:formvalue(section)
uci:set("travelmate", section, "trm_iface", iface)
uci:save("travelmate")
uci:commit("travelmate")
end
btn = s:option(Button, "", translate("Create Uplink Interface"), btn = s:option(Button, "", translate("Create Uplink Interface"),
translate("Create a new wireless wan uplink interface, configure it to use dhcp and ") translate("Create a new wireless wan uplink interface, configure it to use dhcp and ")
.. translate("add it to the wan zone of the firewall. This step has only to be done once.")) .. translate("add it to the wan zone of the firewall. This step has only to be done once."))
btn.inputtitle = translate("Add Interface") btn.inputtitle = translate("Add Interface")
btn.inputstyle = "apply" btn.inputstyle = "apply"
btn.disabled = false btn.disabled = false
function btn.write() function btn.write(self, section, value)
iface = o:formvalue(section)
uci:set("travelmate", section, "trm_iface", iface)
uci:save("travelmate")
uci:commit("travelmate")
local net = nw:add_network(iface, { proto = "dhcp" }) local net = nw:add_network(iface, { proto = "dhcp" })
if net then if net then
nw:save("network") nw:save("network")

View file

@ -7,6 +7,7 @@ local http = require("luci.http")
local trmiface = uci.get("travelmate", "global", "trm_iface") or "trm_wwan" local trmiface = uci.get("travelmate", "global", "trm_iface") or "trm_wwan"
m = SimpleForm("add", translate("Add Wireless Uplink Configuration")) m = SimpleForm("add", translate("Add Wireless Uplink Configuration"))
m.submit = translate("Save")
m.cancel = translate("Back to overview") m.cancel = translate("Back to overview")
m.reset = false m.reset = false

View file

@ -6,6 +6,7 @@ local uci = require("luci.model.uci").cursor()
local http = require("luci.http") local http = require("luci.http")
m = SimpleForm("edit", translate("Edit Wireless Uplink Configuration")) m = SimpleForm("edit", translate("Edit Wireless Uplink Configuration"))
m.submit = translate("Save")
m.cancel = translate("Back to overview") m.cancel = translate("Back to overview")
m.reset = false m.reset = false

View file

@ -76,14 +76,14 @@ This is free software, licensed under the Apache License, Version 2.0
</table> </table>
</fieldset> </fieldset>
<div class="cbi-page-actions right"> <div class="cbi-page-actions right">
<form class="inline" action="<%=url('admin/services/travelmate/stations')%>" method="post">
<input class="cbi-button cbi-button-reset" type="submit" value="<%:Back to overview%>"/>
</form>
<form class="inline" action="<%=url('admin/services/travelmate/wifiscan')%>" method="post"> <form class="inline" action="<%=url('admin/services/travelmate/wifiscan')%>" method="post">
<input type="hidden" name="token" value="<%=token%>"/> <input type="hidden" name="token" value="<%=token%>"/>
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>"/> <input type="hidden" name="device" value="<%=utl.pcdata(dev)%>"/>
<input class="cbi-button cbi-input-find" type="submit" value="<%:Repeat scan%>"/> <input class="cbi-button cbi-input-find" type="submit" value="<%:Repeat scan%>"/>
</form> </form>
<form class="inline" action="<%=url('admin/services/travelmate/stations')%>" method="post">
<input class="cbi-button cbi-button-reset" type="submit" value="<%:Back to overview%>"/>
</form>
</div> </div>
</div> </div>