1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
26 |
26 |
27 from cubicweb.schema import display_name |
27 from cubicweb.schema import display_name |
28 from cubicweb.appobject import objectify_selector |
28 from cubicweb.appobject import objectify_selector |
29 from cubicweb.selectors import (EntitySelector, yes, |
29 from cubicweb.selectors import (EntitySelector, yes, |
30 one_line_rset, multi_lines_rset, one_etype_rset, relation_possible, |
30 one_line_rset, multi_lines_rset, one_etype_rset, relation_possible, |
31 nonempty_rset, non_final_entity, |
31 nonempty_rset, non_final_entity, score_entity, |
32 authenticated_user, match_user_groups, match_search_state, |
32 authenticated_user, match_user_groups, match_search_state, |
33 has_permission, has_add_permission, is_instance, debug_mode, |
33 has_permission, has_add_permission, is_instance, debug_mode, |
34 ) |
34 ) |
35 from cubicweb.web import uicfg, controller, action |
35 from cubicweb.web import uicfg, controller, action |
36 from cubicweb.web.views import linksearch_select_url, vid_from_rset |
36 from cubicweb.web.views import linksearch_select_url, vid_from_rset |
320 |
320 |
321 class ViewSameCWEType(action.Action): |
321 class ViewSameCWEType(action.Action): |
322 """when displaying the schema of a CWEType, offer to list entities of that type |
322 """when displaying the schema of a CWEType, offer to list entities of that type |
323 """ |
323 """ |
324 __regid__ = 'entitiesoftype' |
324 __regid__ = 'entitiesoftype' |
325 __select__ = one_line_rset() & is_instance('CWEType') |
325 __select__ = one_line_rset() & is_instance('CWEType') & score_entity(lambda x: not x.final) |
326 category = 'mainactions' |
326 category = 'mainactions' |
327 order = 40 |
327 order = 40 |
328 |
328 |
329 @property |
329 @property |
330 def etype(self): |
330 def etype(self): |