Make contentType field editable under certain circumstances

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1625 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2007-03-07 17:23:13 +00:00
parent 6c03c732f4
commit 0c6d0a4102
2 changed files with 15 additions and 3 deletions

View file

@ -88,7 +88,7 @@ class ObjectForm(NodeView):
if desc:
desc.height = 2
if self.typeInterface in widgetControllers:
wc = widgetControllers[self.typeInterface]()
wc = widgetControllers[self.typeInterface](self.context, self.request)
wc.modifyWidgetSetup(self.widgets)
def __call__(self):
@ -124,6 +124,10 @@ class ObjectForm(NodeView):
class WidgetController(object):
def __init__(self, context, request):
self.context = context
self.request = request
def modifyFormFields(self, formFields):
return formFields
@ -143,6 +147,8 @@ class NoteWidgetController(WidgetController):
class FileWidgetController(WidgetController):
def modifyFormFields(self, formFields):
if self.request.principal.id == 'rootadmin':
return formFields
return formFields.omit('contentType')
@ -174,7 +180,7 @@ class EditObjectForm(ObjectForm, EditForm):
def form_fields(self):
ff = FormFields(self.typeInterface)
if self.typeInterface in widgetControllers:
wc = widgetControllers[self.typeInterface]()
wc = widgetControllers[self.typeInterface](self.context, self.request)
ff = wc.modifyFormFields(ff)
return ff
@ -207,7 +213,7 @@ class CreateObjectForm(ObjectForm, Form):
ff = FormFields(ifc)
#ff['data'].custom_widget = UploadWidget
if self.typeInterface in widgetControllers:
wc = widgetControllers[self.typeInterface]()
wc = widgetControllers[self.typeInterface](self.context, self.request)
ff = wc.modifyFormFields(ff)
return ff

View file

@ -63,6 +63,12 @@ class BaseRelation(DyadicRelation):
id = zapi.getUtility(IRelationRegistry).getUniqueIdForObject(self.predicate)
return '.'.join((baseName, str(id)))
# Problem with reindex catalog, needs __parent__ - but this does not help:
#__parent__ = None
#@property
#def __parent__(self):
# return self.first
class ConceptRelation(BaseRelation):
""" A relation between concept objects.