On Mon, 2012-03-05 at 19:30 +0100, Łukasz Kwestarz wrote:
> Patch fixes also issue with order of options with dependencies.
> Please as previous patch, review it carefully, it was my first time with 
> lua:).
> 
> Signed-off-by: Łukasz Kwestarz <kwest...@me.com>
> 
> Index: modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
> ===================================================================
> --- modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua        (wersja 
> 8324)
> +++ modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua        (kopia 
> robocza)
> @@ -316,12 +316,19 @@
>               tp:value(p.driver_dbm, "%i dBm (%i mW)"
>                       %{ p.display_dbm, p.display_mw })
>       end
> +     
> +     band = s:taboption("advanced", ListValue, "band", translate("Radio 
> Band"))
> +     if hw_modes.b or hw_modes.g then band:value("b", "2.4 GHz") end
> +     if hw_modes.a then band:value("a", "5 GHz") end
>  
>       mode = s:taboption("advanced", ListValue, "hwmode", translate("Mode"))
> -     mode:value("11bg", "802.11b+g")
> -     mode:value("11b", "802.11b")
> -     mode:value("11g", "802.11g")
> -     mode:value("11gst", "802.11g + Turbo")
> +     mode:value("auto", "Auto")
> +     if hw_modes.a then mode:value("11a", "802.11a", {band="a"}) end
> +     if hw_modes.b then mode:value("11b", "802.11b", {band="b"}) end
> +     if hw_modes.g then mode:value("11g", "802.11g", {band="b"}) end
> +     if hw_modes.g then mode:value("11gst", "802.11g + Turbo", {band="b"}) 
> end
> +     if hw_modes.n and hw_modes.b and hw_modes.g then mode:value("11bg", 
> "802.11b+g", {band="b"}) end
Shouldn't the "hw_modes.n" condition be removed from the line above so
it handles both cases (w/ and w/o 11n)?
> +     if hw_modes.n then mode:value("11n", "802.11n") end
>  
>       ant1 = s:taboption("advanced", ListValue, "txantenna", 
> translate("Transmitter Antenna"))
>       ant1.widget = "radio"
> Index: libs/web/luasrc/view/cbi/full_valuefooter.htm
> ===================================================================
> --- libs/web/luasrc/view/cbi/full_valuefooter.htm     (wersja 8324)
> +++ libs/web/luasrc/view/cbi/full_valuefooter.htm     (kopia robocza)
> @@ -33,7 +33,7 @@
>               <%-
>                       end
>               -%>
> -                     }, 
> "cbip-<%=self.config.."-"..section.."-"..self.option..d.add%>");
> +                     }, <%=d.next and 
> '"cbi-'..self.config.."-"..section.."-"..self.option..d.next..'"' or 
> "null"%>);
>               <%- end %>
>               <% for j, d in ipairs(self.deps) do -%>
>                       
> cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option..d.add%>", {
> Index: libs/web/luasrc/cbi.lua
> ===================================================================
> --- libs/web/luasrc/cbi.lua   (wersja 8324)
> +++ libs/web/luasrc/cbi.lua   (kopia robocza)
> @@ -1579,9 +1579,31 @@
>       val = val or key
>       table.insert(self.keylist, tostring(key))
>       table.insert(self.vallist, tostring(val))
> +     
> +     depends = select("#", ...) > 0
> +     for i, subdep in ipairs(self.subdeps) do
> +             if not subdep.next then
> +                     if not depends then
> +                             subdep.next = "-"..key
> +                     else
> +                             for j, deps in ipairs({...}) do
> +                                     equal = true;
> +                                     for k, v in pairs(deps) do
> +                                             if subdep.deps[k] ~= v then
> +                                                     equal = false
> +                                                     break
> +                                             end
> +                                     end
> +                                     if equal then
> +                                             subdep.next = "-"..key
> +                                     end
> +                             end
> +                     end     
> +             end
> +     end
>  
>       for i, deps in ipairs({...}) do
> -             self.subdeps[#self.subdeps + 1] = {add = "-"..key, deps=deps}
> +             self.subdeps[#self.subdeps + 1] = {add = "-"..key, deps = deps}
>       end
>  end
>  
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to