author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 10 Jun 2016 13:21:13 +0200 | |
changeset 11294 | cd1183a65ebb |
parent 10666 | 7f6b5f023884 |
permissions | -rw-r--r-- |
10006
8391bf718485
remove most 3.10 bw compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9257
diff
changeset
|
1 |
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
7838
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
18 |
""" |
7844
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
19 |
Public API of the PrimaryView class |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
20 |
```````````````````````````````````` |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
21 |
.. autoclass:: cubicweb.web.views.primary.PrimaryView |
7838
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
22 |
|
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
23 |
Views that may be used to display an entity's attribute or relation |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
24 |
``````````````````````````````````````````````````````````````````` |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
25 |
|
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
26 |
Yoy may easily the display of an attribute or relation by simply configuring the |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
27 |
view using one of `primaryview_display_ctrl` or `reledit_ctrl` to use one of the |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
28 |
views describled below. For instance: |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
29 |
|
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
30 |
.. sourcecode:: python |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
31 |
|
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
32 |
primaryview_display_ctrl.tag_attribute(('Foo', 'bar'), {'vid': 'attribute'}) |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
33 |
|
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
34 |
|
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
35 |
.. autoclass:: AttributeView |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
36 |
.. autoclass:: URLAttributeView |
7847
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
37 |
.. autoclass:: VerbatimAttributeView |
7838
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
38 |
""" |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
39 |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
40 |
__docformat__ = "restructuredtext en" |
10666
7f6b5f023884
[py3k] replace '_ = unicode' in global scope (closes #7589459)
Rémi Cardona <remi.cardona@logilab.fr>
parents:
10187
diff
changeset
|
41 |
from cubicweb import _ |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
42 |
|
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
43 |
from warnings import warn |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
44 |
|
6634
0683748bca81
[primary view] properly deprecates render_entity_[summary|metadata]
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6616
diff
changeset
|
45 |
from logilab.common.deprecation import deprecated |
2312
af4d8f75c5db
use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2237
diff
changeset
|
46 |
from logilab.mtconverter import xml_escape |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
47 |
|
6235
d5f7bd102282
[primary view] properly handle case where view specified in pvdc['vid'] isn't selectable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6234
diff
changeset
|
48 |
from cubicweb import Unauthorized, NoSelectableObject |
6067
efca814587e2
[primary] refactor primary view handling of relation's label
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
49 |
from cubicweb.utils import support_args |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7990
diff
changeset
|
50 |
from cubicweb.predicates import match_kwargs, match_context |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
51 |
from cubicweb.view import EntityView |
6377
3bb415310d4f
[schema] introduce some new sets categorizing entity/relation types and benefits from them where possible
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6371
diff
changeset
|
52 |
from cubicweb.schema import META_RTYPES, VIRTUAL_RTYPES, display_name |
8665
e65af61bde7d
[uicfg] uicfg.py moves from web/ to web/views/ (prepares #2406609)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8216
diff
changeset
|
53 |
from cubicweb.web import component |
e65af61bde7d
[uicfg] uicfg.py moves from web/ to web/views/ (prepares #2406609)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8216
diff
changeset
|
54 |
from cubicweb.web.views import uicfg |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
55 |
|
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
56 |
|
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
57 |
class PrimaryView(EntityView): |
7844
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
58 |
""" |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
59 |
The basic layout of a primary view is as in the :ref:`primary_view_layout` |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
60 |
section. This layout is actually drawn by the `render_entity` method. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
61 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
62 |
The methods you may want to modify while customizing a ``PrimaryView`` |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
63 |
are: |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
64 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
65 |
.. automethod:: cubicweb.web.views.primary.PrimaryView.render_entity_title |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
66 |
.. automethod:: cubicweb.web.views.primary.PrimaryView.render_entity_attributes |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
67 |
.. automethod:: cubicweb.web.views.primary.PrimaryView.render_entity_relations |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
68 |
.. automethod:: cubicweb.web.views.primary.PrimaryView.render_side_boxes |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
69 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
70 |
The placement of relations in the relations section or in side boxes |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
71 |
can be controlled through the :ref:`primary_view_configuration` mechanism. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
72 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
73 |
.. automethod:: cubicweb.web.views.primary.PrimaryView.content_navigation_components |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
74 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
75 |
Also, please note that by setting the following attributes in your |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
76 |
subclass, you can already customize some of the rendering: |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
77 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
78 |
:attr:`show_attr_label` |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
79 |
Renders the attribute label next to the attribute value if set to `True`. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
80 |
Otherwise, does only display the attribute value. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
81 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
82 |
:attr:`show_rel_label` |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
83 |
Renders the relation label next to the relation value if set to `True`. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
84 |
Otherwise, does only display the relation value. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
85 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
86 |
:attr:`main_related_section` |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
87 |
Renders the relations of the entity if set to `True`. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
88 |
|
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
89 |
A good practice is for you to identify the content of your entity type for |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
90 |
which the default rendering does not answer your need so that you can focus |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
91 |
on the specific method (from the list above) that needs to be modified. We |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
92 |
do not advise you to overwrite ``render_entity`` unless you want a |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
93 |
completely different layout. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
94 |
""" |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
95 |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3072
diff
changeset
|
96 |
__regid__ = 'primary' |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
97 |
title = _('primary') |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
98 |
show_attr_label = True |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
99 |
show_rel_label = True |
8666
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
100 |
rsection = None |
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
101 |
display_ctrl = None |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
102 |
main_related_section = True |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
103 |
|
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
104 |
def html_headers(self): |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
105 |
"""return a list of html headers (eg something to be inserted between |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
106 |
<head> and </head> of the returned page |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
107 |
|
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
108 |
by default primary views are indexed |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
109 |
""" |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
110 |
return [] |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
111 |
|
9220
3b437196c2d8
[web/views] make PrimaryView.entity_call accept kwargs
Julien Cristau <julien.cristau@logilab.fr>
parents:
8900
diff
changeset
|
112 |
def entity_call(self, entity, **kwargs): |
6847
c1d33aff7715
[primary view] support for entity_call on primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6634
diff
changeset
|
113 |
entity.complete() |
8666
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
114 |
uicfg_reg = self._cw.vreg['uicfg'] |
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
115 |
if self.rsection is None: |
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
116 |
self.rsection = uicfg_reg.select('primaryview_section', |
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
117 |
self._cw, entity=entity) |
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
118 |
if self.display_ctrl is None: |
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
119 |
self.display_ctrl = uicfg_reg.select('primaryview_display_ctrl', |
1dd655788ece
make ui configurations selectable (closes #2406609)
Florent Cayré <florent.cayre@logilab.fr>
parents:
8665
diff
changeset
|
120 |
self._cw, entity=entity) |
2400
17b1f0b80fe8
[primary] restore render_entity, as it is a bit too much work to update everything accordingly
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2384
diff
changeset
|
121 |
self.render_entity(entity) |
17b1f0b80fe8
[primary] restore render_entity, as it is a bit too much work to update everything accordingly
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2384
diff
changeset
|
122 |
|
17b1f0b80fe8
[primary] restore render_entity, as it is a bit too much work to update everything accordingly
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2384
diff
changeset
|
123 |
def render_entity(self, entity): |
4566
c49dba55c0a6
[views] toolbox must be rendered before the title to appear at top right
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
4467
diff
changeset
|
124 |
self.render_entity_toolbox(entity) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
125 |
self.render_entity_title(entity) |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
126 |
# entity's attributes and relations, excluding meta data |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
127 |
# if the entity isn't meta itself |
3974
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
128 |
if self.is_primary(): |
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
129 |
boxes = self._prepare_side_boxes(entity) |
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
130 |
else: |
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
131 |
boxes = None |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
132 |
if boxes or hasattr(self, 'render_side_related'): |
1558
f63d090eb34a
some primary view fixes, need more (eg reledit doesn't work for non final relation
sylvain.thenault@logilab.fr
parents:
1554
diff
changeset
|
133 |
self.w(u'<table width="100%"><tr><td style="width: 75%">') |
7879
9aae456abab5
[pylint] fix pylint detected errors and tweak it so that pylint -E will be much less verbose next time (+ update some copyrights on the way)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7847
diff
changeset
|
134 |
|
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
135 |
self.w(u'<div class="mainInfo">') |
2132
d7ae060cd746
move navcontenttop on the top
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
1977
diff
changeset
|
136 |
self.content_navigation_components('navcontenttop') |
2384
6220783caa4b
[primary] cleanup, render_entity -> cell_call
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2381
diff
changeset
|
137 |
self.render_entity_attributes(entity) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
138 |
if self.main_related_section: |
2384
6220783caa4b
[primary] cleanup, render_entity -> cell_call
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2381
diff
changeset
|
139 |
self.render_entity_relations(entity) |
4742
fac80328a6a3
[primary] navcontentbottom sections should be in the content table as navcontenttop
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4572
diff
changeset
|
140 |
self.content_navigation_components('navcontentbottom') |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
141 |
self.w(u'</div>') |
2237
7e546c3d6ea5
[primary] fix #344249
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2217
diff
changeset
|
142 |
# side boxes |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
143 |
if boxes or hasattr(self, 'render_side_related'): |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
144 |
self.w(u'</td><td>') |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
145 |
self.w(u'<div class="primaryRight">') |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
146 |
self.render_side_boxes(boxes) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
147 |
self.w(u'</div>') |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
148 |
self.w(u'</td></tr></table>') |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
149 |
|
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
150 |
def content_navigation_components(self, context): |
7844
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
151 |
"""This method is applicable only for entity type implementing the |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
152 |
interface `IPrevNext`. This interface is for entities which can be |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
153 |
linked to a previous and/or next entity. This method will render the |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
154 |
navigation links between entities of this type, either at the top or at |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
155 |
the bottom of the page given the context (navcontent{top|bottom}). |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
156 |
""" |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
157 |
self.w(u'<div class="%s">' % context) |
6141
b8287e54b528
[web api] unify 'contentnav' (VComponent) and 'boxes' registries as 'ctxcomponents' (CtxComponent)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6140
diff
changeset
|
158 |
for comp in self._cw.vreg['ctxcomponents'].poss_visible_objects( |
6500
e288df2e2f18
[component] remove row argument which is actually discarded by registry's cache (untill we feel we need a per context cache...)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6476
diff
changeset
|
159 |
self._cw, rset=self.cw_rset, view=self, context=context): |
6926 | 160 |
# XXX bw compat code |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
161 |
try: |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
162 |
comp.render(w=self.w, row=self.cw_row, view=self) |
6616
26587186b856
[primary view bw compat] we should actually drop 3.2 compat and have proper pre 3.10 compat
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6582
diff
changeset
|
163 |
except TypeError: |
26587186b856
[primary view bw compat] we should actually drop 3.2 compat and have proper pre 3.10 compat
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6582
diff
changeset
|
164 |
comp.render(w=self.w) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
165 |
self.w(u'</div>') |
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
166 |
|
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
167 |
def render_entity_title(self, entity): |
7844
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
168 |
"""Renders the entity title, by default using entity's |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
169 |
:meth:`dc_title()` method. |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
170 |
""" |
2312
af4d8f75c5db
use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2237
diff
changeset
|
171 |
title = xml_escape(entity.dc_title()) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
172 |
if title: |
3974
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
173 |
if self.is_primary(): |
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
174 |
self.w(u'<h1>%s</h1>' % title) |
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
175 |
else: |
4104
7e478d7caf20
[mq]: small_api_changes_for_3.6
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
4074
diff
changeset
|
176 |
atitle = self._cw._('follow this link for more information on this %s') % entity.dc_type() |
3974
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
177 |
self.w(u'<h4><a href="%s" title="%s">%s</a></h4>' |
1d36d9904c41
slightly adapt title and hide boxes when view is called as a non primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3972
diff
changeset
|
178 |
% (entity.absolute_url(), atitle, title)) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
179 |
|
3845
596044fb7bc5
introduce render_entity_toolbox on default primary view to display components in the ctxtoolbar context, such as pdf icon, notification registration (nosylist)...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3844
diff
changeset
|
180 |
def render_entity_toolbox(self, entity): |
596044fb7bc5
introduce render_entity_toolbox on default primary view to display components in the ctxtoolbar context, such as pdf icon, notification registration (nosylist)...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3844
diff
changeset
|
181 |
self.content_navigation_components('ctxtoolbar') |
596044fb7bc5
introduce render_entity_toolbox on default primary view to display components in the ctxtoolbar context, such as pdf icon, notification registration (nosylist)...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3844
diff
changeset
|
182 |
|
5239
471554b842d2
[schema view] the final touch. Things are getting nicely displayed, and code clean
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
183 |
def render_entity_attributes(self, entity): |
8206
f5f874d8a4f4
[primary view] delete PrimaryView.skip_none attribute (closes #2093250)
Alexandre Richardson <alexandre.richardson@logilab.fr>
parents:
8201
diff
changeset
|
184 |
"""Renders all attributes and relations in the 'attributes' section. |
7844
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
185 |
""" |
5180
25c3269b2232
[xthml] fix #696079, potential empty table cause xhtml validation error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5065
diff
changeset
|
186 |
display_attributes = [] |
25c3269b2232
[xthml] fix #696079, potential empty table cause xhtml validation error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5065
diff
changeset
|
187 |
for rschema, _, role, dispctrl in self._section_def(entity, 'attributes'): |
2361
8f00836580f1
[reledit] do NOT propose to edit composite-related entities (unlinking would destroy the other side)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2312
diff
changeset
|
188 |
vid = dispctrl.get('vid', 'reledit') |
6070
0ca78eb1a3c2
[primary] use a new rtypevid flag in primary view display controller, allowing to tell the view for a non final relation should be called as an attribute view (eg, not on the target rset)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
189 |
if rschema.final or vid == 'reledit' or dispctrl.get('rtypevid'): |
6086
2b53a8669c98
[primary] handle final relation (eg attribute) in the relations section, and give dispctrl to view's extra kwargs as for non final relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6070
diff
changeset
|
190 |
value = entity.view(vid, rtype=rschema.type, role=role, |
2b53a8669c98
[primary] handle final relation (eg attribute) in the relations section, and give dispctrl to view's extra kwargs as for non final relation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6070
diff
changeset
|
191 |
initargs={'dispctrl': dispctrl}) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
192 |
else: |
1739 | 193 |
rset = self._relation_rset(entity, rschema, role, dispctrl) |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
194 |
if rset: |
4382
6fb02edd05da
3.6 api update, cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
195 |
value = self._cw.view(vid, rset) |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
196 |
else: |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
197 |
value = None |
8206
f5f874d8a4f4
[primary view] delete PrimaryView.skip_none attribute (closes #2093250)
Alexandre Richardson <alexandre.richardson@logilab.fr>
parents:
8201
diff
changeset
|
198 |
if value is not None and value != '': |
5180
25c3269b2232
[xthml] fix #696079, potential empty table cause xhtml validation error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5065
diff
changeset
|
199 |
display_attributes.append( (rschema, role, dispctrl, value) ) |
25c3269b2232
[xthml] fix #696079, potential empty table cause xhtml validation error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5065
diff
changeset
|
200 |
if display_attributes: |
25c3269b2232
[xthml] fix #696079, potential empty table cause xhtml validation error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5065
diff
changeset
|
201 |
self.w(u'<table>') |
5182
3bc8250731fe
[primary] fix name error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5180
diff
changeset
|
202 |
for rschema, role, dispctrl, value in display_attributes: |
9257
ce338133c92c
remove cw 3.9 bw compat (bw compat other than the interface -> adapter changes)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9255
diff
changeset
|
203 |
label = self._rel_label(entity, rschema, role, dispctrl) |
ce338133c92c
remove cw 3.9 bw compat (bw compat other than the interface -> adapter changes)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9255
diff
changeset
|
204 |
self.render_attribute(label, value, table=True) |
5180
25c3269b2232
[xthml] fix #696079, potential empty table cause xhtml validation error
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5065
diff
changeset
|
205 |
self.w(u'</table>') |
1516
288d55a7c5e2
refactor side boxes handling of primary view
sylvain.thenault@logilab.fr
parents:
1491
diff
changeset
|
206 |
|
6335
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
207 |
def render_attribute(self, label, value, table=False): |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
208 |
self.field(label, value, tr=False, table=table) |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
209 |
|
5239
471554b842d2
[schema view] the final touch. Things are getting nicely displayed, and code clean
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5222
diff
changeset
|
210 |
def render_entity_relations(self, entity): |
7844
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
211 |
"""Renders all relations in the 'relations' section.""" |
8736
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
212 |
defaultlimit = self._cw.property_value('navigation.related-limit') |
1739 | 213 |
for rschema, tschemas, role, dispctrl in self._section_def(entity, 'relations'): |
6113
dbe17a3ebb9f
[primary view] consider rtypevid flag for relations in the 'relations' section as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6093
diff
changeset
|
214 |
if rschema.final or dispctrl.get('rtypevid'): |
6235
d5f7bd102282
[primary view] properly handle case where view specified in pvdc['vid'] isn't selectable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6234
diff
changeset
|
215 |
vid = dispctrl.get('vid', 'reledit') |
d5f7bd102282
[primary view] properly handle case where view specified in pvdc['vid'] isn't selectable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6234
diff
changeset
|
216 |
try: |
d5f7bd102282
[primary view] properly handle case where view specified in pvdc['vid'] isn't selectable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6234
diff
changeset
|
217 |
rview = self._cw.vreg['views'].select( |
d5f7bd102282
[primary view] properly handle case where view specified in pvdc['vid'] isn't selectable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6234
diff
changeset
|
218 |
vid, self._cw, rset=entity.cw_rset, row=entity.cw_row, |
6335
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
219 |
col=entity.cw_col, dispctrl=dispctrl, |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
220 |
rtype=rschema, role=role) |
6235
d5f7bd102282
[primary view] properly handle case where view specified in pvdc['vid'] isn't selectable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6234
diff
changeset
|
221 |
except NoSelectableObject: |
d5f7bd102282
[primary view] properly handle case where view specified in pvdc['vid'] isn't selectable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6234
diff
changeset
|
222 |
continue |
6335
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
223 |
value = rview.render(row=entity.cw_row, col=entity.cw_col, |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
224 |
rtype=rschema.type, role=role) |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
225 |
else: |
8736
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
226 |
vid = dispctrl.get('vid', 'autolimited') |
10179
a328b91938b2
Fix handling of limit within the primary view for related elements. Closes #4723579
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9257
diff
changeset
|
227 |
limit = dispctrl.get('limit', defaultlimit) if vid == 'autolimited' else None |
a328b91938b2
Fix handling of limit within the primary view for related elements. Closes #4723579
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9257
diff
changeset
|
228 |
if limit is not None: |
a328b91938b2
Fix handling of limit within the primary view for related elements. Closes #4723579
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9257
diff
changeset
|
229 |
limit += 1 # need one more so the view can check if there is more than the limit |
8736
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
230 |
rset = self._relation_rset(entity, rschema, role, dispctrl, limit=limit) |
6335
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
231 |
if not rset: |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
232 |
continue |
3970
e4ad7663610b
update _render_attribute / _render_relation prototype to gain more control on label through uicfg (for attributes and relations). Keep bw compat for crm/iliane
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3875
diff
changeset
|
233 |
try: |
6335
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
234 |
rview = self._cw.vreg['views'].select( |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
235 |
vid, self._cw, rset=rset, dispctrl=dispctrl) |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
236 |
except NoSelectableObject: |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
237 |
continue |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
238 |
value = rview.render() |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
239 |
label = self._rel_label(entity, rschema, role, dispctrl) |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
240 |
self.render_relation(label, value) |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
241 |
|
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
242 |
def render_relation(self, label, value): |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
243 |
self.w(u'<div class="section">') |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
244 |
if label: |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
245 |
self.w(u'<h4>%s</h4>' % label) |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
246 |
self.w(value) |
d13d488a453e
[primary view] refactor label handling (hence render_[attribute|relation]) so we uniformly use _rel_label which provides properly contextified labels
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6291
diff
changeset
|
247 |
self.w(u'</div>') |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
248 |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
249 |
def render_side_boxes(self, boxes): |
7844
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
250 |
"""Renders side boxes on the right side of the content. This will |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
251 |
generate a box for each relation in the 'sidebox' section, as well as |
0208c65a88a5
[doc] split API/book part of stuff that has been moved in primary view module docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7838
diff
changeset
|
252 |
explicit box appobjects selectable in this context. |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
253 |
""" |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
254 |
for box in boxes: |
10006
8391bf718485
remove most 3.10 bw compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9257
diff
changeset
|
255 |
try: |
8391bf718485
remove most 3.10 bw compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9257
diff
changeset
|
256 |
box.render(w=self.w, row=self.cw_row) |
8391bf718485
remove most 3.10 bw compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9257
diff
changeset
|
257 |
except TypeError: |
8391bf718485
remove most 3.10 bw compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9257
diff
changeset
|
258 |
box.render(w=self.w) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
259 |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
260 |
def _prepare_side_boxes(self, entity): |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
261 |
sideboxes = [] |
6141
b8287e54b528
[web api] unify 'contentnav' (VComponent) and 'boxes' registries as 'ctxcomponents' (CtxComponent)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6140
diff
changeset
|
262 |
boxesreg = self._cw.vreg['ctxcomponents'] |
8736
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
263 |
defaultlimit = self._cw.property_value('navigation.related-limit') |
1739 | 264 |
for rschema, tschemas, role, dispctrl in self._section_def(entity, 'sideboxes'): |
8736
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
265 |
vid = dispctrl.get('vid', 'autolimited') |
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
266 |
limit = defaultlimit if vid == 'autolimited' else None |
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
267 |
rset = self._relation_rset(entity, rschema, role, dispctrl, limit=limit) |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
268 |
if not rset: |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
269 |
continue |
6067
efca814587e2
[primary] refactor primary view handling of relation's label
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
270 |
label = self._rel_label(entity, rschema, role, dispctrl) |
6140
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
271 |
box = boxesreg.select('rsetbox', self._cw, rset=rset, |
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
272 |
vid=vid, title=label, dispctrl=dispctrl, |
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
273 |
context='incontext') |
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
274 |
sideboxes.append(box) |
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
275 |
sideboxes += boxesreg.poss_visible_objects( |
6500
e288df2e2f18
[component] remove row argument which is actually discarded by registry's cache (untill we feel we need a per context cache...)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6476
diff
changeset
|
276 |
self._cw, rset=self.cw_rset, view=self, |
6140
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
277 |
context='incontext') |
3975
569771016abb
add a fourth item to 'view box' defintion, dispctrl, so that
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3974
diff
changeset
|
278 |
# XXX since we've two sorted list, it may be worth using bisect |
569771016abb
add a fourth item to 'view box' defintion, dispctrl, so that
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3974
diff
changeset
|
279 |
def get_order(x): |
6140
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
280 |
if 'order' in x.cw_property_defs: |
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
281 |
return x.cw_propval('order') |
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
282 |
# default to 9999 so view boxes occurs after component boxes |
65a619eb31c4
[boxes] introduce new boxes system
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6139
diff
changeset
|
283 |
return x.cw_extra_kwargs.get('dispctrl', {}).get('order', 9999) |
3975
569771016abb
add a fourth item to 'view box' defintion, dispctrl, so that
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3974
diff
changeset
|
284 |
return sorted(sideboxes, key=get_order) |
1491
742aff97dbf7
move AutomaticEntityForm and PrimaryView into their own module
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
285 |
|
1739 | 286 |
def _section_def(self, entity, where): |
287 |
rdefs = [] |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
288 |
eschema = entity.e_schema |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
289 |
for rschema, tschemas, role in eschema.relation_definitions(True): |
5065
01d85f3a3d9e
[primary view] skip virtual rtypes anyway
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4742
diff
changeset
|
290 |
if rschema in VIRTUAL_RTYPES: |
01d85f3a3d9e
[primary view] skip virtual rtypes anyway
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4742
diff
changeset
|
291 |
continue |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
292 |
matchtschemas = [] |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
293 |
for tschema in tschemas: |
1739 | 294 |
section = self.rsection.etype_get(eschema, rschema, role, |
295 |
tschema) |
|
296 |
if section == where: |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
297 |
matchtschemas.append(tschema) |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
298 |
if matchtschemas: |
6234
ae97a8c818e5
[primary view] don't need to pick arbitrary target, this is properly handled by the rtag
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6113
diff
changeset
|
299 |
dispctrl = self.display_ctrl.etype_get(eschema, rschema, role, '*') |
1739 | 300 |
rdefs.append( (rschema, matchtschemas, role, dispctrl) ) |
301 |
return sorted(rdefs, key=lambda x: x[-1]['order']) |
|
302 |
||
8736
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
303 |
def _relation_rset(self, entity, rschema, role, dispctrl, limit=None): |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
304 |
try: |
8736
b84a233cb8b0
[views/primary] some inner sections should use the `limit` by default to avoid a denial of service (closes #2719110)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8666
diff
changeset
|
305 |
rset = entity.related(rschema.type, role, limit=limit) |
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
306 |
except Unauthorized: |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
307 |
return |
1739 | 308 |
if 'filter' in dispctrl: |
309 |
rset = dispctrl['filter'](rset) |
|
1554
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
310 |
return rset |
3a3263df6cdd
new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents:
1516
diff
changeset
|
311 |
|
6090
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
312 |
def _rel_label(self, entity, rschema, role, dispctrl): |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
313 |
if rschema.final: |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
314 |
showlabel = dispctrl.get('showlabel', self.show_attr_label) |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
315 |
else: |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
316 |
showlabel = dispctrl.get('showlabel', self.show_rel_label) |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
317 |
if showlabel: |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
318 |
if dispctrl.get('label'): |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
319 |
label = self._cw._(dispctrl['label']) |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
320 |
else: |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
321 |
label = display_name(self._cw, rschema.type, role, |
8900
010a59e12d89
use cw_etype instead of __regid__
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
8736
diff
changeset
|
322 |
context=entity.cw_etype) |
6090
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
323 |
return label |
887c069d88df
[primary] backport _rel_label method from the default branch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6086
diff
changeset
|
324 |
return u'' |
1516
288d55a7c5e2
refactor side boxes handling of primary view
sylvain.thenault@logilab.fr
parents:
1491
diff
changeset
|
325 |
|
6093
9001a74fcc82
more generic dot graph generator
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
6090
diff
changeset
|
326 |
|
1516
288d55a7c5e2
refactor side boxes handling of primary view
sylvain.thenault@logilab.fr
parents:
1491
diff
changeset
|
327 |
class RelatedView(EntityView): |
6283
c827fa795a6b
[reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6255
diff
changeset
|
328 |
"""Display a rset, usually containing entities linked to another entity |
c827fa795a6b
[reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6255
diff
changeset
|
329 |
being displayed. |
c827fa795a6b
[reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6255
diff
changeset
|
330 |
|
c827fa795a6b
[reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6255
diff
changeset
|
331 |
It will try to display nicely according to the number of items in the result |
c827fa795a6b
[reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6255
diff
changeset
|
332 |
set. |
7838
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
333 |
|
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
334 |
XXX include me in the doc |
6283
c827fa795a6b
[reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6255
diff
changeset
|
335 |
""" |
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3072
diff
changeset
|
336 |
__regid__ = 'autolimited' |
3681
cdbe4aac1198
fix max-related of related entities handling in primary view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3071
diff
changeset
|
337 |
|
3705
5cd35123866b
get dispctrl through extra_kwargs to avoid error when a custom view is specified (potentially not taking any argument)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3689
diff
changeset
|
338 |
def call(self, **kwargs): |
4072
ead446e70c28
some api update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4004
diff
changeset
|
339 |
if 'dispctrl' in self.cw_extra_kwargs: |
6291
f6cba3be6ba2
[primary view] we should not limit related rset, else if something else than autolimited view is used, some content will be missed without a 'view all' link
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6290
diff
changeset
|
340 |
if 'limit' in self.cw_extra_kwargs['dispctrl']: |
f6cba3be6ba2
[primary view] we should not limit related rset, else if something else than autolimited view is used, some content will be missed without a 'view all' link
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6290
diff
changeset
|
341 |
limit = self.cw_extra_kwargs['dispctrl']['limit'] |
f6cba3be6ba2
[primary view] we should not limit related rset, else if something else than autolimited view is used, some content will be missed without a 'view all' link
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6290
diff
changeset
|
342 |
else: |
f6cba3be6ba2
[primary view] we should not limit related rset, else if something else than autolimited view is used, some content will be missed without a 'view all' link
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6290
diff
changeset
|
343 |
limit = self._cw.property_value('navigation.related-limit') |
6288
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
344 |
list_limit = self.cw_extra_kwargs['dispctrl'].get('use_list_limit', 5) |
5520
2d7f135846ee
[primary view] allow new 'subvid' parameter in primaryview_display_ctrl
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5519
diff
changeset
|
345 |
subvid = self.cw_extra_kwargs['dispctrl'].get('subvid', 'incontext') |
3705
5cd35123866b
get dispctrl through extra_kwargs to avoid error when a custom view is specified (potentially not taking any argument)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3689
diff
changeset
|
346 |
else: |
6288
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
347 |
limit = list_limit = None |
5520
2d7f135846ee
[primary view] allow new 'subvid' parameter in primaryview_display_ctrl
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5519
diff
changeset
|
348 |
subvid = 'incontext' |
3720 | 349 |
if limit is None or self.cw_rset.rowcount <= limit: |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
350 |
if self.cw_rset.rowcount == 1: |
5520
2d7f135846ee
[primary view] allow new 'subvid' parameter in primaryview_display_ctrl
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5519
diff
changeset
|
351 |
self.wview(subvid, self.cw_rset, row=0) |
6288
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
352 |
elif list_limit is None or 1 < self.cw_rset.rowcount <= list_limit: |
5520
2d7f135846ee
[primary view] allow new 'subvid' parameter in primaryview_display_ctrl
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5519
diff
changeset
|
353 |
self.wview('csv', self.cw_rset, subvid=subvid) |
1516
288d55a7c5e2
refactor side boxes handling of primary view
sylvain.thenault@logilab.fr
parents:
1491
diff
changeset
|
354 |
else: |
288d55a7c5e2
refactor side boxes handling of primary view
sylvain.thenault@logilab.fr
parents:
1491
diff
changeset
|
355 |
self.w(u'<div>') |
5520
2d7f135846ee
[primary view] allow new 'subvid' parameter in primaryview_display_ctrl
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5519
diff
changeset
|
356 |
self.wview('simplelist', self.cw_rset, subvid=subvid) |
1516
288d55a7c5e2
refactor side boxes handling of primary view
sylvain.thenault@logilab.fr
parents:
1491
diff
changeset
|
357 |
self.w(u'</div>') |
288d55a7c5e2
refactor side boxes handling of primary view
sylvain.thenault@logilab.fr
parents:
1491
diff
changeset
|
358 |
# else show links to display related entities |
288d55a7c5e2
refactor side boxes handling of primary view
sylvain.thenault@logilab.fr
parents:
1491
diff
changeset
|
359 |
else: |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
360 |
rql = self.cw_rset.printable_rql() |
6476
de7f53cf75ec
[primary] fix autolimited view which was not limited at all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6446
diff
changeset
|
361 |
rset = self.cw_rset.limit(limit) # remove extra entity |
6288
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
362 |
if list_limit is None: |
6476
de7f53cf75ec
[primary] fix autolimited view which was not limited at all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6446
diff
changeset
|
363 |
self.wview('csv', rset, subvid=subvid) |
6288
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
364 |
self.w(u'[<a href="%s">%s</a>]' % ( |
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
365 |
xml_escape(self._cw.build_url(rql=rql, vid=subvid)), |
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
366 |
self._cw._('see them all'))) |
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
367 |
else: |
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
368 |
self.w(u'<div>') |
6476
de7f53cf75ec
[primary] fix autolimited view which was not limited at all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6446
diff
changeset
|
369 |
self.wview('simplelist', rset, subvid=subvid) |
6288
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
370 |
self.w(u'[<a href="%s">%s</a>]' % ( |
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
371 |
xml_escape(self._cw.build_url(rql=rql, vid=subvid)), |
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
372 |
self._cw._('see them all'))) |
17cd9ae3d2d5
[primary view] introducing use_list_limit in pvdc fix reledit regression on the way (introducted a few changesets ago)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6283
diff
changeset
|
373 |
self.w(u'</div>') |
2652
3753f3a07ca1
[refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2402
diff
changeset
|
374 |
|
3971
7cfbc35dce7e
new generic urlattr view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3970
diff
changeset
|
375 |
|
6246
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
376 |
class AttributeView(EntityView): |
7838
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
377 |
""":__regid__: *attribute* |
6246
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
378 |
|
7838
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
379 |
This view is generally used to disable the *reledit* feature. It works on |
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
380 |
both relations and attributes. |
6246
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
381 |
""" |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
382 |
__regid__ = 'attribute' |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
383 |
__select__ = EntityView.__select__ & match_kwargs('rtype') |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
384 |
|
8201
2ceb28e6aa76
[views/attribute] role parameter must default to "subject" (closes #2175427)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
7990
diff
changeset
|
385 |
def entity_call(self, entity, rtype, role='subject', **kwargs): |
6246
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
386 |
if self._cw.vreg.schema.rschema(rtype).final: |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
387 |
self.w(entity.printable_value(rtype)) |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
388 |
else: |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
389 |
dispctrl = uicfg.primaryview_display_ctrl.etype_get( |
6582
8eb7883b4223
[pylint] fix a bug of pylint detected errors and i18n pb (calling builtins._ instead of req._)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6500
diff
changeset
|
390 |
entity.e_schema, rtype, role, '*') |
6246
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
391 |
rset = entity.related(rtype, role) |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
392 |
if rset: |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
393 |
self.wview('autolimited', rset, initargs={'dispctrl': dispctrl}) |
62e25fac41cd
[views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
6235
diff
changeset
|
394 |
|
3971
7cfbc35dce7e
new generic urlattr view
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3970
diff
changeset
|
395 |
|
7847
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
396 |
class URLAttributeView(EntityView): |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
397 |
""":__regid__: *urlattr* |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
398 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
399 |
This view will wrap an attribute value (hence expect a string) into an '<a>' |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
400 |
HTML tag to display a clickable link. |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
401 |
""" |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
402 |
__regid__ = 'urlattr' |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
403 |
__select__ = EntityView.__select__ & match_kwargs('rtype') |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
404 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
405 |
def entity_call(self, entity, rtype, **kwargs): |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
406 |
url = entity.printable_value(rtype) |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
407 |
if url: |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
408 |
self.w(u'<a href="%s">%s</a>' % (url, url)) |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
409 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
410 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
411 |
class VerbatimAttributeView(EntityView): |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
412 |
""":__regid__: *verbatimattr* |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
413 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
414 |
This view will wrap an attribute value into an '<pre>' HTML tag to display |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
415 |
arbitrary text where EOL will be respected. It usually make sense for |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
416 |
attributes whose value is a multi-lines string where new lines matters. |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
417 |
""" |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
418 |
__regid__ = 'verbatimattr' |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
419 |
__select__ = EntityView.__select__ & match_kwargs('rtype') |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
420 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
421 |
def entity_call(self, entity, rtype, **kwargs): |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
422 |
value = entity.printable_value(rtype) |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
423 |
if value: |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
424 |
self.w(u'<pre>%s</pre>' % value) |
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
425 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
426 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
427 |
|
7be550fb337b
[primary view] add 'verbatim' attribute view (closes #1947475)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7844
diff
changeset
|
428 |
|
6446
878fcf10cead
[contextual components] missing layout for components in the toolbar
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6377
diff
changeset
|
429 |
|
878fcf10cead
[contextual components] missing layout for components in the toolbar
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6377
diff
changeset
|
430 |
class ToolbarLayout(component.Layout): |
7838
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
431 |
# XXX include me in the doc |
6446
878fcf10cead
[contextual components] missing layout for components in the toolbar
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6377
diff
changeset
|
432 |
__select__ = match_context('ctxtoolbar') |
878fcf10cead
[contextual components] missing layout for components in the toolbar
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6377
diff
changeset
|
433 |
|
878fcf10cead
[contextual components] missing layout for components in the toolbar
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6377
diff
changeset
|
434 |
def render(self, w): |
878fcf10cead
[contextual components] missing layout for components in the toolbar
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6377
diff
changeset
|
435 |
if self.init_rendering(): |
878fcf10cead
[contextual components] missing layout for components in the toolbar
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6377
diff
changeset
|
436 |
self.cw_extra_kwargs['view'].render_body(w) |
878fcf10cead
[contextual components] missing layout for components in the toolbar
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6377
diff
changeset
|
437 |
|
7838
ea1360938033
[doc] backport primary view documentation into the code, also document [URL]AttributeView
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7837
diff
changeset
|
438 |
|
2652
3753f3a07ca1
[refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2402
diff
changeset
|
439 |
## default primary ui configuration ########################################### |
3753f3a07ca1
[refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2402
diff
changeset
|
440 |
|
3875
c2bd7922cdaf
use shorter notation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3849
diff
changeset
|
441 |
_pvs = uicfg.primaryview_section |
6377
3bb415310d4f
[schema] introduce some new sets categorizing entity/relation types and benefits from them where possible
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6371
diff
changeset
|
442 |
for rtype in META_RTYPES: |
3875
c2bd7922cdaf
use shorter notation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3849
diff
changeset
|
443 |
_pvs.tag_subject_of(('*', rtype, '*'), 'hidden') |
c2bd7922cdaf
use shorter notation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3849
diff
changeset
|
444 |
_pvs.tag_object_of(('*', rtype, '*'), 'hidden') |