# HG changeset patch # User Sylvain Thénault # Date 1297271185 -3600 # Node ID 686c59dfc4019315a0fe679553d59d0a07fff888 # Parent 822f2530570d4bc63c9d0522aed1e11b309c59ba [manage view] cleanup manage view and user menu * drop code that shouldn't be there (e.g. folders handling) * add a section displaying site management actions, some of them were initially in the user's drop down menu, which now only have a 'manage' link with regards to management actions * stop displaying 'system' and 'schema' entities by default, only 'application' entities * put 'gc', 'registry' and 'info' views as tabs of a generic 'server information' view diff -r 822f2530570d -r 686c59dfc401 web/views/actions.py --- a/web/views/actions.py Wed Feb 09 18:06:24 2011 +0100 +++ b/web/views/actions.py Wed Feb 09 18:06:25 2011 +0100 @@ -391,6 +391,7 @@ __regid__ = 'siteconfig' title = _('site configuration') order = 10 + category = 'manage' class ManageAction(ManagersAction): diff -r 822f2530570d -r 686c59dfc401 web/views/cwuser.py --- a/web/views/cwuser.py Wed Feb 09 18:06:24 2011 +0100 +++ b/web/views/cwuser.py Wed Feb 09 18:06:25 2011 +0100 @@ -164,14 +164,14 @@ class ManageUsersAction(actions.ManagersAction): __regid__ = 'cwuser' # see rewrite rule /cwuser - title = _('users management') + title = _('users and groups') category = 'manage' class CWUserManagementView(StartupView): __regid__ = 'cw.user-management' rql = ('Any U, F, S, U, L ORDERBY L WHERE U is CWUser, U login L, U firstname F, U surname S') - title = _('users management') + title = _('users and groups management') def call(self, **kwargs): self.w('

%s

' % self._cw._(self.title)) diff -r 822f2530570d -r 686c59dfc401 web/views/debug.py --- a/web/views/debug.py Wed Feb 09 18:06:24 2011 +0100 +++ b/web/views/debug.py Wed Feb 09 18:06:25 2011 +0100 @@ -27,7 +27,7 @@ from cubicweb import BadConnectionId from cubicweb.selectors import none_rset, match_user_groups from cubicweb.view import StartupView -from cubicweb.web.views import actions +from cubicweb.web.views import actions, tabs def dict_to_html(w, dict): # XHTML doesn't allow emtpy ') - class SiteInfoAction(actions.ManagersAction): __regid__ = 'siteinfo' __select__ = match_user_groups('users','managers') - title = _('info') - order = 30 + title = _('siteinfo') + category = 'manage' + order = 1000 + + +class SiteInfoView(tabs.TabsMixin, StartupView): + __regid__ = 'siteinfo' + title = _('Site information') + tabs = [_('info'), _('registry'), _('gc')] + default_tab = 'info' + + def call(self, **kwargs): + """The default view representing the instance's management""" + self.w(u'

%s

' % self._cw._(self.title)) + self.render_tabs(self.tabs, self.default_tab) class ProcessInformationView(StartupView): @@ -61,7 +73,7 @@ _ = req._ w = self.w # generic instance information - w(u'

%s

' % _('Instance')) + w(u'

%s

' % _('Instance')) w(u'') w(u'' % ( _('config type'), self._cw.vreg.config.name)) @@ -82,7 +94,7 @@ w(u'
%s%s
') # repository information repo = req.vreg.config.repository(None) - w(u'

%s

' % _('Repository')) + w(u'

%s

' % _('Repository')) w(u'

%s

' % _('resources usage')) w(u'') stats = repo.stats() @@ -107,7 +119,7 @@ else: w(u'

%s

' % _('no repository sessions found')) # web server information - w(u'

%s

' % _('Web server')) + w(u'

%s

' % _('Web server')) w(u'
') w(u'' % ( _('base url'), req.base_url())) @@ -146,7 +158,7 @@ cache_max_age = 0 def call(self, **kwargs): - self.w(u'

%s

' % self._cw._("Registry's content")) + self.w(u'

%s

' % self._cw._("Registry's content")) keys = sorted(self._cw.vreg) url = xml_escape(self._cw.url()) self.w(u'

%s

\n' % ' - '.join('%s' @@ -154,7 +166,7 @@ for key in keys: if key in ('boxes', 'contentnavigation'): # those are bw compat registries continue - self.w(u'

%s

' % (key, key)) + self.w(u'

%s

' % (key, key)) if self._cw.vreg[key]: values = sorted(self._cw.vreg[key].iteritems()) self.wview('pyvaltable', pyvalue=[(key, xml_escape(repr(val))) @@ -186,7 +198,7 @@ lookupclasses += (InternalSession, Session) except ImportError: pass # no server part installed - self.w(u'

%s

' % _('Garbage collection information')) + self.w(u'

%s

' % _('Garbage collection information')) counters, ocounters, garbage = gc_info(lookupclasses, viewreferrersclasses=()) self.w(u'

%s

' % self._cw._('Looked up classes')) diff -r 822f2530570d -r 686c59dfc401 web/views/schema.py --- a/web/views/schema.py Wed Feb 09 18:06:24 2011 +0100 +++ b/web/views/schema.py Wed Feb 09 18:06:25 2011 +0100 @@ -690,13 +690,14 @@ __select__ = facet.AttributeFacet.__select__ & is_instance('CWEType', 'CWRType') rtype = 'final' + class ViewSchemaAction(action.Action): __regid__ = 'schema' __select__ = yes() title = _("site schema") - category = 'siteactions' order = 30 + category = 'manage' def url(self): return self._cw.build_url(self.__regid__) 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'
%s%s
\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'