# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1241427025 -7200 # Node ID 8370be19afd772ba20a8255ce8c588da4f6e16cc # Parent 41aadba8b29fe8cf483d715e1ed73df55a188078 configurable entity types tables diff -r 41aadba8b29f -r 8370be19afd7 web/uicfg.py --- a/web/uicfg.py Mon May 04 10:50:10 2009 +0200 +++ b/web/uicfg.py Mon May 04 10:50:25 2009 +0200 @@ -54,6 +54,16 @@ rdisplay.tag_relation({}, ('*', rtype, '*'), 'object') +# index view configuration #################################################### +# entity type category in the index/manage page. May be one of +# * 'application' +# * 'system' +# * 'schema' +# * 'subobject' (not displayed by default) + +etypecat = {'EmailAddress': 'subobject'} + + # autoform.AutomaticEntityForm configuration ################################## # relations'category (eg primary/secondary/generic/metadata/generated) diff -r 41aadba8b29f -r 8370be19afd7 web/views/startup.py --- a/web/views/startup.py Mon May 04 10:50:10 2009 +0200 +++ b/web/views/startup.py Mon May 04 10:50:25 2009 +0200 @@ -6,23 +6,34 @@ :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr """ __docformat__ = "restructuredtext en" +_ = unicode from logilab.common.textutils import unormalize from logilab.mtconverter import html_escape -from cubicweb.common.uilib import ureport_as_html, ajax_replace_url from cubicweb.view import StartupView from cubicweb.selectors import match_user_groups -from cubicweb.web.httpcache import EtagHTTPCacheManager +from cubicweb.common.uilib import ureport_as_html, ajax_replace_url +from cubicweb.web import uicfg, httpcache from cubicweb.web.views.management import SecurityViewMixIn -from copy import deepcopy -_ = unicode class ManageView(StartupView): id = 'manage' title = _('manage') - http_cache_manager = EtagHTTPCacheManager + http_cache_manager = httpcache.EtagHTTPCacheManager + + @classmethod + def vreg_initialization_completed(cls): + for eschema in cls.schema.entities(): + if eschema.schema_entity(): + uicfg.etypecat.setdefault(eschema, 'schema') + elif eschema.is_subobject(strict=True): + uicfg.etypecat.setdefault(eschema, 'subobject') + elif eschema.meta: + uicfg.etypecat.setdefault(eschema, 'system') + else: + uicfg.etypecat.setdefault(eschema, 'application') def display_folders(self): return False @@ -89,15 +100,15 @@ if manager: self.w(u'%s\n' % self.req._('application entities')) self.entity_types_table(eschema for eschema in schema.entities() - if not eschema.meta and not eschema.is_subobject(strict=True)) + if uicfg.etypecat.get(eschema) == 'application') if manager: self.w(u'%s\n' % self.req._('system entities')) self.entity_types_table(eschema for eschema in schema.entities() - if eschema.meta and not eschema.schema_entity()) + if uicfg.etypecat.get(eschema) == 'system') if 'CWAttribute' in schema: # check schema support self.w(u'%s\n' % self.req._('schema entities')) - self.entity_types_table(schema.eschema(etype) - for etype in schema.schema_entity_types()) + self.entity_types_table(eschema for eschema in schema.entities() + if uicfg.etypecat.get(eschema) == 'schema') self.w(u'') def entity_types_table(self, eschemas):