ffluci.template.render(self.template, {self=self})
end
+function Node.render_children(self)
+ for k, node in ipairs(self.children) do
+ node:render()
+ end
+end
+
--[[
Map - A map describing a configuration file
self.valid = nil
end
+function TypedSection.render_children(self, section)
+ for k, node in ipairs(self.children) do
+ node.section = section
+ node:render()
+ end
+end
+
+function TypedSection.ucisections(self)
+ local sections = {}
+ for k, v in pairs(self.map:read()) do
+ if v[".type"] == self.sectiontype then
+ sections[k] = v
+ end
+ end
+ return sections
+end
+
--[[
AbstractValue - An abstract Value Type
local tmpl = require("ffluci.template")
local cbi = require("ffluci.cbi")
+ local path = request.category.."_"..request.module.."/"..request.action
+
i18n.loadc(request.module)
- stat, map = pcall(cbi.load, request.module.."/"..request.action)
+ stat, map = pcall(cbi.load, path)
if stat then
- tmpl.render("header")
+ tmpl.render("cbi/header")
map:render()
- tmpl.render("footer")
+ tmpl.render("cbi/footer")
else
disp.error404()
end
return
end
- if pcall(tmpl.render, request.module .. "/" .. request.action) then
+ local path = request.category.."_"..request.module.."/"..request.action
+ if pcall(tmpl.render, path) then
return
end
- stat, map = pcall(cbi.load, request.module.."/"..request.action)
+ stat, map = pcall(cbi.load, path)
if stat then
- tmpl.render("header")
+ tmpl.render("cbi/header")
map:render()
- tmpl.render("footer")
+ tmpl.render("cbi/footer")
return
end
local tmpl = require("ffluci.template")
local disp = require("ffluci.dispatcher")
+ local path = request.category.."_"..request.module.."/"..request.action
+
i18n.loadc(request.module)
- if not pcall(tmpl.render, request.module .. "/" .. request.action) then
+ if not pcall(tmpl.render, path) then
disp.error404()
end
end
\ No newline at end of file
--- /dev/null
+ </form>
+<%+footer%>
\ No newline at end of file
--- /dev/null
+<%+header%>
+ <form method="post" action="<%=os.getenv("REQUEST_URI")%>">
- <div class="cbi-map" id="cbi-<%=self.config%>">
- <form method="post" action="<%=os.getenv("REQUEST_URI")%>">
+ <div class="cbi-map" id="cbi-<%=self.config%>">
<h1><%=self.title%></h1>
<div class="cbi-map-descr"><%=self.description%></div>
<br />
-<% for k, node in ipairs(self.children) do node:render() end %>
+<% self:render_children() %>
<br />
<input type="submit" /> <input type="reset" />
- </form>
- </div>
+ </div>
<h2><%=self.title%></h2>
<div class="cbi-nsection-descr"><%=self.description%></div>
<div class="cbi-nsection-options">
-<% for k, node in ipairs(self.children) do node:render() end %>
+<% self:render_children() %>
</div>
</div>
-<%
-local allsections = self.map:read()
-local sections = {}
-for k, v in pairs(allsections) do
- if v[".type"] == self.sectiontype then
- sections[k] = v
- end
-end
-%>
<div class="cbi-tsection" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
<h2><%=self.title%></h2>
<div class="cbi-tsection-descr"><%=self.description%></div>
-<% for k, v in pairs(sections) do %>
- <div class="cbi-tsection-node" id="cbi-<%=self.config%>-<%=k%>">
-<% for i, node in ipairs(self.children) do
- node.section = k
- node:render()
-end %>
- </div>
+<% for k, v in pairs(self:ucisections()) do%>
+ <fieldset class="cbi-tsection-node" id="cbi-<%=self.config%>-<%=k%>">
+ <% if not self.anonymous then %><legend><%=k%></legend><% end %>
+<% self:render_children(k) %>
+ </fieldset>
+ <br />
<% end %>
</div>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" />
+<link rel="stylesheet" type="text/css" href="<%=media%>/css/<%=req.category%>_<%=req.module%>.css" />
<title>FFLuCI</title>
<% if addheaders then write(addheaders) end %>
</head>
<div>Konfiguration<ul><li>x Änderungen</li><li>Anwenden</li><li>Zurücksetzen</li></ul></div>
<% end %>
</div>
- <div id="content">
+ <div id="content">
\ No newline at end of file
+++ /dev/null
-<%+header%>
-<h1><%:hello Hallo!%></h1>
-<p><%:welcome1 Dies ist der Funknetzknoten %>
-<em><%=require("ffluci.sys").hostname()%></em>!</p>
-<p><em>ToDo: Intelligenter Einleitungstext</em></p>
-<%+footer%>
\ No newline at end of file
--- /dev/null
+<%+header%>
+<h1><%:hello Hallo!%></h1>
+<p><%:welcome1 Dies ist der Funknetzknoten %>
+<em><%=require("ffluci.sys").hostname()%></em>!</p>
+<p><em>ToDo: Intelligenter Einleitungstext</em></p>
+<%+footer%>
\ No newline at end of file