.cbi-optionals select, .cbi-optionals input,
.cbi-section-remove input, .cbi-section-create input {
font-size: 0.8em;
+ margin: 0%;
}
.cbi-value-description {
local func, err = loadfile(cbidir..cbimap..".lua")
if not func then
- error(err)
return nil
end
+ ffluci.i18n.loadc("cbi")
+
ffluci.util.resfenv(func)
ffluci.util.updfenv(func, ffluci.cbi)
ffluci.util.extfenv(func, "translate", ffluci.i18n.translate)
return nil
end
- ffluci.i18n.loadc("cbi")
-
return map
end
function Map.add(self, sectiontype)
local name = self.uci:add(self.config, sectiontype)
if name then
- self.ucidata[name] = self.uci:show(self.config, name)
+ self.ucidata[name] = {}
+ self.ucidata[name][".type"] = sectiontype
end
return name
end
if active then
AbstractSection.parse_dynamic(self, s)
- Node.parse(self, s)
+ if ffluci.http.formvalue("cbi.submit") then
+ Node.parse(self, s)
+ end
AbstractSection.parse_optionals(self, s)
end
end
self.deps = {}
self.excludes = {}
- self.anonymous = false
+ self.anonymous = false
end
-- Return all matching UCI sections for this TypedSection
for k, v in pairs(self:cfgsections()) do
AbstractSection.parse_dynamic(self, k)
- Node.parse(self, k)
+ if ffluci.http.formvalue("cbi.submit") then
+ Node.parse(self, k)
+ end
AbstractSection.parse_optionals(self, k)
end
end
if fvalue and not (fvalue == self:cfgvalue(section)) then
self:write(section, fvalue)
end
- elseif ffluci.http.formvalue("cbi.submit") then -- Unset the UCI or error
+ else -- Unset the UCI or error
if self.rmempty or self.optional then
self:remove(section)
end
end
+-- DummyValue - This does nothing except being there
+DummyValue = class(AbstractValue)
+
+function DummyValue.__init__(self, map, ...)
+ AbstractValue.__init__(self, map, ...)
+ self.template = "cbi/dvalue"
+ self.value = nil
+end
+
+function DummyValue.parse(self)
+
+end
+
+function DummyValue.render(self, s)
+ ffluci.template.render(self.template, {self=self, section=s})
+end
+
--[[
Flag - A flag being enabled or disabled
-- A flag can only have two states: set or unset
function Flag.parse(self, section)
- self.default = self.enabled
local fvalue = self:formvalue(section)
if fvalue then
-module(..., package.seeall)
+module("ffluci.controller.admin.index", package.seeall)
menu = {
descr = "Übersicht",
--- /dev/null
+module("ffluci.controller.admin.mesh", package.seeall)
+
+menu = {
+ descr = "Mesh",
+ order = 50,
+ entries = {
+ {action = "olsrd", descr = "OLSR"},
+ }
+}
\ No newline at end of file
menu = {
descr = "Netzwerk",
- order = 20,
+ order = 30,
entries = {
- {action = "vlan", descr = "VLAN"},
+ {action = "vlan", descr = "Switch"},
{action = "ifaces", descr = "Schnittstellen"},
{action = "ptp", descr = "PPPoE / PPTP"},
}
--- /dev/null
+module("ffluci.controller.admin.system", package.seeall)
+
+require("ffluci.util")
+require("ffluci.http")
+
+menu = {
+ descr = "System",
+ order = 20,
+ entries = {
+ {action = "passwd", descr = "Passwort"},
+ }
+}
+
+function action_passwd()
+ local p1 = ffluci.http.formvalue("pwd1")
+ local p2 = ffluci.http.formvalue("pwd2")
+ local msg = nil
+ local cm
+
+ if p1 or p2 then
+ cm = "(echo '"..p1.."';sleep 1;echo '"..p2.."') | passwd root 2>&1"
+ msg = ffluci.util.exec(cm)
+ end
+
+ ffluci.template.render("admin_system/passwd", {msg=msg})
+end
\ No newline at end of file
for k, v in pairs(apply) do
local cmd = ffluci.config.uci_oncommit[k]
if cmd then
- output = output .. ffluci.util.exec(cmd)
+ output = output .. cmd .. ":" .. ffluci.util.exec(cmd)
end
end
end
--- /dev/null
+module("ffluci.controller.admin.wifi", package.seeall)
+
+menu = {
+ descr = "Drahtlos",
+ order = 40,
+ entries = {
+ {action = "devices", descr = "Geräte"},
+ {action = "networks", descr = "Netze"},
+ }
+}
\ No newline at end of file
i18n.loadc(request.module)
local stat, map = pcall(cbi.load, path)
- if stat then
+ if stat and map then
local stat, err = pcall(map.parse, map)
if not stat then
disp.error500(err)
tmpl.render("cbi/header")
map:render()
tmpl.render("cbi/footer")
+ elseif not stat then
+ disp.error500(map)
else
disp.error404()
end
end
local stat, map = pcall(cbi.load, path)
- if stat then
+ if stat and map then
local stat, err = pcall(map.parse, map)
if not stat then
disp.error500(err)
map:render()
tmpl.render("cbi/footer")
return
+ elseif not stat then
+ disp.error500(map)
+ return
end
disp.error404()
function formvalue(key, default)
local c = formvalues()
- for match in key:gmatch("%w+") do
+ for match in key:gmatch("[%w-_]+") do
c = c[match]
if c == nil then
return default
p:value("dhcp", "DHCP")
p.default = "static"
+br = s:option(Flag, "type", "Netzwerkbrücke", "überbrückt angegebene Schnittstelle(n)")
+br.enabled = "bridge"
+br.rmempty = true
+
s:option(Value, "ifname", "Schnittstelle")
s:option(Value, "ipaddr", "IP-Adresse")
mtu.optional = true
mtu.isinteger = true
+mac = s:option(Value, "macaddr", "MAC-Adresse")
+mac.optional = true
+
return m
\ No newline at end of file
--- /dev/null
+-- ToDo: Translate, Add descriptions and help texts
+require("ffluci.util")
+
+m = Map("wireless", "Geräte")
+
+s = m:section(TypedSection, "wifi-device")
+--s.addremove = true
+
+en = s:option(Flag, "disabled", "Aktivieren")
+en.enabled = "0"
+en.disabled = "1"
+
+t = s:option(ListValue, "type", "Typ")
+t:value("broadcom")
+t:value("atheros")
+t:value("mac80211")
+t:value("prism2")
+--[[
+local c = ". /etc/functions.sh;for i in /lib/wifi/*;do . $i;done;echo $DRIVERS"
+for driver in ffluci.util.execl(c)[1]:gmatch("[^ ]+") do
+ t:value(driver)
+end
+]]--
+
+mode = s:option(ListValue, "mode", "Modus")
+mode:value("", "standard")
+mode:value("11b", "802.11b")
+mode:value("11g", "802.11g")
+mode:value("11a", "802.11a")
+mode:value("11bg", "802.11b+g")
+mode.rmempty = true
+
+s:option(Value, "channel", "Funkkanal")
+
+s:option(Value, "txantenna", "Sendeantenne").rmempty = true
+
+s:option(Value, "rxantenna", "Empfangsantenne").rmempty = true
+
+s:option(Value, "distance", "Distanz",
+ "Distanz zum am weitesten entfernten Funkpartner (m)").rmempty = true
+
+s:option(Value, "diversity", "Diversität"):depends("type", "atheros")
+
+country = s:option(Value, "country", "Ländercode")
+country.optional = true
+country:depends("type", "broadcom")
+
+maxassoc = s:option(Value, "maxassoc", "Verbindungslimit")
+maxassoc:depends("type", "broadcom")
+maxassoc.optional = true
+
+return m
\ No newline at end of file
--- /dev/null
+-- ToDo: Translate, Add descriptions and help texts
+m = Map("wireless", "Netze")
+
+s = m:section(TypedSection, "wifi-iface")
+s.addremove = true
+s.anonymous = true
+
+s:option(Value, "ssid", "Netzkennung (ESSID)").maxlength = 32
+
+device = s:option(ListValue, "device", "Gerät")
+for k, v in pairs(ffluci.model.uci.show("wireless").wireless) do
+ if v[".type"] == "wifi-device" then
+ device:value(k)
+ end
+end
+
+network = s:option(ListValue, "network", "Netzwerk")
+network:value("")
+for k, v in pairs(ffluci.model.uci.show("network").network) do
+ if v[".type"] == "interface" then
+ network:value(k)
+ end
+end
+
+mode = s:option(ListValue, "mode", "Modus")
+mode:value("ap", "Access Point")
+mode:value("adhoc", "Ad-Hoc")
+mode:value("sta", "Client")
+mode:value("wds", "WDS")
+
+s:option(Value, "bssid", "BSSID").optional = true
+
+s:option(Value, "txpower", "Sendeleistung", "dbm").rmempty = true
+
+encr = s:option(ListValue, "encryption", "Verschlüsselung")
+encr:value("none", "keine")
+encr:value("wep", "WEP")
+encr:value("psk", "WPA-PSK")
+encr:value("wpa", "WPA-Radius")
+encr:value("psk2", "WPA2-PSK")
+encr:value("wpa2", "WPA2-Radius")
+
+key = s:option(Value, "key", "Schlüssel")
+key:depends("encryption", "wep")
+key:depends("encryption", "psk")
+key:depends("encryption", "wpa")
+key:depends("encryption", "psk2")
+key:depends("encryption", "wpa2")
+key.rmempty = true
+
+server = s:option(Value, "server", "Radius-Server")
+server:depends("encryption", "wpa")
+server:depends("encryption", "wpa2")
+server.rmempty = true
+
+port = s:option(Value, "port", "Radius-Port")
+port:depends("encryption", "wpa")
+port:depends("encryption", "wpa2")
+port.rmempty = true
+
+s:option(Flag, "isolate", "AP-Isolation", "Unterbindet Client-Client-Verkehr").optional = true
+
+s:option(Flag, "hidden", "ESSID verstecken").optional = true
+
+
+
+return m
\ No newline at end of file
-- Returns the hostname
function hostname()
- return ffluci.fs.readfilel("/proc/sys/kernel/hostname")[1]
+ return io.lines("/proc/sys/kernel/hostname")()
end
-- Returns the load average
function loadavg()
- local loadavg = ffluci.fs.readfilel("/proc/loadavg")[1]
+ local loadavg = io.lines("/proc/loadavg")()
return loadavg:match("^(.-) (.-) (.-) (.-) (.-)$")
+end
+
+-- Returns all available network interfaces
+function net_devices()
+ local devices = {}
+ for line in io.lines("/proc/net/dev") do
+ table.insert(devices, line:match(" *(.-):"))
+ end
+ return devices
end
\ No newline at end of file
--- /dev/null
+<%+header%>
+<%+footer%>
\ No newline at end of file
--- /dev/null
+<%+header%>
+<h1><%:system System%></h1>
+<h2><%:changepw Passwort ändern%></h2>
+<div><br />
+<% if msg then %>
+ <code><%=msg%></code>
+<% else %>
+ <form method="post" action="<%=controller%>/admin/system/passwd">
+ <input type="password" name="pwd1" /> <%:password Passwort%><br />
+ <input type="password" name="pwd2" /> <%:confirmation Bestätigung%><br />
+ <input type="submit" value="<%:save Speichern%>" />
+ </form>
+<% end %>
+</div>
+<%+footer%>
\ No newline at end of file
--- /dev/null
+<%+header%>
+<%+footer%>
\ No newline at end of file
--- /dev/null
+<%+cbi/valueheader%>
+<% if self.value then
+ if type(self.value) == "function" then %>
+ <%=self:value(section)%>
+<% else %>
+ <%=self.value%>
+<% end
+else %>
+ <%=(self:cfgvalue(section) or "")%>
+<% end %>
+
+<%+cbi/valuefooter%>
<% if self.addremove then %>
<div class="cbi-section-create">
<% if self.anonymous then %>
- <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add Eintrag hinzufügen%>" />
- <% else %><input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
- <input type="submit" value="<%:cbi_add Eintrag hinzufügen%>" />
+ <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add Eintrag hinzufügen%>" />
+ <% else %>
+ <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <input type="submit" value="<%:cbi_add Eintrag hinzufügen%>" />
<% end %><% if self.err_invalid then %><div class="cbi-error"><%:cbi_invalid Fehler: Ungültige Eingabe%></div><% end %>
</div>
<% end %>
<%+cbi/valueheader%>
- <input type="text" onchange="cbi_d_update(this.id)" <% if self.size then %>size="<%=self.size%>" <% end %><% if self.maxlength then %>maxlength="<%=self.maxlength%>" <% end %>name="cbid.<%=self.config.."."..section.."."..self.option%>" value="<%=(self:cfgvalue(section) or "")%>" />
+ <input type="text" onchange="cbi_d_update(this.id)" <% if self.size then %>size="<%=self.size%>" <% end %><% if self.maxlength then %>maxlength="<%=self.maxlength%>" <% end %>name="cbid.<%=self.config.."."..section.."."..self.option%>" id="cbid.<%=self.config.."."..section.."."..self.option%>" value="<%=(self:cfgvalue(section) or "")%>" />
<%+cbi/valuefooter%>