diff -r 822f2530570d -r 686c59dfc401 web/views/startup.py --- a/web/views/startup.py Wed Feb 09 18:06:24 2011 +0100 +++ b/web/views/startup.py Wed Feb 09 18:06:25 2011 +0100 @@ -1,4 +1,4 @@ -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of CubicWeb. @@ -15,14 +15,15 @@ # # You should have received a copy of the GNU Lesser General Public License along # with CubicWeb. If not, see . -"""Set of HTML startup views. A startup view is global, e.g. doesn't -apply to a result set. +"""Set of HTML startup views. A startup view is global, e.g. doesn't apply to a +result set. """ __docformat__ = "restructuredtext en" _ = unicode from logilab.common.textutils import unormalize +from logilab.common.deprecation import deprecated from logilab.mtconverter import xml_escape from cubicweb.view import StartupView @@ -35,73 +36,40 @@ title = _('manage') http_cache_manager = httpcache.EtagHTTPCacheManager add_etype_links = () - - def display_folders(self): - return False + skip_startup_views = set( ('index', 'manage', 'schema', 'owl', 'changelog', + 'systempropertiesform', 'propertiesform', + 'cw.user-management', + 'siteinfo', 'info', 'registry', 'gc', + 'tree') ) def call(self, **kwargs): """The default view representing the instance's management""" self._cw.add_css('cubicweb.manageview.css') self.w(u'

%s

' % self._cw.property_value('ui.site-title')) - if not self.display_folders(): - self._main_index() - else: - self.w(u'\n') - self.w(u'') - self.w(u'
') - self._main_index() - self.w(u'') - self.folders() - self.w(u'
\n') + self.entities() + self.manage_actions() + self.startup_views() - def _main_index(self): - req = self._cw - manager = req.user.matching_groups('managers') - if not manager and 'Card' in self._cw.vreg.schema: - rset = self._cw.execute('Card X WHERE X wikiid "index"') - else: - rset = None - if rset: - self.wview('inlined', rset, row=0) - else: - self.entities() + def manage_actions(self): + allactions = self._cw.vreg['actions'].possible_actions(self._cw) + if allactions.get('manage'): self.w(u'
 
') - self.startup_views() - if manager and 'Card' in self._cw.vreg.schema: - self.w(u'
 
') - if rset: - href = rset.get_entity(0, 0).absolute_url(vid='edition') - label = self._cw._('edit the index page') - else: - href = req.build_url('view', vid='creation', etype='Card', wikiid='index') - label = self._cw._('create an index page') - self.w(u'
%s\n' % (xml_escape(href), label)) - - def folders(self): - self.w(u'

%s

\n' % self._cw._('Browse by category')) - self._cw.vreg['views'].select('tree', self._cw).render(w=self.w, maxlevel=1) - - def create_links(self): - self.w(u'') def startup_views(self): - self.w(u'

%s

\n' % self._cw._('Startup views')) - self.startupviews_table() - - def startupviews_table(self): views = self._cw.vreg['views'].possible_views(self._cw, None) if not views: return + self.w(u'
 
') + self.w(u'

%s

\n' % self._cw._('Startup views')) self.w(u'