31 id = 'edition' |
31 id = 'edition' |
32 |
32 |
33 cwtarget = 'eformframe' |
33 cwtarget = 'eformframe' |
34 cssclass = 'entityForm' |
34 cssclass = 'entityForm' |
35 copy_nav_params = True |
35 copy_nav_params = True |
36 form_buttons = [SubmitButton(), |
36 form_buttons = [formwidgets.SubmitButton(), |
37 Button(stdmsgs.BUTTON_APPLY, cwaction='apply'), |
37 formwidgets.Button(stdmsgs.BUTTON_APPLY, cwaction='apply'), |
38 Button(stdmsgs.BUTTON_CANCEL, cwaction='cancel')] |
38 formwidgets.Button(stdmsgs.BUTTON_CANCEL, cwaction='cancel')] |
39 attrcategories = ('primary', 'secondary') |
39 attrcategories = ('primary', 'secondary') |
40 # class attributes below are actually stored in the uicfg module since we |
40 # class attributes below are actually stored in the uicfg module since we |
41 # don't want them to be reloaded |
41 # don't want them to be reloaded |
42 rcategories = uicfg.autoform_section |
42 rcategories = uicfg.autoform_section |
43 rfields = uicfg.autoform_field |
43 rfields = uicfg.autoform_field |
305 |
305 |
306 |
306 |
307 def etype_relation_field(etype, rtype, role='subject'): |
307 def etype_relation_field(etype, rtype, role='subject'): |
308 eschema = AutomaticEntityForm.schema.eschema(etype) |
308 eschema = AutomaticEntityForm.schema.eschema(etype) |
309 return AutomaticEntityForm.field_by_name(rtype, role, eschema) |
309 return AutomaticEntityForm.field_by_name(rtype, role, eschema) |
|
310 |
|
311 |
|
312 ## default form ui configuration ############################################## |
|
313 |
|
314 # use primary and not generated for eid since it has to be an hidden |
|
315 uicfg.autoform_section.tag_attribute(('*', 'eid'), 'primary') |
|
316 uicfg.autoform_section.tag_attribute(('*', 'description'), 'secondary') |
|
317 uicfg.autoform_section.tag_attribute(('*', 'creation_date'), 'metadata') |
|
318 uicfg.autoform_section.tag_attribute(('*', 'modification_date'), 'metadata') |
|
319 uicfg.autoform_section.tag_attribute(('*', 'cwuri'), 'metadata') |
|
320 uicfg.autoform_section.tag_attribute(('*', 'has_text'), 'generated') |
|
321 uicfg.autoform_section.tag_subject_of(('*', 'in_state', '*'), 'primary') |
|
322 uicfg.autoform_section.tag_subject_of(('*', 'owned_by', '*'), 'metadata') |
|
323 uicfg.autoform_section.tag_subject_of(('*', 'created_by', '*'), 'metadata') |
|
324 uicfg.autoform_section.tag_subject_of(('*', 'is', '*'), 'generated') |
|
325 uicfg.autoform_section.tag_object_of(('*', 'is', '*'), 'generated') |
|
326 uicfg.autoform_section.tag_subject_of(('*', 'is_instance_of', '*'), 'generated') |
|
327 uicfg.autoform_section.tag_object_of(('*', 'is_instance_of', '*'), 'generated') |
|
328 uicfg.autoform_section.tag_subject_of(('*', 'identity', '*'), 'generated') |
|
329 uicfg.autoform_section.tag_object_of(('*', 'identity', '*'), 'generated') |
|
330 uicfg.autoform_section.tag_subject_of(('*', 'require_permission', '*'), 'generated') |
|
331 uicfg.autoform_section.tag_subject_of(('*', 'wf_info_for', '*'), 'generated') |
|
332 uicfg.autoform_section.tag_object_of(('*', 'wf_info_for', '*'), 'generated') |
|
333 uicfg.autoform_section.tag_subject_of(('*', 'for_user', '*'), 'generated') |
|
334 uicfg.autoform_section.tag_object_of(('*', 'for_user', '*'), 'generated') |
|
335 uicfg.autoform_section.tag_subject_of(('CWPermission', 'require_group', '*'), 'primary') |
|
336 uicfg.autoform_section.tag_attribute(('CWEType', 'final'), 'generated') |
|
337 uicfg.autoform_section.tag_attribute(('CWRType', 'final'), 'generated') |
|
338 uicfg.autoform_section.tag_attribute(('CWUser', 'firstname'), 'secondary') |
|
339 uicfg.autoform_section.tag_attribute(('CWUser', 'surname'), 'secondary') |
|
340 uicfg.autoform_section.tag_attribute(('CWUser', 'last_login_time'), 'metadata') |
|
341 uicfg.autoform_section.tag_subject_of(('CWUser', 'in_group', '*'), 'primary') |
|
342 uicfg.autoform_section.tag_object_of(('*', 'owned_by', 'CWUser'), 'generated') |
|
343 uicfg.autoform_section.tag_object_of(('*', 'created_by', 'CWUser'), 'generated') |
|
344 uicfg.autoform_section.tag_object_of(('*', 'bookmarked_by', 'CWUser'), 'metadata') |
|
345 uicfg.autoform_section.tag_attribute(('Bookmark', 'path'), 'primary') |
|
346 uicfg.autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually |
|
347 uicfg.autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic') |
|
348 |
|
349 uicfg.autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'), |
|
350 {'widget': formwidgets.TextInput}) |
|
351 uicfg.autoform_field_kwargs.tag_attribute(('Bookmark', 'path'), |
|
352 {'widget': formwidgets.TextInput}) |
|
353 |
|
354 uicfg.autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True) |
|
355 uicfg.autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True) |
|
356 uicfg.autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True) |
|
357 uicfg.autoform_is_inlined.tag_subject_of(('CWRelation', 'to_entity', '*'), True) |