diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-10-30 00:42:58 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-10-30 00:42:58 +0000 |
commit | 595020f919253e56758539d0c7155d490f73bfe6 (patch) | |
tree | bd4b9d7a0ccea98c09feb87ce85e7929e3ebbecc /libs/web/luasrc | |
parent | df01f3e431fc30bf164306653ce216b37d240fb6 (diff) |
libs/web: convert cbi widgets to new network model
Diffstat (limited to 'libs/web/luasrc')
-rw-r--r-- | libs/web/luasrc/view/cbi/network_ifacelist.htm | 10 | ||||
-rw-r--r-- | libs/web/luasrc/view/cbi/network_netlist.htm | 3 |
2 files changed, 7 insertions, 6 deletions
diff --git a/libs/web/luasrc/view/cbi/network_ifacelist.htm b/libs/web/luasrc/view/cbi/network_ifacelist.htm index 2f9821817..53a50e962 100644 --- a/libs/web/luasrc/view/cbi/network_ifacelist.htm +++ b/libs/web/luasrc/view/cbi/network_ifacelist.htm @@ -14,7 +14,6 @@ $Id$ <%+cbi/valueheader%> <%- - local utl = require "luci.util" local net = require "luci.model.network" local iface @@ -26,7 +25,7 @@ $Id$ if type(value) == "table" then value = table.concat(value, " ") end for value in value:gmatch("%S+") do checked[value] = true - end + end else local n = self.network and net:get_network(self.network) if n then @@ -39,13 +38,16 @@ $Id$ -%> <ul style="margin:0; list-style-type:none"> - <% for _, iface in utl.spairs(ifaces, function(a,b) return (ifaces[a]:type() < ifaces[b]:type()) end) do + <% for _, iface in ipairs(ifaces) do + local link = iface:adminlink() if not self.nobridges or not iface:is_bridge() then %> <li> <input class="cbi-input-<%=self.widget or "radio"%>" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "." .. iface:name()) .. attr("name", cbid) .. attr("value", iface:name()) .. ifattr(checked[iface:name()], "checked", "checked")%> /> <label<%=attr("for", cbid .. "." .. iface:name())%>> + <% if link then -%><a href="<%=link%>"><% end -%> <img title="<%=iface:get_type_i18n()%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" /> - <%=iface:get_i18n()%><% local n = iface:get_network(); if n then %> (<%=n:name()%>)<% end %> + <% if link then -%></a><% end -%> + <%=iface:get_i18n()%><% local n = iface:get_network(); if n then %> (<a href="<%=n:adminlink()%>"><%=n:name()%></a>)<% end %> </label> </li> <% end end %> diff --git a/libs/web/luasrc/view/cbi/network_netlist.htm b/libs/web/luasrc/view/cbi/network_netlist.htm index c47b3a70e..f5a6ce443 100644 --- a/libs/web/luasrc/view/cbi/network_netlist.htm +++ b/libs/web/luasrc/view/cbi/network_netlist.htm @@ -14,7 +14,6 @@ $Id$ <%+cbi/valueheader%> <%- - local utl = require "luci.util" local nwm = require "luci.model.network" local net, iface @@ -27,7 +26,7 @@ $Id$ -%> <ul style="margin:0; list-style-type:none; text-align:left"> - <% for _, net in utl.spairs(networks, function(a,b) return (networks[a]:name() < networks[b]:name()) end) do + <% for _, net in ipairs(networks) do if net:name() ~= "loopback" then %> <li style="padding:0.25em 0"> <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "." .. net:name()) .. attr("name", cbid) .. attr("value", net:name()) .. ifattr(value == net:name(), "checked", "checked")%> /> |