improve records field; allow explicit inclusion of fields in schema factory
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3647 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
c88082e338
commit
07ef19a946
2 changed files with 43 additions and 14 deletions
|
@ -77,9 +77,12 @@ class SchemaFactory(object):
|
|||
fieldMapping = self.fieldMapping
|
||||
fields = []
|
||||
omit = kw.pop('omit', [])
|
||||
include = kw.pop('include', [])
|
||||
for fname in schema.getFieldNamesInOrder(interface):
|
||||
if fname in omit:
|
||||
continue
|
||||
if include and fname not in include:
|
||||
continue
|
||||
field = interface[fname]
|
||||
info = fieldMapping.get(field.__class__)
|
||||
f = createField(field, info)
|
||||
|
|
|
@ -39,30 +39,56 @@
|
|||
|
||||
|
||||
<metal:input define-macro="input_records"
|
||||
tal:define="fieldInstance python: field.getFieldInstance(view.instance);
|
||||
columns fieldInstance/columnTypes">
|
||||
<table>
|
||||
tal:define="fieldInstance python: field.getFieldInstance(item.instance);
|
||||
columns fieldInstance/columnTypes;
|
||||
rows data/?name">
|
||||
<table class="records">
|
||||
<thead>
|
||||
<tr>
|
||||
<tal:header repeat="column columns">
|
||||
<th width="auto" editable="true"
|
||||
tal:attributes="field column/name"
|
||||
tal:attributes="field column/name;
|
||||
style string:width: ${column/baseField/width|string:auto};"
|
||||
tal:content="column/title">Column Title</th>
|
||||
</tal:header>
|
||||
</tr>
|
||||
<tr tal:repeat="row data/?name">
|
||||
</thead>
|
||||
<tbody tal:attributes="id string:tbody.$name">
|
||||
<tr tal:repeat="row rows">
|
||||
<td tal:repeat="column columns">
|
||||
<input type="text" size="14"
|
||||
<input type="text"
|
||||
tal:define="cname column/name"
|
||||
tal:attributes="value row/?cname;
|
||||
name string:$name.$cname:records" /></td>
|
||||
name string:$name.$cname:records;" /></td>
|
||||
</tr>
|
||||
<tr tal:attributes="id string:$name.empty">
|
||||
<td tal:repeat="column columns">
|
||||
<input type="text" size="14"
|
||||
tal:define="cname column/name"
|
||||
tal:attributes="name string:$name.$cname:records" /></td>
|
||||
</tr>
|
||||
</table><br />
|
||||
<tal:empty condition="python: not field.cardinality
|
||||
or field.cardinality > len(rows)">
|
||||
<tr>
|
||||
<td tal:repeat="column columns">
|
||||
<input type="text"
|
||||
tal:define="cname column/name"
|
||||
tal:attributes="name string:$name.$cname:records" /></td>
|
||||
</tr>
|
||||
<tr style="display: none"
|
||||
tal:attributes="id string:$name.empty">
|
||||
<td tal:repeat="column columns">
|
||||
<input type="text"
|
||||
tal:define="cname column/name"
|
||||
tal:attributes="name string:$name.$cname:records" /></td>
|
||||
</tr>
|
||||
</tal:empty>
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
<input type="button" value="+"
|
||||
tal:condition="python: not field.cardinality
|
||||
or field.cardinality > len(rows) + 1"
|
||||
tal:attributes="onclick string:
|
||||
n = dojo.byId('$name.empty').cloneNode(true);;
|
||||
n.id = null;;
|
||||
n.style.display = '';;
|
||||
dojo.byId('tbody.$name').appendChild(n);;" />
|
||||
</div><br />
|
||||
</metal:input>
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue