improve handling of special field types (records, relation(set))
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3646 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
fd0a532fbc
commit
bea4f70ba3
4 changed files with 36 additions and 5 deletions
|
@ -23,6 +23,7 @@ $Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from cgi import parse_qs, parse_qsl
|
from cgi import parse_qs, parse_qsl
|
||||||
|
import re
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.app.form.browser.interfaces import ITerms
|
from zope.app.form.browser.interfaces import ITerms
|
||||||
|
@ -357,6 +358,9 @@ class BaseView(GenericView, I18NView):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def renderedDescription(self):
|
def renderedDescription(self):
|
||||||
|
htmlPattern = re.compile(r'<(.+)>.+</\1>')
|
||||||
|
if htmlPattern.search(self.description):
|
||||||
|
return self.description
|
||||||
return self.renderText(self.description, 'text/restructured')
|
return self.renderText(self.description, 'text/restructured')
|
||||||
|
|
||||||
# type listings
|
# type listings
|
||||||
|
|
|
@ -46,6 +46,7 @@ from zope.traversing.api import getName
|
||||||
|
|
||||||
from cybertools.browser.action import actions
|
from cybertools.browser.action import actions
|
||||||
from cybertools.composer.interfaces import IInstance
|
from cybertools.composer.interfaces import IInstance
|
||||||
|
from cybertools.composer.schema.grid.interfaces import Grid
|
||||||
from cybertools.composer.schema.interfaces import ISchemaFactory
|
from cybertools.composer.schema.interfaces import ISchemaFactory
|
||||||
from cybertools.typology.interfaces import IType, ITypeManager
|
from cybertools.typology.interfaces import IType, ITypeManager
|
||||||
from cybertools.util.jeep import Jeep
|
from cybertools.util.jeep import Jeep
|
||||||
|
@ -54,6 +55,7 @@ from loops.common import adapted
|
||||||
from loops.concept import Concept, ConceptTypeSourceList, PredicateSourceList
|
from loops.concept import Concept, ConceptTypeSourceList, PredicateSourceList
|
||||||
from loops.i18n.browser import I18NView
|
from loops.i18n.browser import I18NView
|
||||||
from loops.interfaces import IConcept, IConceptSchema, ITypeConcept, IResource
|
from loops.interfaces import IConcept, IConceptSchema, ITypeConcept, IResource
|
||||||
|
from loops.schema.base import RelationSet, Relation
|
||||||
from loops import util
|
from loops import util
|
||||||
from loops.util import _
|
from loops.util import _
|
||||||
from loops.versioning.util import getVersion
|
from loops.versioning.util import getVersion
|
||||||
|
@ -63,6 +65,8 @@ class ConceptEditForm(EditForm, I18NView):
|
||||||
""" Classic-style (zope.formlib-based) form for editing concepts.
|
""" Classic-style (zope.formlib-based) form for editing concepts.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
ignoredFieldTypes = (Grid, Relation, RelationSet,)
|
||||||
|
|
||||||
#@Lazy # zope.formlib does not issue a redirect after changes, so that
|
#@Lazy # zope.formlib does not issue a redirect after changes, so that
|
||||||
# it tries to redisplay the old form even after a type change that
|
# it tries to redisplay the old form even after a type change that
|
||||||
# changes the set of available attributes. So the typeInterface
|
# changes the set of available attributes. So the typeInterface
|
||||||
|
@ -85,7 +89,8 @@ class ConceptEditForm(EditForm, I18NView):
|
||||||
fields = FormFields(typeInterface, f1)
|
fields = FormFields(typeInterface, f1)
|
||||||
else:
|
else:
|
||||||
fields = FormFields(IConcept, typeInterface)
|
fields = FormFields(IConcept, typeInterface)
|
||||||
return fields
|
return [f for f in fields
|
||||||
|
if not isinstance(f.field, self.ignoredFieldTypes)]
|
||||||
|
|
||||||
def setUpWidgets(self, ignore_request=False):
|
def setUpWidgets(self, ignore_request=False):
|
||||||
# TODO: get rid of removeSecurityProxy(): use ConceptSchema in interfaces
|
# TODO: get rid of removeSecurityProxy(): use ConceptSchema in interfaces
|
||||||
|
|
|
@ -16,12 +16,18 @@
|
||||||
tal:attributes="value view/form_action" />
|
tal:attributes="value view/form_action" />
|
||||||
<input type="hidden" name="version"
|
<input type="hidden" name="version"
|
||||||
tal:attributes="value request/version | nothing" />
|
tal:attributes="value request/version | nothing" />
|
||||||
|
<tal:title condition="not:view/isInnerHtml">
|
||||||
|
<h1 tal:content="request/view_title|view/title"
|
||||||
|
i18n:translate="">Edit Information Object</h1>
|
||||||
|
<br />
|
||||||
|
</tal:title>
|
||||||
|
|
||||||
<table cellpadding="3" class="form">
|
<table cellpadding="3" class="form">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr tal:condition="view/isInnerHtml">
|
||||||
<th colspan="5" class="headline"
|
<th colspan="5" class="headline"
|
||||||
tal:attributes="colspan python: useI18N and 4 or 5">
|
tal:attributes="colspan python: useI18N and 4 or 5">
|
||||||
<span tal:replace="request/view_title|view/title"
|
<span tal:content="request/view_title|view/title"
|
||||||
i18n:translate="">Edit Information Object</span>
|
i18n:translate="">Edit Information Object</span>
|
||||||
</th>
|
</th>
|
||||||
<th tal:condition="useI18N"
|
<th tal:condition="useI18N"
|
||||||
|
|
|
@ -131,6 +131,23 @@ table.listing th span.descending {
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.records input, table.records textarea {
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.records th {
|
||||||
|
background-color: lightgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.records th, table.records td {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
dl.docutils dt {
|
dl.docutils dt {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-top: 0.3em;
|
margin-top: 0.3em;
|
||||||
|
@ -371,9 +388,8 @@ img.notselected {
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog .headline {
|
.dialog .headline {
|
||||||
font-size: 120%;
|
font-size: 140%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
|
||||||
padding: 1em 0 1em 0;
|
padding: 1em 0 1em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue