From 7f26be36281f03ad11642cbfede5efa99fd22f66 Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Sat, 30 May 2015 22:53:11 +0200 Subject: [PATCH] applications/olsr: change config file download on olsr overview page to use seperate v4 and v6 config files --- .../luasrc/view/status-olsr/overview.htm | 37 +++++++++++++--------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm index 0a81d17b4..fa3231528 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm @@ -6,7 +6,9 @@ -%> <% -local ipv = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion", "4") + +has_ipv4_conf = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion") +has_ipv6_conf = luci.model.uci.cursor():get_first("olsrd6", "olsrd", "IpVersion") function write_conf(conf, file) local fs = require "nixio.fs" @@ -19,23 +21,23 @@ end conf = luci.http.formvalue() -if conf.openwrt then +if conf.openwrt_v4 then write_conf("/etc/config/olsrd", "olsrd") return false end -if conf.conf_v4 then - write_conf("/var/etc/olsrd.conf.ipv4", "olsrd.conf.ipv4") +if conf.openwrt_v6 then + write_conf("/etc/config/olsrd6", "olsrd6") return false end -if conf.conf_v6 then - write_conf("/var/etc/olsrd.conf.ipv6", "olsrd.conf.ipv6") +if conf.conf_v4 then + write_conf("/var/etc/olsrd.conf", "olsrd.conf") return false end -if conf.conf then - write_conf("/var/etc/olsrd.conf", "olsrd.conf") +if conf.conf_v6 then + write_conf("/var/etc/olsrd6.conf", "olsrd6.conf") return false end @@ -200,13 +202,18 @@ XHR.poll(10, '<%=REQUEST_URI%>/json', { }, - <%:Download Config%> - OpenWrt, - <% if ipv == "6and4" then %> - OLSRD IPv4, - OLSRD IPv6 - <% else %> - OLSRD - <% end %> + <% if has_ipv4_conf then %> + OpenWrt (IPv4), + <% end %> + <% if has_ipv6_conf then %> + OpenWrt (IPv6), + <% end %> + <% if has_ipv4_conf then %> + OLSRD (IPv4), + <% end %> + <% if has_ipv6_conf then %> + OLSRD (IPv6) + <% end %> -- 2.11.0