if name then
self.ucidata[name] = {}
self.ucidata[name][".type"] = sectiontype
+ table.insert(self.ucidata[".order"], name)
end
return name
end
self.ucidata[section] = {}
end
self.ucidata[section][".type"] = val
+ table.insert(self.ucidata[".order"], section)
end
end
return stat
-- Return all matching UCI sections for this TypedSection
function TypedSection.cfgsections(self)
local sections = {}
- for k, v in pairs(self.map:get()) do
- if v[".type"] == self.sectiontype then
+ local map = self.map:get()
+ for i, k in pairs(map[".order"]) do
+ if map[k][".type"] == self.sectiontype then
if self:checkscope(k) then
- sections[k] = v
+ table.insert(sections, k)
end
end
end
end
end
- for k, v in pairs(self:cfgsections()) do
+ for i, k in ipairs(self:cfgsections()) do
AbstractSection.parse_dynamic(self, k)
if ffluci.http.formvalue("cbi.submit") then
Node.parse(self, k)
return nil, res[1]
end
- table = {}
+ tbl = {}
for k,line in pairs(res) do
c, s, t = line:match("^([^.]-)%.([^.]-)=(.-)$")
if c then
- table[c] = table[c] or {}
- table[c][s] = {}
- table[c][s][".type"] = t
+ tbl[c] = tbl[c] or {}
+ tbl[c][".order"] = tbl[c][".order"] or {}
+
+ tbl[c][s] = {}
+ table.insert(tbl[c][".order"], s)
+ tbl[c][s][".type"] = t
end
c, s, o, v = line:match("^([^.]-)%.([^.]-)%.([^.]-)=(.-)$")
if c then
- table[c][s][o] = v
+ tbl[c][s][o] = v
end
end
- return table
+ return tbl
end
-- Build path (config.section.option=value) and prevent command injection
<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
<h2><%=self.title%></h2>
<div class="cbi-section-descr"><%=self.description%></div>
-<% for k, v in pairs(self:cfgsections()) do%>
+<% for i, k in ipairs(self:cfgsections()) do%>
<% if self.addremove then %><div class="cbi-section-remove right">
<input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:cbi_del Eintrag entfernen%>" />
</div><% end %>