95 section = 'relations' |
95 section = 'relations' |
96 else: |
96 else: |
97 section = 'sideboxes' |
97 section = 'sideboxes' |
98 rtag.tag_relation((sschema, rschema, oschema, role), section) |
98 rtag.tag_relation((sschema, rschema, oschema, role), section) |
99 |
99 |
100 primaryview_section = RelationTags(init_primaryview_section, |
100 primaryview_section = RelationTags('primaryview_section', |
101 frozenset(('attributes', 'relations', |
101 init_primaryview_section, |
|
102 frozenset(('attributes', 'relations', |
102 'sideboxes', 'hidden'))) |
103 'sideboxes', 'hidden'))) |
103 for rtype in ('eid', 'creation_date', 'modification_date', |
104 for rtype in ('eid', 'creation_date', 'modification_date', |
104 'is', 'is_instance_of', 'identity', |
105 'is', 'is_instance_of', 'identity', |
105 'owned_by', 'created_by', |
106 'owned_by', 'created_by', |
106 'in_state', 'wf_info_for', 'require_permission', |
107 'in_state', 'wf_info_for', 'require_permission', |
107 'from_entity', 'to_entity', |
108 'from_entity', 'to_entity', |
108 'see_also'): |
109 'see_also'): |
109 primaryview_section.tag_subject_of(('*', rtype, '*'), 'hidden') |
110 primaryview_section.tag_subject_of(('*', rtype, '*'), 'hidden') |
110 primaryview_section.tag_object_of(('*', rtype, '*'), 'hidden') |
111 primaryview_section.tag_object_of(('*', rtype, '*'), 'hidden') |
|
112 primaryview_section.tag_subject_of(('*', 'use_email', '*'), 'attributes') |
|
113 primaryview_section.tag_subject_of(('*', 'primary_email', '*'), 'hidden') |
111 |
114 |
112 for attr in ('name', 'meta', 'final'): |
115 for attr in ('name', 'meta', 'final'): |
113 primaryview_section.tag_attribute(('CWEType', attr), 'hidden') |
116 primaryview_section.tag_attribute(('CWEType', attr), 'hidden') |
114 for attr in ('name', 'meta', 'final', 'symetric', 'inlined'): |
117 for attr in ('name', 'meta', 'final', 'symetric', 'inlined'): |
115 primaryview_section.tag_attribute(('CWRType', attr), 'hidden') |
118 primaryview_section.tag_attribute(('CWRType', attr), 'hidden') |
138 if displayinfo is None: |
141 if displayinfo is None: |
139 displayinfo = {} |
142 displayinfo = {} |
140 rtag.tag_relation((sschema, rschema, oschema, role), displayinfo) |
143 rtag.tag_relation((sschema, rschema, oschema, role), displayinfo) |
141 displayinfo.setdefault('label', label) |
144 displayinfo.setdefault('label', label) |
142 |
145 |
143 primaryview_display_ctrl = DisplayCtrlRelationTags(init_primaryview_display_ctrl) |
146 primaryview_display_ctrl = DisplayCtrlRelationTags('primaryview_display_ctrl', |
|
147 init_primaryview_display_ctrl) |
144 |
148 |
145 |
149 |
146 # index view configuration #################################################### |
150 # index view configuration #################################################### |
147 # entity type section in the index/manage page. May be one of |
151 # entity type section in the index/manage page. May be one of |
148 # * 'application' |
152 # * 'application' |
176 section = 'secondary' |
180 section = 'secondary' |
177 else: |
181 else: |
178 section = 'generic' |
182 section = 'generic' |
179 rtag.tag_relation((sschema, rschema, oschema, role), section) |
183 rtag.tag_relation((sschema, rschema, oschema, role), section) |
180 |
184 |
181 autoform_section = RelationTags(init_autoform_section, |
185 autoform_section = RelationTags('autoform_section', init_autoform_section, |
182 set(('primary', 'secondary', 'generic', |
186 set(('primary', 'secondary', 'generic', |
183 'metadata', 'generated'))) |
187 'metadata', 'generated'))) |
184 # use primary and not generated for eid since it has to be an hidden |
188 # use primary and not generated for eid since it has to be an hidden |
185 autoform_section.tag_attribute(('*', 'eid'), 'primary') |
189 autoform_section.tag_attribute(('*', 'eid'), 'primary') |
186 autoform_section.tag_attribute(('*', 'description'), 'secondary') |
190 autoform_section.tag_attribute(('*', 'description'), 'secondary') |
215 autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually |
219 autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually |
216 autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic') |
220 autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic') |
217 |
221 |
218 |
222 |
219 # relations'field class |
223 # relations'field class |
220 autoform_field = RelationTags() |
224 autoform_field = RelationTags('autoform_field') |
221 |
225 |
222 # relations'field explicit kwargs (given to field's __init__) |
226 # relations'field explicit kwargs (given to field's __init__) |
223 autoform_field_kwargs = RelationTags() |
227 autoform_field_kwargs = RelationTags() |
224 autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'), |
228 autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'), |
225 {'widget': formwidgets.TextInput}) |
229 {'widget': formwidgets.TextInput}) |
229 |
233 |
230 |
234 |
231 # inlined view flag for non final relations: when True for an entry, the |
235 # inlined view flag for non final relations: when True for an entry, the |
232 # entity(ies) at the other end of the relation will be editable from the |
236 # entity(ies) at the other end of the relation will be editable from the |
233 # form of the edited entity |
237 # form of the edited entity |
234 autoform_is_inlined = RelationTagsBool() |
238 autoform_is_inlined = RelationTagsBool('autoform_is_inlined') |
235 autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True) |
239 autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True) |
236 autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True) |
240 autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True) |
237 autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True) |
241 autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True) |
238 autoform_is_inlined.tag_subject_of(('CWRelation', 'to_entity', '*'), True) |
242 autoform_is_inlined.tag_subject_of(('CWRelation', 'to_entity', '*'), True) |
239 |
243 |
240 |
244 |
241 # set of tags of the form <action>_on_new on relations. <action> is a |
245 # set of tags of the form <action>_on_new on relations. <action> is a |
242 # schema action (add/update/delete/read), and when such a tag is found |
246 # schema action (add/update/delete/read), and when such a tag is found |
243 # permissions checking is by-passed and supposed to be ok |
247 # permissions checking is by-passed and supposed to be ok |
244 autoform_permissions_overrides = RelationTagsSet() |
248 autoform_permissions_overrides = RelationTagsSet('autoform_permissions_overrides') |
245 |
249 |
246 |
250 |
247 # boxes.EditBox configuration ################################################# |
251 # boxes.EditBox configuration ################################################# |
248 |
252 |
249 # 'link' / 'create' relation tags, used to control the "add entity" submenu |
253 # 'link' / 'create' relation tags, used to control the "add entity" submenu |
252 card = rschema.rproperty(sschema, oschema, 'cardinality')[role == 'object'] |
256 card = rschema.rproperty(sschema, oschema, 'cardinality')[role == 'object'] |
253 if not card in '?1' and \ |
257 if not card in '?1' and \ |
254 rschema.rproperty(sschema, oschema, 'composite') == role: |
258 rschema.rproperty(sschema, oschema, 'composite') == role: |
255 rtag.tag_relation((sschema, rschema, oschema, role), True) |
259 rtag.tag_relation((sschema, rschema, oschema, role), True) |
256 |
260 |
257 actionbox_appearsin_addmenu = RelationTagsBool(init_actionbox_appearsin_addmenu) |
261 actionbox_appearsin_addmenu = RelationTagsBool('actionbox_appearsin_addmenu', |
|
262 init_actionbox_appearsin_addmenu) |
258 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False) |
263 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False) |
259 actionbox_appearsin_addmenu.tag_object_of(('*', 'is', '*'), False) |
264 actionbox_appearsin_addmenu.tag_object_of(('*', 'is', '*'), False) |
260 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False) |
265 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False) |
261 actionbox_appearsin_addmenu.tag_object_of(('*', 'is_instance_of', '*'), False) |
266 actionbox_appearsin_addmenu.tag_object_of(('*', 'is_instance_of', '*'), False) |
262 actionbox_appearsin_addmenu.tag_subject_of(('*', 'identity', '*'), False) |
267 actionbox_appearsin_addmenu.tag_subject_of(('*', 'identity', '*'), False) |
277 actionbox_appearsin_addmenu.tag_object_of(('*', 'bookmarked_by', 'CWUser'), True) |
282 actionbox_appearsin_addmenu.tag_object_of(('*', 'bookmarked_by', 'CWUser'), True) |
278 actionbox_appearsin_addmenu.tag_subject_of(('Transition', 'destination_state', '*'), True) |
283 actionbox_appearsin_addmenu.tag_subject_of(('Transition', 'destination_state', '*'), True) |
279 actionbox_appearsin_addmenu.tag_object_of(('*', 'allowed_transition', 'Transition'), True) |
284 actionbox_appearsin_addmenu.tag_object_of(('*', 'allowed_transition', 'Transition'), True) |
280 actionbox_appearsin_addmenu.tag_object_of(('*', 'destination_state', 'State'), True) |
285 actionbox_appearsin_addmenu.tag_object_of(('*', 'destination_state', 'State'), True) |
281 actionbox_appearsin_addmenu.tag_subject_of(('State', 'allowed_transition', '*'), True) |
286 actionbox_appearsin_addmenu.tag_subject_of(('State', 'allowed_transition', '*'), True) |
|
287 |