web/views/actions.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 29 Apr 2009 19:48:27 +0200
branchtls-sprint
changeset 1559 c4d4851bd18b
parent 1498 2c6eec0b46b9
child 1545 53d3d783370f
permissions -rw-r--r--
[editforms] fix missing __maineid, avoid double submit through submit button, say no to locals()
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
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
     4
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     6
"""
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
__docformat__ = "restructuredtext en"
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
728
a95b284150d1 first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 714
diff changeset
     9
from cubicweb.vregistry import objectify_selector
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    10
from cubicweb.selectors import (EntitySelector,
1132
96752791c2b6 pylint cleanup
sylvain.thenault@logilab.fr
parents: 1091
diff changeset
    11
    one_line_rset, two_lines_rset, one_etype_rset, relation_possible,
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
    12
    non_final_entity,
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
    13
    authenticated_user, match_user_groups, match_search_state,
1178
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    14
    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
    15
    )
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
    16
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
    17
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
    18
from cubicweb.web.views.autoform import AutomaticEntityForm
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    19
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    20
_ = unicode
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    21
1178
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    22
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    23
class has_editable_relation(EntitySelector):
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    24
    """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
    25
    editable by the logged user.
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    26
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    27
    See `EntitySelector` documentation for behaviour when row is not specified.
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    28
    """
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    29
1178
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    30
    def score_entity(self, entity):
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    31
        # if user has no update right but it can modify some relation,
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    32
        # display action anyway
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    33
        for dummy in AutomaticEntityForm.esrelations_by_category(
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    34
            entity, 'generic', 'add'):
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    35
            return 1
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    36
        for rschema, targetschemas, role in AutomaticEntityForm.erelations_by_category(
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    37
            entity, ('primary', 'secondary'), 'add'):
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    38
            if not rschema.is_final():
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    39
                return 1
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    40
        return 0
8d9b705168d3 actions specific selector
sylvain.thenault@logilab.fr
parents: 1132
diff changeset
    41
728
a95b284150d1 first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 714
diff changeset
    42
@objectify_selector
775
ed106bb2dcd3 fix selectors argus
sylvain.thenault@logilab.fr
parents: 753
diff changeset
    43
def match_searched_etype(cls, req, rset, **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
    44
    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
    45
728
a95b284150d1 first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 714
diff changeset
    46
@objectify_selector
775
ed106bb2dcd3 fix selectors argus
sylvain.thenault@logilab.fr
parents: 753
diff changeset
    47
def view_is_not_default_view(cls, req, rset, **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
    48
    # 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
    49
    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
    50
    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
    51
        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
    52
    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
    53
728
a95b284150d1 first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 714
diff changeset
    54
@objectify_selector
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
    55
def addable_etype_empty_rset(cls, req, rset, **kwargs):
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
    56
    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
    57
        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
    58
        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
    59
            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
    60
        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
    61
        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
    62
            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
    63
            eschema = cls.schema.eschema(rset._searched_etype)
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
            if not (eschema.is_final() or eschema.is_subobject(strict=True)) \
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
    65
                   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
    66
                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
    67
    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
    68
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
    69
# generic primary actions #####################################################
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    70
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
    71
class SelectAction(Action):
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    72
    """base class for link search actions. By default apply on
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    73
    any size entity result search it the current state is 'linksearch'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    74
    if accept match.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    75
    """
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
    76
    id = 'select'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
    77
    __select__ = match_search_state('linksearch') & match_searched_etype()
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    78
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    79
    title = _('select')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    80
    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
    81
    order = 0
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    82
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    83
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    84
        return linksearch_select_url(self.req, self.rset)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    85
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
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
    88
    id = 'cancel'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
    89
    __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
    90
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
    91
    title = _('cancel select')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    92
    category = 'mainactions'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    93
    order = 10
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    94
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    95
    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
    96
        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
    97
        return self.build_url(str(eid),
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    98
                              vid='edition', __mode='normal')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    99
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
class ViewAction(Action):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   102
    id = 'view'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   103
    __select__ = (match_search_state('normal') &
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   104
                  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
   105
                  view_is_not_default_view() &
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   106
                  non_final_entity())
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   107
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
   108
    title = _('view')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   109
    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
   110
    order = 0
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   111
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   112
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   113
        params = self.req.form.copy()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   114
        params.pop('vid', None)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   115
        params.pop('__message', None)
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   116
        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
   117
                              **params)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   118
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   119
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
   120
class ModifyAction(Action):
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   121
    id = 'edit'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   122
    __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
   123
                  one_line_rset() &
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   124
                  (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
   125
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
   126
    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
   127
    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
   128
    order = 10
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   129
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   130
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   131
        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
   132
        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
   133
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   134
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
   135
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
   136
    id = 'muledit' # XXX get strange conflicts if id='edit'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   137
    __select__ = (match_search_state('normal') &
753
17d38f000bea some minor __select__ composition fixes
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 728
diff changeset
   138
                  two_lines_rset() & one_etype_rset() &
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   139
                  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
   140
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
    title = _('modify')
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   142
    category = 'mainactions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   143
    order = 10
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   144
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   145
    def url(self):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   146
        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
   147
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
# generic secondary actions ###################################################
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   150
690
ea613e8a5e4f should add relation_possible selector only if require_permission is in the schema
sylvain.thenault@logilab.fr
parents: 660
diff changeset
   151
class ManagePermissionsAction(Action):
781
323656dd85a9 fix import, use non_final_entity instead of implements('Any')
sylvain.thenault@logilab.fr
parents: 775
diff changeset
   152
    id = 'managepermission'
822
e3d8db01f3f5 test_views fixes
sylvain.thenault@logilab.fr
parents: 786
diff changeset
   153
    __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
   154
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   155
    title = _('manage permissions')
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   156
    category = 'moreactions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   157
    order = 100
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   158
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   159
    @classmethod
690
ea613e8a5e4f should add relation_possible selector only if require_permission is in the schema
sylvain.thenault@logilab.fr
parents: 660
diff changeset
   160
    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
   161
        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
   162
        if 'require_permission' in vreg.schema:
822
e3d8db01f3f5 test_views fixes
sylvain.thenault@logilab.fr
parents: 786
diff changeset
   163
            cls.__select__ = (one_line_rset() & non_final_entity() &
e3d8db01f3f5 test_views fixes
sylvain.thenault@logilab.fr
parents: 786
diff changeset
   164
                              (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
   165
                               | relation_possible('require_permission', 'subject', 'CWPermission',
822
e3d8db01f3f5 test_views fixes
sylvain.thenault@logilab.fr
parents: 786
diff changeset
   166
                                                   action='add')))
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   167
        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
   168
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   169
    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
   170
        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
   171
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   172
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
   173
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
   174
    id = 'delete'
786
a261fee1bbde fix used selectors
sylvain.thenault@logilab.fr
parents: 781
diff changeset
   175
    __select__ = has_permission('delete')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   176
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
   177
    title = _('delete')
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   178
    category = 'moreactions'
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   179
    order = 20
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   180
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   181
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   182
        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
   183
            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
   184
            return self.build_url(entity.rest_path(), vid='deleteconf')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   185
        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
   186
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   187
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
   188
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
   189
    id = 'copy'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   190
    __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
   191
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
   192
    title = _('copy')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   193
    category = 'moreactions'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   194
    order = 30
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   195
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   196
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   197
        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
   198
        return entity.absolute_url(vid='copy')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   199
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
class AddNewAction(MultipleEditAction):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   202
    """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
   203
    add a new one
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   204
    """
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
   205
    id = 'addentity'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   206
    __select__ = (match_search_state('normal') &
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   207
                  (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
   208
                   | (two_lines_rset() & one_etype_rset & has_add_permission()))
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   209
                  )
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
   210
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   211
    category = 'moreactions'
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   212
    order = 40
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   213
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   214
    @property
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   215
    def rsettype(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   216
        if self.rset:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   217
            return self.rset.description[0][0]
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   218
        return self.rset._searched_etype
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   219
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   220
    @property
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   221
    def title(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   222
        return self.req.__('add a %s' % self.rsettype) # generated msgid
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   223
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   224
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   225
        return self.build_url('add/%s' % self.rsettype)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   226
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   227
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   228
# logged user actions #########################################################
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   229
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   230
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
   231
    id = 'myprefs'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   232
    __select__ = authenticated_user()
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   233
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
   234
    title = _('user preferences')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   235
    category = 'useractions'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   236
    order = 10
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   237
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   238
    def url(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   239
        return self.build_url(self.id)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   240
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   241
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   242
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
   243
    id = 'myinfos'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   244
    __select__ = authenticated_user()
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   245
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
   246
    title = _('personnal informations')
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   247
    category = 'useractions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   248
    order = 20
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   249
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   250
    def url(self):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   251
        return self.build_url('euser/%s'%self.req.user.login, vid='edition')
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   252
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   253
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   254
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
   255
    id = 'logout'
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   256
    __select__ = authenticated_user()
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   257
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
   258
    title = _('logout')
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   259
    category = 'useractions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   260
    order = 30
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   261
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   262
    def url(self):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   263
        return self.build_url(self.id)
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   264
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   265
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   266
# site actions ################################################################
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   267
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   268
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
   269
    __abstract__ = True
707
21a59b468f1a __selectors__ -> __select__
sylvain.thenault@logilab.fr
parents: 696
diff changeset
   270
    __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
   271
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   272
    category = 'siteactions'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   273
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   274
    def url(self):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   275
        return self.build_url(self.id)
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   276
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   277
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   278
class SiteConfigurationAction(ManagersAction):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   279
    id = 'siteconfig'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   280
    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
   281
    order = 10
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   282
1452
546b9884d92c delete spaces, use .row .col instead of fixed 0 0
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   283
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   284
class ManageAction(ManagersAction):
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   285
    id = 'manage'
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   286
    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
   287
    order = 20
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   288
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   289
870
0b31dbac6459 more bw compat
sylvain.thenault@logilab.fr
parents: 824
diff changeset
   290
from logilab.common.deprecation import class_moved
0b31dbac6459 more bw compat
sylvain.thenault@logilab.fr
parents: 824
diff changeset
   291
from cubicweb.web.views.bookmark import FollowAction
0b31dbac6459 more bw compat
sylvain.thenault@logilab.fr
parents: 824
diff changeset
   292
FollowAction = class_moved(FollowAction)
401
bc55a104d636 cleanup, backport manage perm action from jpl
sylvain.thenault@logilab.fr
parents: 328
diff changeset
   293