# 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'