+-- UCI stateget
+function Map.stateget(self, section, option)
+ return uci.get_statevalue(self.config, section, option)
+end
+
+
+--[[
+SimpleForm - A Simple non-UCI form
+]]--
+SimpleForm = class(Node)
+
+function SimpleForm.__init__(self, config, title, description, data)
+ Node.__init__(self, title, description)
+ self.config = config
+ self.data = data or {}
+ self.template = "cbi/simpleform"
+ self.dorender = true
+end
+
+function SimpleForm.parse(self, ...)
+ Node.parse(self, 1, ...)
+
+ local valid = true
+ for i, v in ipairs(self.children) do
+ valid = valid and not v.tag_missing[1] and not v.tag_invalid[1]
+ end
+
+ local state =
+ not luci.http.formvalue("cbi.submit") and 0
+ or valid and 1
+ or -1
+
+ self.dorender = self:handle(state)
+end
+
+function SimpleForm.render(self, ...)
+ if self.dorender then
+ Node.render(self, ...)
+ end
+end
+
+-- Creates a child section
+function SimpleForm.field(self, class, ...)
+ if instanceof(class, AbstractValue) then
+ local obj = class(self, ...)
+ self:append(obj)
+ return obj
+ else
+ error("class must be a descendent of AbstractValue")
+ end
+end
+
+function SimpleForm.set(self, section, option, value)
+ self.data[option] = value
+end
+
+
+function SimpleForm.del(self, section, option)
+ self.data[option] = nil
+end
+
+
+function SimpleForm.get(self, section, option)
+ return self.data[option]
+end
+
+