summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-13 01:24:44 +0000
committerSteven Barth <steven@midlink.org>2008-08-13 01:24:44 +0000
commit07fdaa87dbac0582960cded4e9aa981d4a141782 (patch)
tree158e9c66902494de736ea282b216a374ba01f516 /libs
parent0e3fda59e094a272bafc43b67e6393dc6f2b279e (diff)
modules/admin-full: Network interface configuration optimization part #1
Diffstat (limited to 'libs')
-rw-r--r--libs/cbi/htdocs/luci-static/resources/cbi/edit.gifbin0 -> 280 bytes
-rw-r--r--libs/cbi/htdocs/luci-static/resources/cbi/remove.gifbin0 -> 385 bytes
-rw-r--r--libs/cbi/luasrc/view/cbi/editlink.htm18
-rw-r--r--libs/cbi/luasrc/view/cbi/tblsection.htm38
-rw-r--r--libs/sys/luasrc/sys.lua15
5 files changed, 42 insertions, 29 deletions
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/edit.gif b/libs/cbi/htdocs/luci-static/resources/cbi/edit.gif
new file mode 100644
index 000000000..7b02b6e72
--- /dev/null
+++ b/libs/cbi/htdocs/luci-static/resources/cbi/edit.gif
Binary files differ
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/remove.gif b/libs/cbi/htdocs/luci-static/resources/cbi/remove.gif
new file mode 100644
index 000000000..bf43a0a0b
--- /dev/null
+++ b/libs/cbi/htdocs/luci-static/resources/cbi/remove.gif
Binary files differ
diff --git a/libs/cbi/luasrc/view/cbi/editlink.htm b/libs/cbi/luasrc/view/cbi/editlink.htm
deleted file mode 100644
index 83260e437..000000000
--- a/libs/cbi/luasrc/view/cbi/editlink.htm
+++ /dev/null
@@ -1,18 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
-
-<%+cbi/valueheader%>
-<a href="<%=REQUEST_URI%>/<%=section%>"><%:edit%></a>
-<%+cbi/valuefooter%>
diff --git a/libs/cbi/luasrc/view/cbi/tblsection.htm b/libs/cbi/luasrc/view/cbi/tblsection.htm
index acaf6693e..46f7e5115 100644
--- a/libs/cbi/luasrc/view/cbi/tblsection.htm
+++ b/libs/cbi/luasrc/view/cbi/tblsection.htm
@@ -21,36 +21,52 @@ $Id$
<%- local count = 0 -%>
<table class="cbi-section-table">
<tr class="cbi-section-table-titles">
+ <%- if not self.anonymous then -%>
+ <th>&nbsp;</th>
+ <%- end -%>
<%- for i, k in pairs(self.children) do -%>
<th class="cbi-section-table-cell"><%=k.title%></th>
+ <%- count = count + 1; end; if self.extedit then -%>
+ <th class="cbi-section-table-cell">&nbsp;</th>
<%- count = count + 1; end; if self.addremove then -%>
<th class="cbi-section-table-cell">&nbsp;</th>
<%- count = count + 1; end -%>
</tr>
<tr class="cbi-section-table-descr">
+ <%- if not self.anonymous then -%>
+ <th>&nbsp;</th>
+ <%- end -%>
<%- for i, k in pairs(self.children) do -%>
<th class="cbi-section-table-cell"><%=k.description%></th>
+ <%- end; if self.extedit then -%>
+ <th class="cbi-section-table-cell">&nbsp;</th>
<%- end; if self.addremove then -%>
<th class="cbi-section-table-cell">&nbsp;</th>
<%- end -%>
</tr>
<%- local isempty = true
for i, k in ipairs(self:cfgsections()) do
- if not self.anonymous then
- -%>
- <tr class="cbi-section-table-title">
- <th colspan="<%=count%>"><h3><%=k%></h3></th>
- </tr>
- <%- end
section = k
isempty = false
scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
-%>
<tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
+ <% if not self.anonymous then -%>
+ <th><h3><%=k%></h3></th>
+ <%- end %>
<%-+cbi/ucisection-%>
+ <%- if self.extedit or self.addremove then -%>
+ <td class="cbi-section-table-cell">
+ <%- if self.extedit then -%>
+ <a href="<%=self.extedit:format(section)%>"><img style="border: none" src="<%=resource%>/cbi/edit.gif" alt="<%:edit%>" /></a>
+ <%- end; if self.addremove then %>
+ <button class="clean" type="submit" value="1" name="cbi.rts.<%=self.config%>.<%=k%>" title="<%:delete%>"><img src="<%=resource%>/cbi/remove.gif" alt="<%:delete%>" /></button>
+ <%- end -%>
+ </td>
+ <%- end -%>
<%- if self.addremove then -%>
<td class="cbi-section-table-cell">
- <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="X" title="<%:delete%>" />
+
</td>
<%- end -%>
</tr>
@@ -61,9 +77,10 @@ $Id$
<td colspan="<%=count%>"><em><br /><%:cbi_sectempty%></em></td>
</tr>
<%- end -%>
-
+ </table>
<%- if self.addremove then -%>
- <tr class="cbi-section-table-row">
+ <br />
+ <div class="cbi-section-table-row">
<td colspan="<%=count%>" class="cbi-section-table-optionals">
<div class="cbi-section-create">
<% if self.anonymous then %>
@@ -78,9 +95,8 @@ $Id$
<% end %>
</div>
</td>
- </tr>
+ </div>
<%- end -%>
- </table>
</div>
</div>
<!-- /tblsection -->
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua
index 56beafe94..c8d7a5477 100644
--- a/libs/sys/luasrc/sys.lua
+++ b/libs/sys/luasrc/sys.lua
@@ -212,6 +212,21 @@ function net.devices()
return devices
end
+
+--- Return information about available network interfaces.
+-- @return Table containing all current interface names and their information
+function net.deviceinfo()
+ local devices = {}
+ for line in io.lines("/proc/net/dev") do
+ local name, data = line:match("^ *(.-): *(.*)$")
+ if name and data then
+ devices[name] = luci.util.split(data, " +", nil, true)
+ end
+ end
+ return devices
+end
+
+
-- Determine the MAC address belonging to the given IP address.
-- @param ip IPv4 address
-- @return String containing the MAC address or nil if it cannot be found