web/views/actions.py
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 08 Nov 2009 19:37:08 +0100
branchstable
changeset 3807 8ae53322ffcc
parent 3689 deb13e88e037
child 3720 5376aaadd16b
child 3877 7ca53fc72a0a
child 4212 ab6573088b4a
permissions -rw-r--r--
[web ui] change "table actions" icon to arrow-up
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     1
"""Set of HTML base actions
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     2
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     3
:organization: Logilab
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1829
diff changeset
     4
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1829
diff changeset
     6
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
"""
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
__docformat__ = "restructuredtext en"
2121
9a14e1ee0eab cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
     9
_ = unicode
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    10
2657
de974465d381 [appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2652
diff changeset
    11
from cubicweb.appobject import objectify_selector
3495
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
    12
from cubicweb.selectors import (EntitySelector, yes,
1132
96752791c2b6 pylint cleanup
sylvain.thenault@logilab.fr
parents: 1091
diff changeset
    13
    one_line_rset, two_lines_rset, one_etype_rset, relation_possible,
1829
f54710fcdd62 avoid SelectAction selection to crash on startup views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1551
diff changeset
    14
    nonempty_rset, non_final_entity,
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    15
    authenticated_user, match_user_groups, match_search_state,
1178
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    16
    has_permission, has_add_permission,
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    17
    )
2701
afcc19c92072 fix #344895: view action should skip navigation parameters
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2161
diff changeset
    18
from cubicweb.web import uicfg, controller
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    19
from cubicweb.web.action import Action
824
a5e6acffde30 merge, split baseviews (new csvexport, xmlrss and editviews modules)
sylvain.thenault@logilab.fr
parents: 822
diff changeset
    20
from cubicweb.web.views import linksearch_select_url, vid_from_rset
1498
2c6eec0b46b9 fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents: 1465
diff changeset
    21
from cubicweb.web.views.autoform import AutomaticEntityForm
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    22
1178
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    23
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    24
class has_editable_relation(EntitySelector):
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    25
    """accept if some relations for an entity found in the result set is
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    26
    editable by the logged user.
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    27
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    28
    See `EntitySelector` documentation for behaviour when row is not specified.
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    29
    """
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    30
1178
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    31
    def score_entity(self, entity):
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    32
        # if user has no update right but it can modify some relation,
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    33
        # display action anyway
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    34
        for dummy in AutomaticEntityForm.esrelations_by_category(
3271
6c8504b2ade0 set strict when checking if edit action should be shown
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3228
diff changeset
    35
            entity, 'generic', 'add', strict=True):
1178
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    36
            return 1
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    37
        for rschema, targetschemas, role in AutomaticEntityForm.erelations_by_category(
3271
6c8504b2ade0 set strict when checking if edit action should be shown
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3228
diff changeset
    38
            entity, ('primary', 'secondary'), 'add', strict=True):
3689
deb13e88e037 follow yams 0.25 api changes to improve performance
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3495
diff changeset
    39
            if not rschema.final:
1178
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    40
                return 1
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    41
        return 0
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    42
728
a95b284150d1 first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 714
diff changeset
    43
@objectify_selector
2161
200481e7b156 prepare time where it won't be mandatory to give rset to select()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2121
diff changeset
    44
def match_searched_etype(cls, req, rset=None, **kwargs):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    45
    return req.match_search_state(rset)
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    46
728
a95b284150d1 first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 714
diff changeset
    47
@objectify_selector
2161
200481e7b156 prepare time where it won't be mandatory to give rset to select()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2121
diff changeset
    48
def view_is_not_default_view(cls, req, rset=None, **kwargs):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    49
    # interesting if it propose another view than the current one
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    50
    vid = req.form.get('vid')
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    51
    if vid and vid != vid_from_rset(req, rset, cls.schema):
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    52
        return 1
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    53
    return 0
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    54
728
a95b284150d1 first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 714
diff changeset
    55
@objectify_selector
2161
200481e7b156 prepare time where it won't be mandatory to give rset to select()
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2121
diff changeset
    56
def addable_etype_empty_rset(cls, req, rset=None, **kwargs):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    57
    if rset is not None and not rset.rowcount:
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    58
        rqlst = rset.syntax_tree()
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    59
        if len(rqlst.children) > 1:
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    60
            return 0
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    61
        select = rqlst.children[0]
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    62
        if len(select.defined_vars) == 1 and len(select.solutions) == 1:
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    63
            rset._searched_etype = select.solutions[0].itervalues().next()
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    64
            eschema = cls.schema.eschema(rset._searched_etype)
3689
deb13e88e037 follow yams 0.25 api changes to improve performance
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3495
diff changeset
    65
            if not (eschema.final or eschema.is_subobject(strict=True)) \
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    66
                   and eschema.has_perm(req, 'add'):
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    67
                return 1
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    68
    return 0
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    69
2470
569d6641f08c cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2439
diff changeset
    70
# generic 'main' actions #######################################################
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    71
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    72
class SelectAction(Action):
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    73
    """base class for link search actions. By default apply on
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    74
    any size entity result search it the current state is 'linksearch'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    75
    if accept match.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    76
    """
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    77
    id = 'select'
1829
f54710fcdd62 avoid SelectAction selection to crash on startup views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1551
diff changeset
    78
    __select__ = match_search_state('linksearch') & nonempty_rset() & match_searched_etype()
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    79
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    80
    title = _('select')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    81
    category = 'mainactions'
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    82
    order = 0
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    83
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    84
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    85
        return linksearch_select_url(self.req, self.rset)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    86
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    87
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    88
class CancelSelectAction(Action):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    89
    id = 'cancel'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
    90
    __select__ = match_search_state('linksearch')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    91
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    92
    title = _('cancel select')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    93
    category = 'mainactions'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    94
    order = 10
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    95
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    96
    def url(self):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    97
        target, eid, r_type, searched_type = self.req.search_state[1]
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
    98
        return self.build_url(str(eid),
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    99
                              vid='edition', __mode='normal')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   100
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   101
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   102
class ViewAction(Action):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   103
    id = 'view'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   104
    __select__ = (match_search_state('normal') &
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   105
                  match_user_groups('users', 'managers') &
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   106
                  view_is_not_default_view() &
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   107
                  non_final_entity())
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   108
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   109
    title = _('view')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   110
    category = 'mainactions'
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   111
    order = 0
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   112
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   113
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   114
        params = self.req.form.copy()
2701
afcc19c92072 fix #344895: view action should skip navigation parameters
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2161
diff changeset
   115
        for param in ('vid', '__message') + controller.NAV_FORM_PARAMETERS:
afcc19c92072 fix #344895: view action should skip navigation parameters
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2161
diff changeset
   116
            params.pop(param, None)
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   117
        return self.build_url(self.req.relative_path(includeparams=False),
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   118
                              **params)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   119
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   120
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   121
class ModifyAction(Action):
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   122
    id = 'edit'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   123
    __select__ = (match_search_state('normal') &
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   124
                  one_line_rset() &
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   125
                  (has_permission('update') | has_editable_relation('add')))
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   126
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   127
    title = _('modify')
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   128
    category = 'mainactions'
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   129
    order = 10
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   130
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   131
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   132
        entity = self.rset.get_entity(self.row or 0, self.col or 0)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   133
        return entity.absolute_url(vid='edition')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   134
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   135
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   136
class MultipleEditAction(Action):
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   137
    id = 'muledit' # XXX get strange conflicts if id='edit'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   138
    __select__ = (match_search_state('normal') &
753
17d38f000bea some minor __select__ composition fixes
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 728
diff changeset
   139
                  two_lines_rset() & one_etype_rset() &
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   140
                  has_permission('update'))
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   141
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   142
    title = _('modify')
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   143
    category = 'mainactions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   144
    order = 10
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   145
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   146
    def url(self):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   147
        return self.build_url('view', rql=self.rset.rql, vid='muledit')
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   148
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   149
2470
569d6641f08c cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2439
diff changeset
   150
# generic "more" actions #######################################################
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   151
690
ea613e8a5e4f should add relation_possible selector only if require_permission is in the schema
sylvain.thenault@logilab.fr
parents: 660
diff changeset
   152
class ManagePermissionsAction(Action):
781
323656dd85a9 fix import, use non_final_entity instead of implements('Any')
sylvain.thenault@logilab.fr
parents: 775
diff changeset
   153
    id = 'managepermission'
822
e3d8db01f3f5 test_views fixes
sylvain.thenault@logilab.fr
parents: 786
diff changeset
   154
    __select__ = one_line_rset() & non_final_entity() & match_user_groups('managers')
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   155
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   156
    title = _('manage permissions')
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   157
    category = 'moreactions'
1551
a41c1c0a9e13 fix manage permission order
sylvain.thenault@logilab.fr
parents: 1545
diff changeset
   158
    order = 15
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   159
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   160
    @classmethod
690
ea613e8a5e4f should add relation_possible selector only if require_permission is in the schema
sylvain.thenault@logilab.fr
parents: 660
diff changeset
   161
    def registered(cls, vreg):
710
766c881e101f overridden `registered()` methods must call the base implementation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 696
diff changeset
   162
        super(ManagePermissionsAction, cls).registered(vreg)
690
ea613e8a5e4f should add relation_possible selector only if require_permission is in the schema
sylvain.thenault@logilab.fr
parents: 660
diff changeset
   163
        if 'require_permission' in vreg.schema:
822
e3d8db01f3f5 test_views fixes
sylvain.thenault@logilab.fr
parents: 786
diff changeset
   164
            cls.__select__ = (one_line_rset() & non_final_entity() &
e3d8db01f3f5 test_views fixes
sylvain.thenault@logilab.fr
parents: 786
diff changeset
   165
                              (match_user_groups('managers')
1398
5fe84a5f7035 rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents: 1263
diff changeset
   166
                               | relation_possible('require_permission', 'subject', 'CWPermission',
822
e3d8db01f3f5 test_views fixes
sylvain.thenault@logilab.fr
parents: 786
diff changeset
   167
                                                   action='add')))
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   168
        return super(ManagePermissionsAction, cls).registered(vreg)
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   169
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   170
    def url(self):
1465
42f13c790f11 fix bug in actions: action.row/col might be None and can't be passed directly to rset.get_entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1452
diff changeset
   171
        return self.rset.get_entity(self.row or 0, self.col or 0).absolute_url(vid='security')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   172
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   173
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   174
class DeleteAction(Action):
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   175
    id = 'delete'
786
a261fee1bbde fix used selectors
sylvain.thenault@logilab.fr
parents: 781
diff changeset
   176
    __select__ = has_permission('delete')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   177
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   178
    title = _('delete')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   179
    category = 'moreactions'
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   180
    order = 20
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   181
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   182
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   183
        if len(self.rset) == 1:
1465
42f13c790f11 fix bug in actions: action.row/col might be None and can't be passed directly to rset.get_entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1452
diff changeset
   184
            entity = self.rset.get_entity(self.row or 0, self.col or 0)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   185
            return self.build_url(entity.rest_path(), vid='deleteconf')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   186
        return self.build_url(rql=self.rset.printable_rql(), vid='deleteconf')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   187
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   188
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   189
class CopyAction(Action):
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   190
    id = 'copy'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   191
    __select__ = one_line_rset() & has_permission('add')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   192
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   193
    title = _('copy')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   194
    category = 'moreactions'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   195
    order = 30
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   196
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   197
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   198
        entity = self.rset.get_entity(self.row or 0, self.col or 0)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   199
        return entity.absolute_url(vid='copy')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   200
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   201
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   202
class AddNewAction(MultipleEditAction):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   203
    """when we're seeing more than one entity with the same type, propose to
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   204
    add a new one
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   205
    """
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   206
    id = 'addentity'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   207
    __select__ = (match_search_state('normal') &
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   208
                  (addable_etype_empty_rset()
728
a95b284150d1 first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 714
diff changeset
   209
                   | (two_lines_rset() & one_etype_rset & has_add_permission()))
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   210
                  )
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   211
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   212
    category = 'moreactions'
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   213
    order = 40
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   214
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   215
    @property
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   216
    def rsettype(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   217
        if self.rset:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   218
            return self.rset.description[0][0]
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   219
        return self.rset._searched_etype
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   220
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   221
    @property
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   222
    def title(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   223
        return self.req.__('add a %s' % self.rsettype) # generated msgid
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   224
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   225
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   226
        return self.build_url('add/%s' % self.rsettype)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   227
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   228
3219
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   229
class AddRelatedActions(Action):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   230
    """fill 'addrelated' sub-menu of the actions box"""
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   231
    id = 'addrelated'
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   232
    __select__ = Action.__select__ & one_line_rset() & non_final_entity()
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   233
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   234
    submenu = _('addrelated')
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   235
    order = 20
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   236
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   237
    def fill_menu(self, box, menu):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   238
        # when there is only one item in the sub-menu, replace the sub-menu by
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   239
        # item's title prefixed by 'add'
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   240
        menu.label_prefix = self.req._('add')
3228
7b05b2709439 [actions] refactor: extract actual_actions from fill_menu to work with table filter form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3219
diff changeset
   241
        super(AddRelatedActions, self).fill_menu(box, menu)
7b05b2709439 [actions] refactor: extract actual_actions from fill_menu to work with table filter form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3219
diff changeset
   242
7b05b2709439 [actions] refactor: extract actual_actions from fill_menu to work with table filter form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3219
diff changeset
   243
    def actual_actions(self):
3219
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   244
        entity = self.rset.get_entity(self.row or 0, self.col or 0)
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   245
        eschema = entity.e_schema
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   246
        for rschema, teschema, x in self.add_related_schemas(entity):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   247
            if x == 'subject':
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   248
                label = 'add %s %s %s %s' % (eschema, rschema, teschema, x)
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   249
                url = self.linkto_url(entity, rschema, teschema, 'object')
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   250
            else:
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   251
                label = 'add %s %s %s %s' % (teschema, rschema, eschema, x)
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   252
                url = self.linkto_url(entity, rschema, teschema, 'subject')
3228
7b05b2709439 [actions] refactor: extract actual_actions from fill_menu to work with table filter form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3219
diff changeset
   253
            yield self.build_action(self.req._(label), url)
3219
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   254
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   255
    def add_related_schemas(self, entity):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   256
        """this is actually used ui method to generate 'addrelated' actions from
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   257
        the schema.
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   258
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   259
        If you don't want any auto-generated actions, you should overrides this
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   260
        method to return an empty list. If you only want some, you can configure
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   261
        them by using uicfg.actionbox_appearsin_addmenu
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   262
        """
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   263
        appearsin_addmenu = uicfg.actionbox_appearsin_addmenu
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   264
        req = self.req
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   265
        eschema = entity.e_schema
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   266
        for role, rschemas in (('subject', eschema.subject_relations()),
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   267
                               ('object', eschema.object_relations())):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   268
            for rschema in rschemas:
3689
deb13e88e037 follow yams 0.25 api changes to improve performance
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3495
diff changeset
   269
                if rschema.final:
3219
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   270
                    continue
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   271
                # check the relation can be added as well
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   272
                # XXX consider autoform_permissions_overrides?
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   273
                if role == 'subject'and not rschema.has_perm(req, 'add',
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   274
                                                             fromeid=entity.eid):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   275
                    continue
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   276
                if role == 'object'and not rschema.has_perm(req, 'add',
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   277
                                                            toeid=entity.eid):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   278
                    continue
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   279
                # check the target types can be added as well
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   280
                for teschema in rschema.targets(eschema, role):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   281
                    if not appearsin_addmenu.etype_get(eschema, rschema,
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   282
                                                       role, teschema):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   283
                        continue
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   284
                    if teschema.has_local_role('add') or teschema.has_perm(req, 'add'):
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   285
                        yield rschema, teschema, role
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   286
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   287
    def linkto_url(self, entity, rtype, etype, target):
3272
f46f2082468b nicer add urls
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3271
diff changeset
   288
        return self.build_url('add/%s' % etype,
3219
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   289
                              __linkto='%s:%s:%s' % (rtype, entity.eid, target),
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   290
                              __redirectpath=entity.rest_path(), # should not be url quoted!
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   291
                              __redirectvid=self.req.form.get('vid', ''))
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   292
be8cfc00ae04 edit box refactoring to gain more control by using actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2715
diff changeset
   293
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   294
# logged user actions #########################################################
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   295
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   296
class UserPreferencesAction(Action):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   297
    id = 'myprefs'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   298
    __select__ = authenticated_user()
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   299
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   300
    title = _('user preferences')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   301
    category = 'useractions'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   302
    order = 10
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   303
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   304
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   305
        return self.build_url(self.id)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   306
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   307
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   308
class UserInfoAction(Action):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   309
    id = 'myinfos'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   310
    __select__ = authenticated_user()
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   311
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   312
    title = _('personnal informations')
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   313
    category = 'useractions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   314
    order = 20
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   315
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   316
    def url(self):
1545
53d3d783370f some typos
Florent <florent@secondweb.fr>
parents: 1498
diff changeset
   317
        return self.build_url('cwuser/%s'%self.req.user.login, vid='edition')
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   318
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   319
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   320
class LogoutAction(Action):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   321
    id = 'logout'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   322
    __select__ = authenticated_user()
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   323
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   324
    title = _('logout')
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   325
    category = 'useractions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   326
    order = 30
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   327
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   328
    def url(self):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   329
        return self.build_url(self.id)
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   330
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   331
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   332
# site actions ################################################################
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   333
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   334
class ManagersAction(Action):
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   335
    __abstract__ = True
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   336
    __select__ = match_user_groups('managers')
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   337
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   338
    category = 'siteactions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   339
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   340
    def url(self):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   341
        return self.build_url(self.id)
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   342
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   343
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   344
class SiteConfigurationAction(ManagersAction):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   345
    id = 'siteconfig'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   346
    title = _('site configuration')
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   347
    order = 10
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   348
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   349
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   350
class ManageAction(ManagersAction):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   351
    id = 'manage'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   352
    title = _('manage')
631
99f5852f8604 major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents: 554
diff changeset
   353
    order = 20
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   354
2439
77d8dd77acb3 [cleanup] fix tests
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2433
diff changeset
   355
class SiteInfoAction(ManagersAction):
2433
1d46c016a564 #197873: quick access to info for bug report
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2161
diff changeset
   356
    id = 'siteinfo'
1d46c016a564 #197873: quick access to info for bug report
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2161
diff changeset
   357
    title = _('info')
1d46c016a564 #197873: quick access to info for bug report
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2161
diff changeset
   358
    order = 30
1d46c016a564 #197873: quick access to info for bug report
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2161
diff changeset
   359
    __select__ = match_user_groups('users','managers')
1d46c016a564 #197873: quick access to info for bug report
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2161
diff changeset
   360
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   361
3495
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   362
class PoweredByAction(Action):
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   363
    id = 'poweredby'
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   364
    __select__ = yes()
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   365
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   366
    category = 'footer'
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   367
    order = 3
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   368
    title = _('powered by CubicWeb')
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   369
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   370
    def url(self):
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   371
        return 'http://www.cubicweb.org'
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   372
438576c5b1d1 [ui] turn footer items into actions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3272
diff changeset
   373
870
0b31dbac6459 more bw compat
sylvain.thenault@logilab.fr
parents: 824
diff changeset
   374
from logilab.common.deprecation import class_moved
0b31dbac6459 more bw compat
sylvain.thenault@logilab.fr
parents: 824
diff changeset
   375
from cubicweb.web.views.bookmark import FollowAction
0b31dbac6459 more bw compat
sylvain.thenault@logilab.fr
parents: 824
diff changeset
   376
FollowAction = class_moved(FollowAction)
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   377
2652
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   378
## default actions ui configuration ###########################################
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   379
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   380
addmenu = uicfg.actionbox_appearsin_addmenu
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   381
addmenu.tag_subject_of(('*', 'is', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   382
addmenu.tag_object_of(('*', 'is', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   383
addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   384
addmenu.tag_object_of(('*', 'is_instance_of', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   385
addmenu.tag_subject_of(('*', 'identity', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   386
addmenu.tag_object_of(('*', 'identity', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   387
addmenu.tag_subject_of(('*', 'owned_by', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   388
addmenu.tag_subject_of(('*', 'created_by', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   389
addmenu.tag_subject_of(('*', 'require_permission', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   390
addmenu.tag_subject_of(('*', 'wf_info_for', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   391
addmenu.tag_object_of(('*', 'wf_info_for', '*'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   392
addmenu.tag_object_of(('*', 'state_of', 'CWEType'), True)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   393
addmenu.tag_object_of(('*', 'transition_of', 'CWEType'), True)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   394
addmenu.tag_object_of(('*', 'relation_type', 'CWRType'), True)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   395
addmenu.tag_object_of(('*', 'from_entity', 'CWEType'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   396
addmenu.tag_object_of(('*', 'to_entity', 'CWEType'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   397
addmenu.tag_object_of(('*', 'in_group', 'CWGroup'), True)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   398
addmenu.tag_object_of(('*', 'owned_by', 'CWUser'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   399
addmenu.tag_object_of(('*', 'created_by', 'CWUser'), False)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   400
addmenu.tag_object_of(('*', 'bookmarked_by', 'CWUser'), True)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   401
addmenu.tag_subject_of(('Transition', 'destination_state', '*'), True)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   402
addmenu.tag_object_of(('*', 'allowed_transition', 'Transition'), True)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   403
addmenu.tag_object_of(('*', 'destination_state', 'State'), True)
3753f3a07ca1 [refactoring] moved rtags specification in web/views
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2470
diff changeset
   404
addmenu.tag_subject_of(('State', 'allowed_transition', '*'), True)