Allow combination of SimpleForms as Forms into pages with Maps
Allow subsequent changes of Table data
This commit is contained in:
parent
eb6f9c6192
commit
ad57125f41
2 changed files with 18 additions and 3 deletions
|
@ -644,6 +644,13 @@ function SimpleForm.get_scheme()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Form = class(SimpleForm)
|
||||||
|
|
||||||
|
function Form.__init__(self, ...)
|
||||||
|
SimpleForm.__init__(self, ...)
|
||||||
|
self.embedded = true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
AbstractSection
|
AbstractSection
|
||||||
|
@ -814,15 +821,16 @@ Table = class(AbstractSection)
|
||||||
|
|
||||||
function Table.__init__(self, form, data, ...)
|
function Table.__init__(self, form, data, ...)
|
||||||
local datasource = {}
|
local datasource = {}
|
||||||
|
local tself = self
|
||||||
datasource.config = "table"
|
datasource.config = "table"
|
||||||
self.data = data
|
self.data = data or {}
|
||||||
|
|
||||||
datasource.formvalue = Map.formvalue
|
datasource.formvalue = Map.formvalue
|
||||||
datasource.formvaluetable = Map.formvaluetable
|
datasource.formvaluetable = Map.formvaluetable
|
||||||
datasource.readinput = true
|
datasource.readinput = true
|
||||||
|
|
||||||
function datasource.get(self, section, option)
|
function datasource.get(self, section, option)
|
||||||
return data[section] and data[section][option]
|
return tself.data[section] and tself.data[section][option]
|
||||||
end
|
end
|
||||||
|
|
||||||
function datasource.submitstate(self)
|
function datasource.submitstate(self)
|
||||||
|
@ -862,6 +870,10 @@ function Table.cfgsections(self)
|
||||||
return sections
|
return sections
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Table.update(self, data)
|
||||||
|
self.data = data
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
|
|
@ -12,12 +12,13 @@ You may obtain a copy of the License at
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
-%>
|
-%>
|
||||||
|
<% if not self.embedded then %>
|
||||||
<form method="post" action="<%=REQUEST_URI%>">
|
<form method="post" action="<%=REQUEST_URI%>">
|
||||||
<div>
|
<div>
|
||||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||||
<input type="hidden" name="cbi.submit" value="1" />
|
<input type="hidden" name="cbi.submit" value="1" />
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
<div class="cbi-map" id="cbi-<%=self.config%>">
|
<div class="cbi-map" id="cbi-<%=self.config%>">
|
||||||
<h2><a id="content" name="content"><%=self.title%></a></h2>
|
<h2><a id="content" name="content"><%=self.title%></a></h2>
|
||||||
<div class="cbi-map-descr"><%=self.description%></div>
|
<div class="cbi-map-descr"><%=self.description%></div>
|
||||||
|
@ -30,6 +31,7 @@ $Id$
|
||||||
<%- if self.errmessage then %>
|
<%- if self.errmessage then %>
|
||||||
<div class="error"><%=self.errmessage%></div>
|
<div class="error"><%=self.errmessage%></div>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
<% if not self.embedded then %>
|
||||||
<div>
|
<div>
|
||||||
<%- if self.submit ~= false then %>
|
<%- if self.submit ~= false then %>
|
||||||
<input class="cbi-button-save" type="submit" value="
|
<input class="cbi-button-save" type="submit" value="
|
||||||
|
@ -44,3 +46,4 @@ $Id$
|
||||||
<script type="text/javascript">cbi_d_update();</script>
|
<script type="text/javascript">cbi_d_update();</script>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<% end %>
|
||||||
|
|
Loading…
Reference in a new issue