web/uicfg.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 27 Jul 2009 18:36:30 +0200
changeset 2515 5d3cd163e2db
parent 2505 5d7d4af9eadf
child 2640 de355ee59e52
permissions -rw-r--r--
meta is gone away
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     1
"""This module regroups a set of structures that may be used to configure
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     2
various places of the generated web interface.
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     3
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     4
Primary view configuration
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     5
``````````````````````````
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     6
:primaryview_section:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     7
   where to display a relation in primary view. Value may be one of:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     8
   * 'attributes', display in the attributes section
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
     9
   * 'relations', display in the relations section (below attributes)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    10
   * 'sideboxes', display in the side boxes (beside attributes)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    11
   * 'hidden', don't display
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    12
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    13
:primaryview_display_ctrl:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    14
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    15
   how to display a relation in primary view. Values are dict with some of the
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    16
   following keys:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    17
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    18
   :vid:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    19
      identifier of a view to use to display the result set. Defaults depends on
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    20
      the section:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    21
      * 'attributes' section: 'reledit' view
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    22
      * 'relations' section: 'autolimited' view
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    23
      * 'sideboxes' section: 'sidebox' view
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    24
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    25
   :label:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    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
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    28
   :limit:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    29
      boolean telling if the results should be limited according to the
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    30
      configuration
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    31
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    32
   :filter:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    33
      callback taking the related result set as argument and returning it
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    34
      filtered
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    35
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    36
   :order:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    37
      int used to control order within a section. When not specified,
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    38
      automatically set according to order in which tags are added.
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    39
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    40
   Notice those values are only considered if the relation is in a displayed
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    41
   section (controlled by :attr:`primaryview_section`)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    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
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    44
Index view configuration
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    45
````````````````````````
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    46
:indexview_etype_section:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    47
   entity type category in the index/manage page. May be one of
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    48
   * 'application'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    49
   * 'system'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    50
   * 'schema'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    51
   * 'subobject' (not displayed by default)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    52
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    53
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    54
Actions box configuration
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    55
`````````````````````````
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    56
:actionbox_appearsin_addmenu:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    57
  simple boolean relation tags used to control the "add entity" submenu.
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    58
  Relations whose rtag is True will appears, other won't.
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    59
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    60
Automatic form configuration
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    61
````````````````````````````
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    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
bcd4bfff658b update rtags api
sylvain.thenault@logilab.fr
parents: 1498
diff changeset
    69
1944
a1b1d4f8482c similar method already exists
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1878
diff changeset
    70
from cubicweb import neg_role
2369
5a2b8ed266ca new RelationTagsDict class, use it in uicfg where necessary
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2191
diff changeset
    71
from cubicweb.rtags import (RelationTags, RelationTagsBool,
5a2b8ed266ca new RelationTagsDict class, use it in uicfg where necessary
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2191
diff changeset
    72
                            RelationTagsSet, RelationTagsDict)
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    73
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
    74
1745
7e7f04d19a98 a bunch of NameError (!) // needs review //
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1742
diff changeset
    75
1746
67a9b86fd479 oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1745
diff changeset
    76
def card_from_role(card, role):
67a9b86fd479 oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1745
diff changeset
    77
    if role == 'subject':
67a9b86fd479 oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1745
diff changeset
    78
        return card[0]
67a9b86fd479 oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1745
diff changeset
    79
    assert role in ('object', 'sobject'), repr(role)
67a9b86fd479 oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1745
diff changeset
    80
    return card[1]
67a9b86fd479 oops, keep python 2.4 compat
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1745
diff changeset
    81
1944
a1b1d4f8482c similar method already exists
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1878
diff changeset
    82
# primary view configuration ##################################################
a1b1d4f8482c similar method already exists
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1878
diff changeset
    83
1742
25a765e756c4 fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1739
diff changeset
    84
def init_primaryview_section(rtag, sschema, rschema, oschema, role):
25a765e756c4 fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1739
diff changeset
    85
    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
    86
        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
    87
        composed = rschema.rproperty(sschema, oschema, 'composite') == neg_role(role)
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    88
        if rschema.is_final():
1745
7e7f04d19a98 a bunch of NameError (!) // needs review //
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1742
diff changeset
    89
            if rschema.meta or oschema.type in ('Password', 'Bytes'):
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    90
                section = 'hidden'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    91
            else:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    92
                section = 'attributes'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    93
        elif card in '1+':
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    94
            section = 'attributes'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    95
        elif composed:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    96
            section = 'relations'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    97
        else:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
    98
            section = 'sideboxes'
1742
25a765e756c4 fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1739
diff changeset
    99
        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
   100
1849
1901fa97f521 give a name to rtags instance to ease debugging
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1819
diff changeset
   101
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
   102
                                   init_primaryview_section,
1901fa97f521 give a name to rtags instance to ease debugging
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1819
diff changeset
   103
                                   frozenset(('attributes', 'relations',
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   104
                                               'sideboxes', 'hidden')))
2465
cc18a700a2be hide cwuri from web forms
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2381
diff changeset
   105
for rtype in ('eid', 'creation_date', 'modification_date', 'cwuri',
1554
3a3263df6cdd new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents: 1533
diff changeset
   106
              'is', 'is_instance_of', 'identity',
3a3263df6cdd new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents: 1533
diff changeset
   107
              'owned_by', 'created_by',
3a3263df6cdd new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents: 1533
diff changeset
   108
              '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
   109
              'from_entity', 'to_entity',
3a3263df6cdd new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents: 1533
diff changeset
   110
              'see_also'):
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   111
    primaryview_section.tag_subject_of(('*', rtype, '*'), 'hidden')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   112
    primaryview_section.tag_object_of(('*', rtype, '*'), 'hidden')
1878
204b79e3e0ec default email relations configuration
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1849
diff changeset
   113
primaryview_section.tag_subject_of(('*', 'use_email', '*'), 'attributes')
204b79e3e0ec default email relations configuration
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1849
diff changeset
   114
primaryview_section.tag_subject_of(('*', 'primary_email', '*'), 'hidden')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   115
2515
5d3cd163e2db meta is gone away
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2505
diff changeset
   116
for attr in ('name', 'final'):
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   117
    primaryview_section.tag_attribute(('CWEType', attr), 'hidden')
2515
5d3cd163e2db meta is gone away
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2505
diff changeset
   118
for attr in ('name', 'final', 'symetric', 'inlined'):
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   119
    primaryview_section.tag_attribute(('CWRType', attr), 'hidden')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   120
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   121
2369
5a2b8ed266ca new RelationTagsDict class, use it in uicfg where necessary
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2191
diff changeset
   122
class DisplayCtrlRelationTags(RelationTagsDict):
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   123
    def __init__(self, *args, **kwargs):
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   124
        super(DisplayCtrlRelationTags, self).__init__(*args, **kwargs)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   125
        self._counter = 0
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   126
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   127
    def tag_relation(self, key, tag):
2369
5a2b8ed266ca new RelationTagsDict class, use it in uicfg where necessary
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2191
diff changeset
   128
        tag = super(DisplayCtrlRelationTags, self).tag_relation(key, tag)
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   129
        self._counter += 1
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   130
        tag.setdefault('order', self._counter)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   131
2191
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   132
    def tag_subject_of(self, key, tag):
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   133
        subj, rtype, obj = key
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   134
        if obj != '*':
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   135
            self.warning('using explict target type in display_ctrl.tag_subject_of() '
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   136
                         'has no effect, use (%s, %s, "*") instead of (%s, %s, %s)',
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   137
                         subj, rtype, subj, rtype, obj)
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   138
        super(DisplayCtrlRelationTags, self).tag_subject_of((subj, rtype, '*'), tag)
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   139
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   140
    def tag_object_of(self, key, tag):
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   141
        subj, rtype, obj = key
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   142
        if subj != '*':
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   143
            self.warning('using explict subject type in display_ctrl.tag_object_of() '
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   144
                         'has no effect, use ("*", %s, %s) instead of (%s, %s, %s)',
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   145
                         rtype, obj, subj, rtype, obj)
1f0fde12e35b [rtags] override tag_xxx_of() methods in DisplayCtrlRelationTags to make sure a wildcard is used
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
   146
        super(DisplayCtrlRelationTags, self).tag_object_of(('*', rtype, obj), tag)
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   147
1742
25a765e756c4 fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1739
diff changeset
   148
def init_primaryview_display_ctrl(rtag, sschema, rschema, oschema, role):
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   149
    if role == 'subject':
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   150
        oschema = '*'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   151
        label = rschema.type
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   152
    else:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   153
        sschema = '*'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   154
        label = '%s_%s' % (rschema, role)
2369
5a2b8ed266ca new RelationTagsDict class, use it in uicfg where necessary
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2191
diff changeset
   155
    rtag.setdefault((sschema, rschema, oschema, role), 'label', label)
5a2b8ed266ca new RelationTagsDict class, use it in uicfg where necessary
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2191
diff changeset
   156
    rtag.setdefault((sschema, rschema, oschema, role), 'order', rtag._counter)
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   157
1849
1901fa97f521 give a name to rtags instance to ease debugging
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1819
diff changeset
   158
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
   159
                                                   init_primaryview_display_ctrl)
1554
3a3263df6cdd new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents: 1533
diff changeset
   160
3a3263df6cdd new primary view using uicfg.rdisplay (major api cleanup)
sylvain.thenault@logilab.fr
parents: 1533
diff changeset
   161
1631
8370be19afd7 configurable entity types tables
sylvain.thenault@logilab.fr
parents: 1604
diff changeset
   162
# index view configuration ####################################################
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   163
# 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
   164
# * 'application'
8370be19afd7 configurable entity types tables
sylvain.thenault@logilab.fr
parents: 1604
diff changeset
   165
# * 'system'
8370be19afd7 configurable entity types tables
sylvain.thenault@logilab.fr
parents: 1604
diff changeset
   166
# * 'schema'
8370be19afd7 configurable entity types tables
sylvain.thenault@logilab.fr
parents: 1604
diff changeset
   167
# * 'subobject' (not displayed by default)
8370be19afd7 configurable entity types tables
sylvain.thenault@logilab.fr
parents: 1604
diff changeset
   168
2126
a25859917ccc stop using meta attribute from yams schema. Use instead sets defining meta relations and another defining schema types. Refactor various schema view based on this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   169
indexview_etype_section = {'EmailAddress': 'subobject',
a25859917ccc stop using meta attribute from yams schema. Use instead sets defining meta relations and another defining schema types. Refactor various schema view based on this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   170
                           'CWUser': 'system',
a25859917ccc stop using meta attribute from yams schema. Use instead sets defining meta relations and another defining schema types. Refactor various schema view based on this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   171
                           'CWGroup': 'system',
a25859917ccc stop using meta attribute from yams schema. Use instead sets defining meta relations and another defining schema types. Refactor various schema view based on this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   172
                           'CWPermission': 'system',
a25859917ccc stop using meta attribute from yams schema. Use instead sets defining meta relations and another defining schema types. Refactor various schema view based on this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   173
                           }
1631
8370be19afd7 configurable entity types tables
sylvain.thenault@logilab.fr
parents: 1604
diff changeset
   174
8370be19afd7 configurable entity types tables
sylvain.thenault@logilab.fr
parents: 1604
diff changeset
   175
1498
2c6eec0b46b9 fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents: 1468
diff changeset
   176
# 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
   177
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   178
# relations'section (eg primary/secondary/generic/metadata/generated)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   179
1742
25a765e756c4 fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1739
diff changeset
   180
def init_autoform_section(rtag, sschema, rschema, oschema, role):
25a765e756c4 fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1739
diff changeset
   181
    if rtag.get(sschema, rschema, oschema, role) is None:
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   182
        if role == 'subject':
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   183
            card = rschema.rproperty(sschema, oschema, 'cardinality')[0]
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   184
            composed = rschema.rproperty(sschema, oschema, 'composite') == 'object'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   185
        else:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   186
            card = rschema.rproperty(sschema, oschema, 'cardinality')[1]
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   187
            composed = rschema.rproperty(sschema, oschema, 'composite') == 'subject'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   188
        if sschema.is_metadata(rschema):
2505
5d7d4af9eadf fix some default autoform_section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2465
diff changeset
   189
            section = 'metadata'
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   190
        elif card in '1+':
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   191
            if not rschema.is_final() and composed:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   192
                section = 'generated'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   193
            else:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   194
                section = 'primary'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   195
        elif rschema.is_final():
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   196
            section = 'secondary'
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   197
        else:
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   198
            section = 'generic'
1742
25a765e756c4 fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1739
diff changeset
   199
        rtag.tag_relation((sschema, rschema, oschema, role), section)
1721
694f6a50e138 final rtags api (eventually :$)
sylvain.thenault@logilab.fr
parents: 1631
diff changeset
   200
1849
1901fa97f521 give a name to rtags instance to ease debugging
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1819
diff changeset
   201
autoform_section = RelationTags('autoform_section', init_autoform_section,
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   202
                                set(('primary', 'secondary', 'generic',
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   203
                                     'metadata', 'generated')))
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   204
# use primary and not generated for eid since it has to be an hidden
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   205
autoform_section.tag_attribute(('*', 'eid'), 'primary')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   206
autoform_section.tag_attribute(('*', 'description'), 'secondary')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   207
autoform_section.tag_attribute(('*', 'creation_date'), 'metadata')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   208
autoform_section.tag_attribute(('*', 'modification_date'), 'metadata')
2465
cc18a700a2be hide cwuri from web forms
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2381
diff changeset
   209
autoform_section.tag_attribute(('*', 'cwuri'), 'metadata')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   210
autoform_section.tag_attribute(('*', 'has_text'), 'generated')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   211
autoform_section.tag_subject_of(('*', 'in_state', '*'), 'primary')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   212
autoform_section.tag_subject_of(('*', 'owned_by', '*'), 'metadata')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   213
autoform_section.tag_subject_of(('*', 'created_by', '*'), 'metadata')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   214
autoform_section.tag_subject_of(('*', 'is', '*'), 'generated')
1747
d48613e65196 typos, wrong etypes
sylvain.thenault@logilab.fr
parents: 1746
diff changeset
   215
autoform_section.tag_object_of(('*', 'is', '*'), 'generated')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   216
autoform_section.tag_subject_of(('*', 'is_instance_of', '*'), 'generated')
1747
d48613e65196 typos, wrong etypes
sylvain.thenault@logilab.fr
parents: 1746
diff changeset
   217
autoform_section.tag_object_of(('*', 'is_instance_of', '*'), 'generated')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   218
autoform_section.tag_subject_of(('*', 'identity', '*'), 'generated')
1747
d48613e65196 typos, wrong etypes
sylvain.thenault@logilab.fr
parents: 1746
diff changeset
   219
autoform_section.tag_object_of(('*', 'identity', '*'), 'generated')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   220
autoform_section.tag_subject_of(('*', 'require_permission', '*'), 'generated')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   221
autoform_section.tag_subject_of(('*', 'wf_info_for', '*'), 'generated')
1747
d48613e65196 typos, wrong etypes
sylvain.thenault@logilab.fr
parents: 1746
diff changeset
   222
autoform_section.tag_object_of(('*', 'wf_info_for', '*'), 'generated')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   223
autoform_section.tag_subject_of(('*', 'for_user', '*'), 'generated')
1747
d48613e65196 typos, wrong etypes
sylvain.thenault@logilab.fr
parents: 1746
diff changeset
   224
autoform_section.tag_object_of(('*', 'for_user', '*'), 'generated')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   225
autoform_section.tag_subject_of(('CWPermission', 'require_group', '*'), 'primary')
1747
d48613e65196 typos, wrong etypes
sylvain.thenault@logilab.fr
parents: 1746
diff changeset
   226
autoform_section.tag_attribute(('CWEType', 'final'), 'generated')
d48613e65196 typos, wrong etypes
sylvain.thenault@logilab.fr
parents: 1746
diff changeset
   227
autoform_section.tag_attribute(('CWRType', 'final'), 'generated')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   228
autoform_section.tag_attribute(('CWUser', 'firstname'), 'secondary')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   229
autoform_section.tag_attribute(('CWUser', 'surname'), 'secondary')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   230
autoform_section.tag_attribute(('CWUser', 'last_login_time'), 'metadata')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   231
autoform_section.tag_subject_of(('CWUser', 'in_group', '*'), 'primary')
2505
5d7d4af9eadf fix some default autoform_section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2465
diff changeset
   232
autoform_section.tag_object_of(('*', 'owned_by', 'CWUser'), 'metadata')
5d7d4af9eadf fix some default autoform_section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2465
diff changeset
   233
autoform_section.tag_object_of(('*', 'created_by', 'CWUser'), 'metadata')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   234
autoform_section.tag_object_of(('*', 'bookmarked_by', 'CWUser'), 'metadata')
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   235
autoform_section.tag_attribute(('Bookmark', 'path'), 'primary')
1797
c2a80130b06d fix some web tests, adjusts rtags
sylvain.thenault@logilab.fr
parents: 1754
diff changeset
   236
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
   237
autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   238
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
   239
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
   240
# 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
   241
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
   242
1754
c9c7618a90de autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents: 1747
diff changeset
   243
# relations'field explicit kwargs (given to field's __init__)
2369
5a2b8ed266ca new RelationTagsDict class, use it in uicfg where necessary
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2191
diff changeset
   244
autoform_field_kwargs = RelationTagsDict()
1754
c9c7618a90de autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents: 1747
diff changeset
   245
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
   246
                                    {'widget': formwidgets.TextInput})
c9c7618a90de autoform_widget superseeded by autoform_field_kwargs (api change addiction :-/)
sylvain.thenault@logilab.fr
parents: 1747
diff changeset
   247
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
   248
                                    {'widget': formwidgets.TextInput})
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   249
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   250
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
   251
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
# 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
   253
# 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
   254
# 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
   255
autoform_is_inlined = RelationTagsBool('autoform_is_inlined')
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   256
autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   257
autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   258
autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   259
autoform_is_inlined.tag_subject_of(('CWRelation', 'to_entity', '*'), True)
1604
fd943737d630 delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1554
diff changeset
   260
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
   261
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
   262
# 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
   263
# 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
   264
# 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
   265
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
   266
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
   267
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
   268
# 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
   269
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
   270
# '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
   271
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
   272
    if rtag.get(sschema, rschema, oschema, role) is None:
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   273
        card = rschema.rproperty(sschema, oschema, 'cardinality')[role == 'object']
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   274
        if not card in '?1' and \
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   275
               rschema.rproperty(sschema, oschema, 'composite') == role:
1742
25a765e756c4 fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1739
diff changeset
   276
            rtag.tag_relation((sschema, rschema, oschema, role), True)
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   277
1849
1901fa97f521 give a name to rtags instance to ease debugging
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1819
diff changeset
   278
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
   279
                                               init_actionbox_appearsin_addmenu)
1739
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   280
actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   281
actionbox_appearsin_addmenu.tag_object_of(('*', 'is', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   282
actionbox_appearsin_addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   283
actionbox_appearsin_addmenu.tag_object_of(('*', 'is_instance_of', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   284
actionbox_appearsin_addmenu.tag_subject_of(('*', 'identity', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   285
actionbox_appearsin_addmenu.tag_object_of(('*', 'identity', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   286
actionbox_appearsin_addmenu.tag_subject_of(('*', 'owned_by', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   287
actionbox_appearsin_addmenu.tag_subject_of(('*', 'created_by', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   288
actionbox_appearsin_addmenu.tag_subject_of(('*', 'require_permission', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   289
actionbox_appearsin_addmenu.tag_subject_of(('*', 'wf_info_for', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   290
actionbox_appearsin_addmenu.tag_object_of(('*', 'wf_info_for', '*'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   291
actionbox_appearsin_addmenu.tag_object_of(('*', 'state_of', 'CWEType'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   292
actionbox_appearsin_addmenu.tag_object_of(('*', 'transition_of', 'CWEType'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   293
actionbox_appearsin_addmenu.tag_object_of(('*', 'relation_type', 'CWRType'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   294
actionbox_appearsin_addmenu.tag_object_of(('*', 'from_entity', 'CWEType'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   295
actionbox_appearsin_addmenu.tag_object_of(('*', 'to_entity', 'CWEType'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   296
actionbox_appearsin_addmenu.tag_object_of(('*', 'in_group', 'CWGroup'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   297
actionbox_appearsin_addmenu.tag_object_of(('*', 'owned_by', 'CWUser'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   298
actionbox_appearsin_addmenu.tag_object_of(('*', 'created_by', 'CWUser'), False)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   299
actionbox_appearsin_addmenu.tag_object_of(('*', 'bookmarked_by', 'CWUser'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   300
actionbox_appearsin_addmenu.tag_subject_of(('Transition', 'destination_state', '*'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   301
actionbox_appearsin_addmenu.tag_object_of(('*', 'allowed_transition', 'Transition'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   302
actionbox_appearsin_addmenu.tag_object_of(('*', 'destination_state', 'State'), True)
78b0819162a8 final rtag api
sylvain.thenault@logilab.fr
parents: 1723
diff changeset
   303
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
   304