4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 """ |
6 """ |
7 __docformat__ = "restructuredtext en" |
7 __docformat__ = "restructuredtext en" |
8 |
8 |
|
9 from cubicweb.vregistry import objectify_selector |
9 from cubicweb.selectors import ( |
10 from cubicweb.selectors import ( |
10 yes, one_line_rset, two_lines_rset, one_etype_rset, relation_possible, |
11 yes, one_line_rset, two_lines_rset, one_etype_rset, relation_possible, |
11 non_final_entity, |
12 non_final_entity, |
12 authenticated_user, match_user_groups, match_search_state, |
13 authenticated_user, match_user_groups, match_search_state, |
13 has_editable_relation, has_permission, has_add_permission, |
14 has_editable_relation, has_permission, has_add_permission, |
17 from cubicweb.web.views import linksearch_select_url |
18 from cubicweb.web.views import linksearch_select_url |
18 from cubicweb.web.views.baseviews import vid_from_rset |
19 from cubicweb.web.views.baseviews import vid_from_rset |
19 |
20 |
20 _ = unicode |
21 _ = unicode |
21 |
22 |
|
23 @objectify_selector |
22 def match_searched_etype(cls, req, rset, row=None, col=None, **kwargs): |
24 def match_searched_etype(cls, req, rset, row=None, col=None, **kwargs): |
23 return req.match_search_state(rset) |
25 return req.match_search_state(rset) |
24 |
26 |
|
27 @objectify_selector |
25 def view_is_not_default_view(cls, req, rset, row, col, **kwargs): |
28 def view_is_not_default_view(cls, req, rset, row, col, **kwargs): |
26 # interesting if it propose another view than the current one |
29 # interesting if it propose another view than the current one |
27 vid = req.form.get('vid') |
30 vid = req.form.get('vid') |
28 if vid and vid != vid_from_rset(req, rset, cls.schema): |
31 if vid and vid != vid_from_rset(req, rset, cls.schema): |
29 return 1 |
32 return 1 |
30 return 0 |
33 return 0 |
31 |
34 |
|
35 @objectify_selector |
32 def addable_etype_empty_rset(cls, req, rset, **kwargs): |
36 def addable_etype_empty_rset(cls, req, rset, **kwargs): |
33 if rset is not None and not rset.rowcount: |
37 if rset is not None and not rset.rowcount: |
34 rqlst = rset.syntax_tree() |
38 rqlst = rset.syntax_tree() |
35 if len(rqlst.children) > 1: |
39 if len(rqlst.children) > 1: |
36 return 0 |
40 return 0 |