100 |
100 |
101 primaryview_section = RelationTags('primaryview_section', |
101 primaryview_section = RelationTags('primaryview_section', |
102 init_primaryview_section, |
102 init_primaryview_section, |
103 frozenset(('attributes', 'relations', |
103 frozenset(('attributes', 'relations', |
104 'sideboxes', 'hidden'))) |
104 'sideboxes', 'hidden'))) |
105 for rtype in ('eid', 'creation_date', 'modification_date', 'cwuri', |
|
106 'is', 'is_instance_of', 'identity', |
|
107 'owned_by', 'created_by', |
|
108 'in_state', 'wf_info_for', 'require_permission', |
|
109 'from_entity', 'to_entity', |
|
110 'see_also'): |
|
111 primaryview_section.tag_subject_of(('*', rtype, '*'), 'hidden') |
|
112 primaryview_section.tag_object_of(('*', rtype, '*'), 'hidden') |
|
113 primaryview_section.tag_subject_of(('*', 'use_email', '*'), 'attributes') |
|
114 primaryview_section.tag_subject_of(('*', 'primary_email', '*'), 'hidden') |
|
115 |
|
116 for attr in ('name', 'final'): |
|
117 primaryview_section.tag_attribute(('CWEType', attr), 'hidden') |
|
118 for attr in ('name', 'final', 'symetric', 'inlined'): |
|
119 primaryview_section.tag_attribute(('CWRType', attr), 'hidden') |
|
120 |
105 |
121 |
106 |
122 class DisplayCtrlRelationTags(RelationTagsDict): |
107 class DisplayCtrlRelationTags(RelationTagsDict): |
123 def __init__(self, *args, **kwargs): |
108 def __init__(self, *args, **kwargs): |
124 super(DisplayCtrlRelationTags, self).__init__(*args, **kwargs) |
109 super(DisplayCtrlRelationTags, self).__init__(*args, **kwargs) |
199 rtag.tag_relation((sschema, rschema, oschema, role), section) |
184 rtag.tag_relation((sschema, rschema, oschema, role), section) |
200 |
185 |
201 autoform_section = RelationTags('autoform_section', init_autoform_section, |
186 autoform_section = RelationTags('autoform_section', init_autoform_section, |
202 set(('primary', 'secondary', 'generic', |
187 set(('primary', 'secondary', 'generic', |
203 'metadata', 'generated'))) |
188 'metadata', 'generated'))) |
204 # use primary and not generated for eid since it has to be an hidden |
|
205 autoform_section.tag_attribute(('*', 'eid'), 'primary') |
|
206 autoform_section.tag_attribute(('*', 'description'), 'secondary') |
|
207 autoform_section.tag_attribute(('*', 'creation_date'), 'metadata') |
|
208 autoform_section.tag_attribute(('*', 'modification_date'), 'metadata') |
|
209 autoform_section.tag_attribute(('*', 'cwuri'), 'metadata') |
|
210 autoform_section.tag_attribute(('*', 'has_text'), 'generated') |
|
211 autoform_section.tag_subject_of(('*', 'in_state', '*'), 'primary') |
|
212 autoform_section.tag_subject_of(('*', 'owned_by', '*'), 'metadata') |
|
213 autoform_section.tag_subject_of(('*', 'created_by', '*'), 'metadata') |
|
214 autoform_section.tag_subject_of(('*', 'is', '*'), 'generated') |
|
215 autoform_section.tag_object_of(('*', 'is', '*'), 'generated') |
|
216 autoform_section.tag_subject_of(('*', 'is_instance_of', '*'), 'generated') |
|
217 autoform_section.tag_object_of(('*', 'is_instance_of', '*'), 'generated') |
|
218 autoform_section.tag_subject_of(('*', 'identity', '*'), 'generated') |
|
219 autoform_section.tag_object_of(('*', 'identity', '*'), 'generated') |
|
220 autoform_section.tag_subject_of(('*', 'require_permission', '*'), 'generated') |
|
221 autoform_section.tag_subject_of(('*', 'wf_info_for', '*'), 'generated') |
|
222 autoform_section.tag_object_of(('*', 'wf_info_for', '*'), 'generated') |
|
223 autoform_section.tag_subject_of(('*', 'for_user', '*'), 'generated') |
|
224 autoform_section.tag_object_of(('*', 'for_user', '*'), 'generated') |
|
225 autoform_section.tag_subject_of(('CWPermission', 'require_group', '*'), 'primary') |
|
226 autoform_section.tag_attribute(('CWEType', 'final'), 'generated') |
|
227 autoform_section.tag_attribute(('CWRType', 'final'), 'generated') |
|
228 autoform_section.tag_attribute(('CWUser', 'firstname'), 'secondary') |
|
229 autoform_section.tag_attribute(('CWUser', 'surname'), 'secondary') |
|
230 autoform_section.tag_attribute(('CWUser', 'last_login_time'), 'metadata') |
|
231 autoform_section.tag_subject_of(('CWUser', 'in_group', '*'), 'primary') |
|
232 autoform_section.tag_object_of(('*', 'owned_by', 'CWUser'), 'generated') |
|
233 autoform_section.tag_object_of(('*', 'created_by', 'CWUser'), 'generated') |
|
234 autoform_section.tag_object_of(('*', 'bookmarked_by', 'CWUser'), 'metadata') |
|
235 autoform_section.tag_attribute(('Bookmark', 'path'), 'primary') |
|
236 autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually |
|
237 autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic') |
|
238 |
|
239 |
189 |
240 # relations'field class |
190 # relations'field class |
241 autoform_field = RelationTags('autoform_field') |
191 autoform_field = RelationTags('autoform_field') |
242 |
192 |
243 # relations'field explicit kwargs (given to field's __init__) |
193 # relations'field explicit kwargs (given to field's __init__) |
244 autoform_field_kwargs = RelationTagsDict() |
194 autoform_field_kwargs = RelationTagsDict() |
245 autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'), |
|
246 {'widget': formwidgets.TextInput}) |
|
247 autoform_field_kwargs.tag_attribute(('Bookmark', 'path'), |
|
248 {'widget': formwidgets.TextInput}) |
|
249 |
|
250 |
|
251 |
195 |
252 # inlined view flag for non final relations: when True for an entry, the |
196 # inlined view flag for non final relations: when True for an entry, the |
253 # entity(ies) at the other end of the relation will be editable from the |
197 # entity(ies) at the other end of the relation will be editable from the |
254 # form of the edited entity |
198 # form of the edited entity |
255 autoform_is_inlined = RelationTagsBool('autoform_is_inlined') |
199 autoform_is_inlined = RelationTagsBool('autoform_is_inlined') |
256 autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True) |
|
257 autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True) |
|
258 autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True) |
|
259 autoform_is_inlined.tag_subject_of(('CWRelation', 'to_entity', '*'), True) |
|
260 |
200 |
261 |
201 |
262 # set of tags of the form <action>_on_new on relations. <action> is a |
202 # set of tags of the form <action>_on_new on relations. <action> is a |
263 # schema action (add/update/delete/read), and when such a tag is found |
203 # schema action (add/update/delete/read), and when such a tag is found |
264 # permissions checking is by-passed and supposed to be ok |
204 # permissions checking is by-passed and supposed to be ok |
275 rschema.rproperty(sschema, oschema, 'composite') == role: |
215 rschema.rproperty(sschema, oschema, 'composite') == role: |
276 rtag.tag_relation((sschema, rschema, oschema, role), True) |
216 rtag.tag_relation((sschema, rschema, oschema, role), True) |
277 |
217 |
278 actionbox_appearsin_addmenu = RelationTagsBool('actionbox_appearsin_addmenu', |
218 actionbox_appearsin_addmenu = RelationTagsBool('actionbox_appearsin_addmenu', |
279 init_actionbox_appearsin_addmenu) |
219 init_actionbox_appearsin_addmenu) |
280 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False) |
220 |
281 actionbox_appearsin_addmenu.tag_object_of(('*', 'is', '*'), False) |
|
282 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False) |
|
283 actionbox_appearsin_addmenu.tag_object_of(('*', 'is_instance_of', '*'), False) |
|
284 actionbox_appearsin_addmenu.tag_subject_of(('*', 'identity', '*'), False) |
|
285 actionbox_appearsin_addmenu.tag_object_of(('*', 'identity', '*'), False) |
|
286 actionbox_appearsin_addmenu.tag_subject_of(('*', 'owned_by', '*'), False) |
|
287 actionbox_appearsin_addmenu.tag_subject_of(('*', 'created_by', '*'), False) |
|
288 actionbox_appearsin_addmenu.tag_subject_of(('*', 'require_permission', '*'), False) |
|
289 actionbox_appearsin_addmenu.tag_subject_of(('*', 'wf_info_for', '*'), False) |
|
290 actionbox_appearsin_addmenu.tag_object_of(('*', 'wf_info_for', '*'), False) |
|
291 actionbox_appearsin_addmenu.tag_object_of(('*', 'state_of', 'CWEType'), True) |
|
292 actionbox_appearsin_addmenu.tag_object_of(('*', 'transition_of', 'CWEType'), True) |
|
293 actionbox_appearsin_addmenu.tag_object_of(('*', 'relation_type', 'CWRType'), True) |
|
294 actionbox_appearsin_addmenu.tag_object_of(('*', 'from_entity', 'CWEType'), False) |
|
295 actionbox_appearsin_addmenu.tag_object_of(('*', 'to_entity', 'CWEType'), False) |
|
296 actionbox_appearsin_addmenu.tag_object_of(('*', 'in_group', 'CWGroup'), True) |
|
297 actionbox_appearsin_addmenu.tag_object_of(('*', 'owned_by', 'CWUser'), False) |
|
298 actionbox_appearsin_addmenu.tag_object_of(('*', 'created_by', 'CWUser'), False) |
|
299 actionbox_appearsin_addmenu.tag_object_of(('*', 'bookmarked_by', 'CWUser'), True) |
|
300 actionbox_appearsin_addmenu.tag_subject_of(('Transition', 'destination_state', '*'), True) |
|
301 actionbox_appearsin_addmenu.tag_object_of(('*', 'allowed_transition', 'Transition'), True) |
|
302 actionbox_appearsin_addmenu.tag_object_of(('*', 'destination_state', 'State'), True) |
|
303 actionbox_appearsin_addmenu.tag_subject_of(('State', 'allowed_transition', '*'), True) |
|
304 |
|