author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Mon, 26 Sep 2011 19:24:08 +0200 | |
changeset 7868 | 39a54b88906d |
parent 7681 | 32c4c9bab046 |
child 7897 | defac26f4151 |
permissions | -rw-r--r-- |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
1 |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
18 |
"""Set of HTML startup views. A startup view is global, e.g. doesn't apply to a |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
19 |
result set. |
5839 | 20 |
""" |
0 | 21 |
|
22 |
__docformat__ = "restructuredtext en" |
|
1631
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1544
diff
changeset
|
23 |
_ = unicode |
0 | 24 |
|
1132 | 25 |
from logilab.common.textutils import unormalize |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
26 |
from logilab.common.deprecation import deprecated |
2387
ea1defea9636
[views] fix some crashers (schema still does not render properly, might be yams side)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2381
diff
changeset
|
27 |
from logilab.mtconverter import xml_escape |
0 | 28 |
|
1532
111c52e0022f
duh? remaining __selectors__, probably a wrong merge
sylvain.thenault@logilab.fr
parents:
1523
diff
changeset
|
29 |
from cubicweb.view import StartupView |
5877
0c7b7b76a84f
[selectors] provide a new, optimized, is_instance selector that should at some point replace implements (along with the adaptable selector)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5849
diff
changeset
|
30 |
from cubicweb.selectors import match_user_groups, is_instance |
2436
44b2eea35efa
move all schema related views where they belong (eg not startup), fix schema graph views
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2387
diff
changeset
|
31 |
from cubicweb.schema import display_name |
1635
866563e2d0fc
don't depends on simplejson outside web/
sylvain.thenault@logilab.fr
parents:
1631
diff
changeset
|
32 |
from cubicweb.web import ajax_replace_url, uicfg, httpcache |
0 | 33 |
|
34 |
class ManageView(StartupView): |
|
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3023
diff
changeset
|
35 |
__regid__ = 'manage' |
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
36 |
title = _('manage') |
1631
8370be19afd7
configurable entity types tables
sylvain.thenault@logilab.fr
parents:
1544
diff
changeset
|
37 |
http_cache_manager = httpcache.EtagHTTPCacheManager |
3500
ab10d1cb53ff
[ui api] backport create_links from forge so it may be reused
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2996
diff
changeset
|
38 |
add_etype_links = () |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
39 |
skip_startup_views = set( ('index', 'manage', 'schema', 'owl', 'changelog', |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
40 |
'systempropertiesform', 'propertiesform', |
6962
220e32f058be
[management ui] add views to manage sources similarly to users
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6961
diff
changeset
|
41 |
'cw.user-management', 'cw.source-management', |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
42 |
'siteinfo', 'info', 'registry', 'gc', |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
43 |
'tree') ) |
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
44 |
|
0 | 45 |
def call(self, **kwargs): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2436
diff
changeset
|
46 |
"""The default view representing the instance's management""" |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
47 |
self._cw.add_css('cubicweb.manageview.css') |
5478
c52124b7a00e
[css] progressively fixing rhythm
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
5424
diff
changeset
|
48 |
self.w(u'<h1>%s</h1>' % self._cw.property_value('ui.site-title')) |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
49 |
self.entities() |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
50 |
self.manage_actions() |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
51 |
self.startup_views() |
0 | 52 |
|
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
53 |
def manage_actions(self): |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
54 |
allactions = self._cw.vreg['actions'].possible_actions(self._cw) |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
55 |
if allactions.get('manage'): |
2996
866a2c135c33
B #345282 xhtml requires to use   instead of
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2780
diff
changeset
|
56 |
self.w(u'<div class="hr"> </div>') |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
57 |
self.w(u'<h2>%s</h2>\n' % self._cw._('Manage')) |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
58 |
self.w(u'<ul class="manageActions">') |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
59 |
for action in allactions['manage']: |
3500
ab10d1cb53ff
[ui api] backport create_links from forge so it may be reused
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2996
diff
changeset
|
60 |
self.w(u'<li><a href="%s">%s</a></li>' % ( |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
61 |
action.url(), self._cw._(action.title))) |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
62 |
self.w(u'</ul>') |
3500
ab10d1cb53ff
[ui api] backport create_links from forge so it may be reused
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2996
diff
changeset
|
63 |
|
0 | 64 |
def startup_views(self): |
6966
0f45b1dad08d
[manage view] filter before displaying anything avoid xhtml errors
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6962
diff
changeset
|
65 |
views = [v for v in self._cw.vreg['views'].possible_views(self._cw, None) |
0f45b1dad08d
[manage view] filter before displaying anything avoid xhtml errors
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6962
diff
changeset
|
66 |
if v.category == 'startupview' |
6971
33afb8748052
[manage view] fix skipping of startup views
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
6966
diff
changeset
|
67 |
and v.__regid__ not in self.skip_startup_views] |
5479
6ba3587c5cda
[css] start using uiprops in cubicweb.css
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
5478
diff
changeset
|
68 |
if not views: |
6ba3587c5cda
[css] start using uiprops in cubicweb.css
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
5478
diff
changeset
|
69 |
return |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
70 |
self.w(u'<div class="hr"> </div>') |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
71 |
self.w(u'<h2>%s</h2>\n' % self._cw._('Startup views')) |
5819
1017163825c7
[css] more css rework, need visual test in compat/new modes
katia
parents:
5718
diff
changeset
|
72 |
self.w(u'<ul class="startup">') |
5530
da21e3fbe240
[startup view] sort startup views by alphabetical order
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
73 |
for v in sorted(views, key=lambda x: self._cw._(x.title)): |
5479
6ba3587c5cda
[css] start using uiprops in cubicweb.css
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
5478
diff
changeset
|
74 |
self.w('<li><a href="%s">%s</a></li>' % ( |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
75 |
xml_escape(v.url()), xml_escape(self._cw._(v.title).capitalize()))) |
5479
6ba3587c5cda
[css] start using uiprops in cubicweb.css
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
5478
diff
changeset
|
76 |
self.w(u'</ul>') |
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
77 |
|
0 | 78 |
def entities(self): |
4045
f4a52abb6f4f
cw 3.6 api update
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
3890
diff
changeset
|
79 |
schema = self._cw.vreg.schema |
6973
d2cd38749c17
[manage view] get etypes first to avoid xhtml validation error if no one found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6971
diff
changeset
|
80 |
eschemas = [eschema for eschema in schema.entities() |
d2cd38749c17
[manage view] get etypes first to avoid xhtml validation error if no one found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6971
diff
changeset
|
81 |
if uicfg.indexview_etype_section.get(eschema) == 'application'] |
d2cd38749c17
[manage view] get etypes first to avoid xhtml validation error if no one found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6971
diff
changeset
|
82 |
if eschemas: |
d2cd38749c17
[manage view] get etypes first to avoid xhtml validation error if no one found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6971
diff
changeset
|
83 |
self.w(u'<div class="hr"> </div>') |
d2cd38749c17
[manage view] get etypes first to avoid xhtml validation error if no one found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6971
diff
changeset
|
84 |
self.w(u'<h2>%s</h2>\n' % self._cw._('Browse by entity type')) |
d2cd38749c17
[manage view] get etypes first to avoid xhtml validation error if no one found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6971
diff
changeset
|
85 |
self.w(u'<table class="startup">') |
d2cd38749c17
[manage view] get etypes first to avoid xhtml validation error if no one found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6971
diff
changeset
|
86 |
self.entity_types_table(eschemas) |
d2cd38749c17
[manage view] get etypes first to avoid xhtml validation error if no one found
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6971
diff
changeset
|
87 |
self.w(u'</table>') |
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
88 |
|
0 | 89 |
def entity_types_table(self, eschemas): |
90 |
infos = sorted(self.entity_types(eschemas), |
|
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
91 |
key=lambda (l,a,e): unormalize(l)) |
0 | 92 |
q, r = divmod(len(infos), 2) |
93 |
if r: |
|
2996
866a2c135c33
B #345282 xhtml requires to use   instead of
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2780
diff
changeset
|
94 |
infos.append( (None, ' ', ' ') ) |
0 | 95 |
infos = zip(infos[:q+r], infos[q+r:]) |
96 |
for (_, etypelink, addlink), (_, etypelink2, addlink2) in infos: |
|
97 |
self.w(u'<tr>\n') |
|
98 |
self.w(u'<td class="addcol">%s</td><td>%s</td>\n' % (addlink, etypelink)) |
|
99 |
self.w(u'<td class="addcol">%s</td><td>%s</td>\n' % (addlink2, etypelink2)) |
|
100 |
self.w(u'</tr>\n') |
|
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
101 |
|
0 | 102 |
def entity_types(self, eschemas): |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
103 |
"""return an iterator on formatted links to get a list of entities of |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
104 |
each entity types |
0 | 105 |
""" |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3377
diff
changeset
|
106 |
req = self._cw |
0 | 107 |
for eschema in eschemas: |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3689
diff
changeset
|
108 |
if eschema.final or not eschema.may_have_permission('read', req): |
0 | 109 |
continue |
110 |
etype = eschema.type |
|
111 |
nb = req.execute('Any COUNT(X) WHERE X is %s' % etype)[0][0] |
|
4144 | 112 |
if nb > 1: |
113 |
label = display_name(req, etype, 'plural') |
|
114 |
else: |
|
115 |
label = display_name(req, etype) |
|
0 | 116 |
nb = req.execute('Any COUNT(X) WHERE X is %s' % etype)[0][0] |
3460
e4843535db25
[api] some more _cw / __regid__, automatic tests now pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3457
diff
changeset
|
117 |
url = self._cw.build_url(etype) |
2996
866a2c135c33
B #345282 xhtml requires to use   instead of
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2780
diff
changeset
|
118 |
etypelink = u' <a href="%s">%s</a> (%d)' % ( |
2312
af4d8f75c5db
use xml_escape
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2265
diff
changeset
|
119 |
xml_escape(url), label, nb) |
6041
31776723c0c5
[index page] refactor add_entity_link: no need to give request, nicer to check perm before calling the method, and use the new create url factory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5877
diff
changeset
|
120 |
if eschema.has_perm(req, 'add'): |
31776723c0c5
[index page] refactor add_entity_link: no need to give request, nicer to check perm before calling the method, and use the new create url factory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5877
diff
changeset
|
121 |
yield (label, etypelink, self.add_entity_link(etype)) |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
122 |
else: |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
123 |
yield (label, etypelink, u'') |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
124 |
|
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
125 |
def create_links(self): |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
126 |
self.w(u'<ul class="createLink">') |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
127 |
for etype in self.add_etype_links: |
7265
8eedf71f280e
[deprecation] kill a remaining 3.6 warning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6973
diff
changeset
|
128 |
eschema = self._cw.vreg.schema.eschema(etype) |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
129 |
if eschema.has_perm(self._cw, 'add'): |
7681
32c4c9bab046
[index page] use 'New xxx' generated labels, 'add a xxx' labels are only generated according to inlined form configuration and with an associated context
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7265
diff
changeset
|
130 |
url = self._cw.vreg["etypes"].etype_class(etype).cw_create_url(self._cw) |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
131 |
self.w(u'<li><a href="%s">%s</a></li>' % ( |
7681
32c4c9bab046
[index page] use 'New xxx' generated labels, 'add a xxx' labels are only generated according to inlined form configuration and with an associated context
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7265
diff
changeset
|
132 |
url, self._cw.__('New %s' % eschema).capitalize())) |
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
133 |
self.w(u'</ul>') |
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
134 |
|
6041
31776723c0c5
[index page] refactor add_entity_link: no need to give request, nicer to check perm before calling the method, and use the new create url factory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5877
diff
changeset
|
135 |
def add_entity_link(self, etype): |
31776723c0c5
[index page] refactor add_entity_link: no need to give request, nicer to check perm before calling the method, and use the new create url factory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5877
diff
changeset
|
136 |
"""creates a [+] link for adding an entity""" |
31776723c0c5
[index page] refactor add_entity_link: no need to give request, nicer to check perm before calling the method, and use the new create url factory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5877
diff
changeset
|
137 |
url = self._cw.vreg["etypes"].etype_class(etype).cw_create_url(self._cw) |
0 | 138 |
return u'[<a href="%s" title="%s">+</a>]' % ( |
7681
32c4c9bab046
[index page] use 'New xxx' generated labels, 'add a xxx' labels are only generated according to inlined form configuration and with an associated context
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7265
diff
changeset
|
139 |
xml_escape(url), self._cw.__('New %s' % etype)) |
0 | 140 |
|
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
141 |
@deprecated('[3.11] display_folders method is deprecated, backport it if needed') |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
142 |
def display_folders(self): |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
143 |
return False |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
144 |
|
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
145 |
@deprecated('[3.11] folders method is deprecated, backport it if needed') |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
146 |
def folders(self): |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
147 |
self.w(u'<h2>%s</h2>\n' % self._cw._('Browse by category')) |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
148 |
self._cw.vreg['views'].select('tree', self._cw).render(w=self.w, maxlevel=1) |
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
149 |
|
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
150 |
|
0 | 151 |
class IndexView(ManageView): |
3377
dd9d292b6a6d
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3023
diff
changeset
|
152 |
__regid__ = 'index' |
2368
b41aef0e63a7
use msgid, update i18n
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2312
diff
changeset
|
153 |
title = _('view_index') |
1498
2c6eec0b46b9
fix imports, cleanup, repair some ajax calls
sylvain.thenault@logilab.fr
parents:
1398
diff
changeset
|
154 |
|
6961
686c59dfc401
[manage view] cleanup manage view and user menu
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6931
diff
changeset
|
155 |
@deprecated('[3.11] display_folders method is deprecated, backport it if needed') |
0 | 156 |
def display_folders(self): |
4045
f4a52abb6f4f
cw 3.6 api update
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
3890
diff
changeset
|
157 |
return 'Folder' in self._cw.vreg.schema and self._cw.execute('Any COUNT(X) WHERE X is Folder')[0][0] |
2748
d2fcf19bfb34
F [registry views] add _registry startup view
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2687
diff
changeset
|
158 |