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:
parent
6c03c732f4
commit
0c6d0a4102
2 changed files with 15 additions and 3 deletions
|
@ -88,7 +88,7 @@ class ObjectForm(NodeView):
|
||||||
if desc:
|
if desc:
|
||||||
desc.height = 2
|
desc.height = 2
|
||||||
if self.typeInterface in widgetControllers:
|
if self.typeInterface in widgetControllers:
|
||||||
wc = widgetControllers[self.typeInterface]()
|
wc = widgetControllers[self.typeInterface](self.context, self.request)
|
||||||
wc.modifyWidgetSetup(self.widgets)
|
wc.modifyWidgetSetup(self.widgets)
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
@ -124,6 +124,10 @@ class ObjectForm(NodeView):
|
||||||
|
|
||||||
class WidgetController(object):
|
class WidgetController(object):
|
||||||
|
|
||||||
|
def __init__(self, context, request):
|
||||||
|
self.context = context
|
||||||
|
self.request = request
|
||||||
|
|
||||||
def modifyFormFields(self, formFields):
|
def modifyFormFields(self, formFields):
|
||||||
return formFields
|
return formFields
|
||||||
|
|
||||||
|
@ -143,6 +147,8 @@ class NoteWidgetController(WidgetController):
|
||||||
class FileWidgetController(WidgetController):
|
class FileWidgetController(WidgetController):
|
||||||
|
|
||||||
def modifyFormFields(self, formFields):
|
def modifyFormFields(self, formFields):
|
||||||
|
if self.request.principal.id == 'rootadmin':
|
||||||
|
return formFields
|
||||||
return formFields.omit('contentType')
|
return formFields.omit('contentType')
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,7 +180,7 @@ class EditObjectForm(ObjectForm, EditForm):
|
||||||
def form_fields(self):
|
def form_fields(self):
|
||||||
ff = FormFields(self.typeInterface)
|
ff = FormFields(self.typeInterface)
|
||||||
if self.typeInterface in widgetControllers:
|
if self.typeInterface in widgetControllers:
|
||||||
wc = widgetControllers[self.typeInterface]()
|
wc = widgetControllers[self.typeInterface](self.context, self.request)
|
||||||
ff = wc.modifyFormFields(ff)
|
ff = wc.modifyFormFields(ff)
|
||||||
return ff
|
return ff
|
||||||
|
|
||||||
|
@ -207,7 +213,7 @@ class CreateObjectForm(ObjectForm, Form):
|
||||||
ff = FormFields(ifc)
|
ff = FormFields(ifc)
|
||||||
#ff['data'].custom_widget = UploadWidget
|
#ff['data'].custom_widget = UploadWidget
|
||||||
if self.typeInterface in widgetControllers:
|
if self.typeInterface in widgetControllers:
|
||||||
wc = widgetControllers[self.typeInterface]()
|
wc = widgetControllers[self.typeInterface](self.context, self.request)
|
||||||
ff = wc.modifyFormFields(ff)
|
ff = wc.modifyFormFields(ff)
|
||||||
return ff
|
return ff
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,12 @@ class BaseRelation(DyadicRelation):
|
||||||
id = zapi.getUtility(IRelationRegistry).getUniqueIdForObject(self.predicate)
|
id = zapi.getUtility(IRelationRegistry).getUniqueIdForObject(self.predicate)
|
||||||
return '.'.join((baseName, str(id)))
|
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):
|
class ConceptRelation(BaseRelation):
|
||||||
""" A relation between concept objects.
|
""" A relation between concept objects.
|
||||||
|
|
Loading…
Add table
Reference in a new issue