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