author | sylvain.thenault@logilab.fr |
Thu, 14 May 2009 12:50:34 +0200 | |
changeset 1813 | 4e4333bb56b3 |
parent 1797 | c2a80130b06d |
child 1819 | 7d3e8adcd559 |
permissions | -rw-r--r-- |
1739 | 1 |
# :organization: Logilab |
2 |
# :copyright: 2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
|
3 |
# :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
|
4 |
"""This module regroups a set of structures that may be used to configure |
|
5 |
various places of the generated web interface. |
|
6 |
||
7 |
Primary view configuration |
|
8 |
`````````````````````````` |
|
9 |
:primaryview_section: |
|
10 |
where to display a relation in primary view. Value may be one of: |
|
11 |
* 'attributes', display in the attributes section |
|
12 |
* 'relations', display in the relations section (below attributes) |
|
13 |
* 'sideboxes', display in the side boxes (beside attributes) |
|
14 |
* 'hidden', don't display |
|
15 |
||
16 |
:primaryview_display_ctrl: |
|
17 |
||
18 |
how to display a relation in primary view. Values are dict with some of the |
|
19 |
following keys: |
|
20 |
||
21 |
:vid: |
|
22 |
identifier of a view to use to display the result set. Defaults depends on |
|
23 |
the section: |
|
24 |
* 'attributes' section: 'reledit' view |
|
25 |
* 'relations' section: 'autolimited' view |
|
26 |
* 'sideboxes' section: 'sidebox' view |
|
27 |
||
28 |
:label: |
|
29 |
label for the relations section or side box |
|
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
30 |
|
1739 | 31 |
:limit: |
32 |
boolean telling if the results should be limited according to the |
|
33 |
configuration |
|
34 |
||
35 |
:filter: |
|
36 |
callback taking the related result set as argument and returning it |
|
37 |
filtered |
|
38 |
||
39 |
:order: |
|
40 |
int used to control order within a section. When not specified, |
|
41 |
automatically set according to order in which tags are added. |
|
42 |
||
43 |
Notice those values are only considered if the relation is in a displayed |
|
44 |
section (controlled by :attr:`primaryview_section`) |
|
45 |
||
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
46 |
|
1739 | 47 |
Index view configuration |
48 |
```````````````````````` |
|
49 |
:indexview_etype_section: |
|
50 |
entity type category in the index/manage page. May be one of |
|
51 |
* 'application' |
|
52 |
* 'system' |
|
53 |
* 'schema' |
|
54 |
* 'subobject' (not displayed by default) |
|
55 |
||
56 |
||
57 |
Actions box configuration |
|
58 |
````````````````````````` |
|
59 |
:actionbox_appearsin_addmenu: |
|
60 |
simple boolean relation tags used to control the "add entity" submenu. |
|
61 |
Relations whose rtag is True will appears, other won't. |
|
62 |
||
63 |
Automatic form configuration |
|
64 |
```````````````````````````` |
|
65 |
||
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
66 |
""" |
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
67 |
__docformat__ = "restructuredtext en" |
1533 | 68 |
|
1739 | 69 |
from cubicweb.rtags import RelationTags, RelationTagsBool, RelationTagsSet |
70 |
from cubicweb.web import formwidgets |
|
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
71 |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
72 |
# primary view configuration ################################################## |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
73 |
|
1745
7e7f04d19a98
a bunch of NameError (!) // needs review //
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1742
diff
changeset
|
74 |
def dual_role(role): |
7e7f04d19a98
a bunch of NameError (!) // needs review //
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1742
diff
changeset
|
75 |
return 'object' if role == 'subject' else 'subject' |
7e7f04d19a98
a bunch of NameError (!) // needs review //
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1742
diff
changeset
|
76 |
|
1746
67a9b86fd479
oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1745
diff
changeset
|
77 |
def card_from_role(card, role): |
67a9b86fd479
oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1745
diff
changeset
|
78 |
if role == 'subject': |
67a9b86fd479
oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1745
diff
changeset
|
79 |
return card[0] |
67a9b86fd479
oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1745
diff
changeset
|
80 |
assert role in ('object', 'sobject'), repr(role) |
67a9b86fd479
oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1745
diff
changeset
|
81 |
return card[1] |
67a9b86fd479
oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1745
diff
changeset
|
82 |
|
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
83 |
def init_primaryview_section(rtag, sschema, rschema, oschema, role): |
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
84 |
if rtag.get(sschema, rschema, oschema, role) is None: |
1746
67a9b86fd479
oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1745
diff
changeset
|
85 |
card = card_from_role(rschema.rproperty(sschema, oschema, 'cardinality'), role) |
1745
7e7f04d19a98
a bunch of NameError (!) // needs review //
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1742
diff
changeset
|
86 |
composed = rschema.rproperty(sschema, oschema, 'composite') == dual_role(role) |
1739 | 87 |
if rschema.is_final(): |
1745
7e7f04d19a98
a bunch of NameError (!) // needs review //
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1742
diff
changeset
|
88 |
if rschema.meta or oschema.type in ('Password', 'Bytes'): |
1739 | 89 |
section = 'hidden' |
90 |
else: |
|
91 |
section = 'attributes' |
|
92 |
elif card in '1+': |
|
93 |
section = 'attributes' |
|
94 |
elif composed: |
|
95 |
section = 'relations' |
|
96 |
else: |
|
97 |
section = 'sideboxes' |
|
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
98 |
rtag.tag_relation((sschema, rschema, oschema, role), section) |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
99 |
|
1739 | 100 |
primaryview_section = RelationTags(init_primaryview_section, |
101 |
frozenset(('attributes', 'relations', |
|
102 |
'sideboxes', 'hidden'))) |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
103 |
for rtype in ('eid', 'creation_date', 'modification_date', |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
104 |
'is', 'is_instance_of', 'identity', |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
105 |
'owned_by', 'created_by', |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
106 |
'in_state', 'wf_info_for', 'require_permission', |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
107 |
'from_entity', 'to_entity', |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
108 |
'see_also'): |
1739 | 109 |
primaryview_section.tag_subject_of(('*', rtype, '*'), 'hidden') |
110 |
primaryview_section.tag_object_of(('*', rtype, '*'), 'hidden') |
|
111 |
||
112 |
for attr in ('name', 'meta', 'final'): |
|
113 |
primaryview_section.tag_attribute(('CWEType', attr), 'hidden') |
|
114 |
for attr in ('name', 'meta', 'final', 'symetric', 'inlined'): |
|
115 |
primaryview_section.tag_attribute(('CWRType', attr), 'hidden') |
|
116 |
||
117 |
||
118 |
class DisplayCtrlRelationTags(RelationTags): |
|
119 |
def __init__(self, *args, **kwargs): |
|
120 |
super(DisplayCtrlRelationTags, self).__init__(*args, **kwargs) |
|
121 |
self._counter = 0 |
|
122 |
||
123 |
def tag_relation(self, key, tag): |
|
124 |
assert isinstance(tag, dict) |
|
1745
7e7f04d19a98
a bunch of NameError (!) // needs review //
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1742
diff
changeset
|
125 |
super(DisplayCtrlRelationTags, self).tag_relation(key, tag) |
1739 | 126 |
self._counter += 1 |
127 |
tag.setdefault('order', self._counter) |
|
128 |
||
129 |
||
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
130 |
def init_primaryview_display_ctrl(rtag, sschema, rschema, oschema, role): |
1739 | 131 |
if role == 'subject': |
132 |
oschema = '*' |
|
133 |
label = rschema.type |
|
134 |
else: |
|
135 |
sschema = '*' |
|
136 |
label = '%s_%s' % (rschema, role) |
|
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
137 |
displayinfo = rtag.get(sschema, rschema, oschema, role) |
1739 | 138 |
if displayinfo is None: |
139 |
displayinfo = {} |
|
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
140 |
rtag.tag_relation((sschema, rschema, oschema, role), displayinfo) |
1739 | 141 |
displayinfo.setdefault('label', label) |
142 |
||
143 |
primaryview_display_ctrl = DisplayCtrlRelationTags(init_primaryview_display_ctrl) |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
144 |
|
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1533
diff
changeset
|
145 |
|
1631
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1604
diff
changeset
|
146 |
# index view configuration #################################################### |
1739 | 147 |
# entity type section in the index/manage page. May be one of |
1631
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1604
diff
changeset
|
148 |
# * 'application' |
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1604
diff
changeset
|
149 |
# * 'system' |
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1604
diff
changeset
|
150 |
# * 'schema' |
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1604
diff
changeset
|
151 |
# * 'subobject' (not displayed by default) |
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1604
diff
changeset
|
152 |
|
1739 | 153 |
indexview_etype_section = {'EmailAddress': 'subobject'} |
1631
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1604
diff
changeset
|
154 |
|
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1604
diff
changeset
|
155 |
|
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1468
diff
changeset
|
156 |
# autoform.AutomaticEntityForm configuration ################################## |
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
157 |
|
1739 | 158 |
# relations'section (eg primary/secondary/generic/metadata/generated) |
159 |
||
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
160 |
def init_autoform_section(rtag, sschema, rschema, oschema, role): |
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
161 |
if rtag.get(sschema, rschema, oschema, role) is None: |
1739 | 162 |
if role == 'subject': |
163 |
card = rschema.rproperty(sschema, oschema, 'cardinality')[0] |
|
164 |
composed = rschema.rproperty(sschema, oschema, 'composite') == 'object' |
|
165 |
else: |
|
166 |
card = rschema.rproperty(sschema, oschema, 'cardinality')[1] |
|
167 |
composed = rschema.rproperty(sschema, oschema, 'composite') == 'subject' |
|
168 |
if sschema.is_metadata(rschema): |
|
169 |
section = 'generated' |
|
170 |
elif card in '1+': |
|
171 |
if not rschema.is_final() and composed: |
|
172 |
section = 'generated' |
|
173 |
else: |
|
174 |
section = 'primary' |
|
175 |
elif rschema.is_final(): |
|
176 |
section = 'secondary' |
|
177 |
else: |
|
178 |
section = 'generic' |
|
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
179 |
rtag.tag_relation((sschema, rschema, oschema, role), section) |
1721
694f6a50e138
final rtags api (eventually :$)
sylvain.thenault@logilab.fr
parents:
1631
diff
changeset
|
180 |
|
1739 | 181 |
autoform_section = RelationTags(init_autoform_section, |
182 |
set(('primary', 'secondary', 'generic', |
|
183 |
'metadata', 'generated'))) |
|
184 |
# use primary and not generated for eid since it has to be an hidden |
|
185 |
autoform_section.tag_attribute(('*', 'eid'), 'primary') |
|
186 |
autoform_section.tag_attribute(('*', 'description'), 'secondary') |
|
187 |
autoform_section.tag_attribute(('*', 'creation_date'), 'metadata') |
|
188 |
autoform_section.tag_attribute(('*', 'modification_date'), 'metadata') |
|
189 |
autoform_section.tag_attribute(('*', 'has_text'), 'generated') |
|
190 |
autoform_section.tag_subject_of(('*', 'in_state', '*'), 'primary') |
|
191 |
autoform_section.tag_subject_of(('*', 'owned_by', '*'), 'metadata') |
|
192 |
autoform_section.tag_subject_of(('*', 'created_by', '*'), 'metadata') |
|
193 |
autoform_section.tag_subject_of(('*', 'is', '*'), 'generated') |
|
1747 | 194 |
autoform_section.tag_object_of(('*', 'is', '*'), 'generated') |
1739 | 195 |
autoform_section.tag_subject_of(('*', 'is_instance_of', '*'), 'generated') |
1747 | 196 |
autoform_section.tag_object_of(('*', 'is_instance_of', '*'), 'generated') |
1739 | 197 |
autoform_section.tag_subject_of(('*', 'identity', '*'), 'generated') |
1747 | 198 |
autoform_section.tag_object_of(('*', 'identity', '*'), 'generated') |
1739 | 199 |
autoform_section.tag_subject_of(('*', 'require_permission', '*'), 'generated') |
200 |
autoform_section.tag_subject_of(('*', 'wf_info_for', '*'), 'generated') |
|
1747 | 201 |
autoform_section.tag_object_of(('*', 'wf_info_for', '*'), 'generated') |
1739 | 202 |
autoform_section.tag_subject_of(('*', 'for_user', '*'), 'generated') |
1747 | 203 |
autoform_section.tag_object_of(('*', 'for_user', '*'), 'generated') |
1739 | 204 |
autoform_section.tag_subject_of(('CWPermission', 'require_group', '*'), 'primary') |
1747 | 205 |
autoform_section.tag_attribute(('CWEType', 'final'), 'generated') |
206 |
autoform_section.tag_attribute(('CWRType', 'final'), 'generated') |
|
1739 | 207 |
autoform_section.tag_attribute(('CWUser', 'firstname'), 'secondary') |
208 |
autoform_section.tag_attribute(('CWUser', 'surname'), 'secondary') |
|
209 |
autoform_section.tag_attribute(('CWUser', 'last_login_time'), 'metadata') |
|
210 |
autoform_section.tag_subject_of(('CWUser', 'in_group', '*'), 'primary') |
|
211 |
autoform_section.tag_object_of(('*', 'owned_by', 'CWUser'), 'generated') |
|
212 |
autoform_section.tag_object_of(('*', 'created_by', 'CWUser'), 'generated') |
|
213 |
autoform_section.tag_object_of(('*', 'bookmarked_by', 'CWUser'), 'metadata') |
|
214 |
autoform_section.tag_attribute(('Bookmark', 'path'), 'primary') |
|
1797
c2a80130b06d
fix some web tests, adjusts rtags
sylvain.thenault@logilab.fr
parents:
1754
diff
changeset
|
215 |
autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually |
c2a80130b06d
fix some web tests, adjusts rtags
sylvain.thenault@logilab.fr
parents:
1754
diff
changeset
|
216 |
autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic') |
1739 | 217 |
|
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
218 |
|
1313
9cff1eee0208
put class, not class name into rwidgets. New rfields rtags to specify a field for a relation
sylvain.thenault@logilab.fr
parents:
1285
diff
changeset
|
219 |
# relations'field class |
1739 | 220 |
autoform_field = RelationTags() |
1313
9cff1eee0208
put class, not class name into rwidgets. New rfields rtags to specify a field for a relation
sylvain.thenault@logilab.fr
parents:
1285
diff
changeset
|
221 |
|
1754
c9c7618a90de
autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents:
1747
diff
changeset
|
222 |
# relations'field explicit kwargs (given to field's __init__) |
c9c7618a90de
autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents:
1747
diff
changeset
|
223 |
autoform_field_kwargs = RelationTags() |
c9c7618a90de
autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents:
1747
diff
changeset
|
224 |
autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'), |
c9c7618a90de
autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents:
1747
diff
changeset
|
225 |
{'widget': formwidgets.TextInput}) |
c9c7618a90de
autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents:
1747
diff
changeset
|
226 |
autoform_field_kwargs.tag_attribute(('Bookmark', 'path'), |
c9c7618a90de
autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents:
1747
diff
changeset
|
227 |
{'widget': formwidgets.TextInput}) |
1739 | 228 |
|
229 |
||
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
230 |
|
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
231 |
# inlined view flag for non final relations: when True for an entry, the |
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
232 |
# entity(ies) at the other end of the relation will be editable from the |
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
233 |
# form of the edited entity |
1739 | 234 |
autoform_is_inlined = RelationTagsBool() |
235 |
autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True) |
|
236 |
autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True) |
|
237 |
autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True) |
|
238 |
autoform_is_inlined.tag_subject_of(('CWRelation', 'to_entity', '*'), True) |
|
1604 | 239 |
|
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
240 |
|
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
241 |
# set of tags of the form <action>_on_new on relations. <action> is a |
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
242 |
# schema action (add/update/delete/read), and when such a tag is found |
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
243 |
# permissions checking is by-passed and supposed to be ok |
1739 | 244 |
autoform_permissions_overrides = RelationTagsSet() |
1285
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
245 |
|
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
246 |
|
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
247 |
# boxes.EditBox configuration ################################################# |
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
248 |
|
d5ce82d65c2b
for a correct handling of rtags, they should not ever be reloaded and they should be initialized once registration is finished
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
249 |
# 'link' / 'create' relation tags, used to control the "add entity" submenu |
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
250 |
def init_actionbox_appearsin_addmenu(rtag, sschema, rschema, oschema, role): |
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
251 |
if rtag.get(sschema, rschema, oschema, role) is None: |
1739 | 252 |
card = rschema.rproperty(sschema, oschema, 'cardinality')[role == 'object'] |
253 |
if not card in '?1' and \ |
|
254 |
rschema.rproperty(sschema, oschema, 'composite') == role: |
|
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1739
diff
changeset
|
255 |
rtag.tag_relation((sschema, rschema, oschema, role), True) |
1739 | 256 |
|
257 |
actionbox_appearsin_addmenu = RelationTagsBool(init_actionbox_appearsin_addmenu) |
|
258 |
actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False) |
|
259 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'is', '*'), False) |
|
260 |
actionbox_appearsin_addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False) |
|
261 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'is_instance_of', '*'), False) |
|
262 |
actionbox_appearsin_addmenu.tag_subject_of(('*', 'identity', '*'), False) |
|
263 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'identity', '*'), False) |
|
264 |
actionbox_appearsin_addmenu.tag_subject_of(('*', 'owned_by', '*'), False) |
|
265 |
actionbox_appearsin_addmenu.tag_subject_of(('*', 'created_by', '*'), False) |
|
266 |
actionbox_appearsin_addmenu.tag_subject_of(('*', 'require_permission', '*'), False) |
|
267 |
actionbox_appearsin_addmenu.tag_subject_of(('*', 'wf_info_for', '*'), False) |
|
268 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'wf_info_for', '*'), False) |
|
269 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'state_of', 'CWEType'), True) |
|
270 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'transition_of', 'CWEType'), True) |
|
271 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'relation_type', 'CWRType'), True) |
|
272 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'from_entity', 'CWEType'), False) |
|
273 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'to_entity', 'CWEType'), False) |
|
274 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'in_group', 'CWGroup'), True) |
|
275 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'owned_by', 'CWUser'), False) |
|
276 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'created_by', 'CWUser'), False) |
|
277 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'bookmarked_by', 'CWUser'), True) |
|
278 |
actionbox_appearsin_addmenu.tag_subject_of(('Transition', 'destination_state', '*'), True) |
|
279 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'allowed_transition', 'Transition'), True) |
|
280 |
actionbox_appearsin_addmenu.tag_object_of(('*', 'destination_state', 'State'), True) |
|
281 |
actionbox_appearsin_addmenu.tag_subject_of(('State', 'allowed_transition', '*'), True) |