338 form.append_field(field) |
338 form.append_field(field) |
339 self.relation_form(lzone, value, form, |
339 self.relation_form(lzone, value, form, |
340 self._build_renderer(entity, rtype, role)) |
340 self._build_renderer(entity, rtype, role)) |
341 |
341 |
342 def should_edit_attribute(self, entity, rschema, form): |
342 def should_edit_attribute(self, entity, rschema, form): |
343 rtype = str(rschema) |
343 if not entity.has_perm('update'): |
344 rdef = entity.e_schema.rdef(rtype) |
344 return False |
345 afs = uicfg.autoform_section.etype_get( |
345 rdef = entity.e_schema.rdef(rschema) |
346 entity.__regid__, rtype, 'subject', rdef.object) |
|
347 if 'main_hidden' in afs or not entity.has_perm('update'): |
|
348 return False |
|
349 if not rdef.has_perm(self._cw, 'update', eid=entity.eid): |
346 if not rdef.has_perm(self._cw, 'update', eid=entity.eid): |
350 return False |
347 return False |
351 try: |
348 try: |
352 form.field_by_name(rtype, 'subject', entity.e_schema) |
349 form.field_by_name(str(rschema), 'subject', entity.e_schema) |
353 except FieldNotFound: |
350 except FieldNotFound: |
354 return False |
351 return False |
355 return True |
352 return True |
356 |
353 |
357 def should_edit_relation(self, entity, rschema, role, rvid): |
354 def should_edit_relation(self, entity, rschema, role, rvid): |
435 """ |
432 """ |
436 __regid__ = 'reledit' |
433 __regid__ = 'reledit' |
437 _onclick = (u"loadInlineEditionForm(%(eid)s, '%(rtype)s', '%(role)s', " |
434 _onclick = (u"loadInlineEditionForm(%(eid)s, '%(rtype)s', '%(role)s', " |
438 "'%(divid)s', %(reload)s, '%(vid)s', '%(default)s', '%(lzone)s');") |
435 "'%(divid)s', %(reload)s, '%(vid)s', '%(default)s', '%(lzone)s');") |
439 |
436 |
|
437 def should_edit_attribute(self, entity, rschema, form): |
|
438 rdef = entity.e_schema.rdef(rschema) |
|
439 afs = uicfg.autoform_section.etype_get( |
|
440 entity.__regid__, rschema, 'subject', rdef.object) |
|
441 if 'main_hidden' in afs: |
|
442 return False |
|
443 return super(AutoClickAndEditFormView, self).should_edit_attribute( |
|
444 entity, rschema, form) |
|
445 |
440 def should_edit_relation(self, entity, rschema, role, rvid): |
446 def should_edit_relation(self, entity, rschema, role, rvid): |
441 eschema = entity.e_schema |
447 eschema = entity.e_schema |
442 rtype = str(rschema) |
448 dispctrl = _pvdc.etype_get(eschema, rschema, role) |
443 # XXX check autoform_section. what if 'generic'? |
|
444 dispctrl = _pvdc.etype_get(eschema, rtype, role) |
|
445 vid = dispctrl.get('vid', 'reledit') |
449 vid = dispctrl.get('vid', 'reledit') |
446 if vid != 'reledit': # reledit explicitly disabled |
450 if vid != 'reledit': # reledit explicitly disabled |
447 return False |
451 return False |
448 if eschema.rdef(rschema, role).composite == role: |
452 rdef = eschema.rdef(rschema, role) |
|
453 if rdef.composite == role: |
|
454 return False |
|
455 afs = uicfg.autoform_section.etype_get( |
|
456 entity.__regid__, rschema, role, rdef.object) |
|
457 if 'main_hidden' in afs: |
449 return False |
458 return False |
450 return super(AutoClickAndEditFormView, self).should_edit_relation( |
459 return super(AutoClickAndEditFormView, self).should_edit_relation( |
451 entity, rschema, role, rvid) |
460 entity, rschema, role, rvid) |
452 |
461 |
453 def _build_form(self, entity, rtype, role, formid, default, reload, lzone, |
462 def _build_form(self, entity, rtype, role, formid, default, reload, lzone, |