--- a/schemaviewer.py Wed Oct 21 09:47:55 2009 +0200
+++ b/schemaviewer.py Wed Oct 21 10:35:19 2009 +0200
@@ -31,9 +31,11 @@
data = [self.req._('access type'), self.req._('groups')]
for access_type in access_types:
data.append(self.req._(access_type))
- acls = [self.req._(group) for group in schema.get_groups(access_type)]
- acls += (rqlexp.expression for rqlexp in schema.get_rqlexprs(access_type))
- data.append(', '.join(acls))
+ acls = [Link(self.req.build_url('cwgroup/%s' % group), self.req._(group))
+ for group in schema.get_groups(access_type)]
+ acls += (Text(rqlexp.expression) for rqlexp in schema.get_rqlexprs(access_type))
+ acls = [n for _n in acls for n in (_n, Text(', '))][:-1]
+ data.append(Span(children=acls))
return Section(children=(Table(cols=2, cheaders=1, rheaders=1, children=data),),
klass='acl')
@@ -107,7 +109,7 @@
layout.append(Link(etype,' ' , id=etype)) # anchor
title = Link(self.eschema_link_url(eschema), etype)
boxchild = [Section(children=(title, ' (%s)'% eschema.display_name(self.req)), klass='title')]
- table = Table(cols=4, rheaders=1,
+ table = Table(cols=4, rheaders=1, klass='listing',
children=self._entity_attributes_data(eschema))
boxchild.append(Section(children=(table,), klass='body'))
data = []
@@ -158,18 +160,21 @@
def visit_relationschema(self, rschema, title=True):
"""get a layout for a relation schema"""
_ = self.req._
- title = Link(self.rschema_link_url(rschema), rschema.type)
- stereotypes = []
- if rschema.meta:
- stereotypes.append('meta')
- if rschema.symetric:
- stereotypes.append('symetric')
- if rschema.inlined:
- stereotypes.append('inlined')
- title = Section(children=(title, ' (%s)'%rschema.display_name(self.req)), klass='title')
- if stereotypes:
- title.append(self.stereotype(','.join(stereotypes)))
- layout = Section(children=(title,), klass='schema')
+ if title:
+ title = Link(self.rschema_link_url(rschema), rschema.type)
+ stereotypes = []
+ if rschema.meta:
+ stereotypes.append('meta')
+ if rschema.symetric:
+ stereotypes.append('symetric')
+ if rschema.inlined:
+ stereotypes.append('inlined')
+ title = Section(children=(title, ' (%s)'%rschema.display_name(self.req)), klass='title')
+ if stereotypes:
+ title.append(self.stereotype(','.join(stereotypes)))
+ layout = Section(children=(title,), klass='schema')
+ else:
+ layout = Section(klass='schema')
data = [_('from'), _('to')]
schema = rschema.schema
rschema_objects = rschema.objects()
@@ -202,7 +207,7 @@
else:
val = str(val)
data.append(Text(val))
- table = Table(cols=cols, rheaders=1, children=data)
+ table = Table(cols=cols, rheaders=1, children=data, klass='listing')
layout.append(Section(children=(table,), klass='relationDefinition'))
if not self.req.cnx.anonymous_connection:
layout.append(self.format_acls(rschema, ('read', 'add', 'delete')))
--- a/web/views/schema.py Wed Oct 21 09:47:55 2009 +0200
+++ b/web/views/schema.py Wed Oct 21 10:35:19 2009 +0200
@@ -18,7 +18,7 @@
from cubicweb.schemaviewer import SchemaViewer
from cubicweb.view import EntityView, StartupView
from cubicweb.common import tags, uilib
-from cubicweb.web import action, facet
+from cubicweb.web import action, facet, uicfg
from cubicweb.web.views import TmpFileViewMixin
from cubicweb.web.views import primary, baseviews, tabs, management
@@ -36,6 +36,11 @@
return SKIP_TYPES
return ALWAYS_SKIP_TYPES
+_pvs = uicfg.primaryview_section
+for _action in ('read', 'add', 'update', 'delete'):
+ _pvs.tag_subject_of(('*', '%s_permission' % _action, '*'), 'hidden')
+ _pvs.tag_object_of(('*', '%s_permission' % _action, '*'), 'hidden')
+
# global schema view ###########################################################
class SchemaView(tabs.TabsMixin, StartupView):
@@ -279,6 +284,7 @@
def cell_call(self, row, col):
entity = self.rset.get_entity(row, col)
+ _ = self.req._
self.w(u'<h2>%s</h2>' % _('Add permissions'))
rset = self.req.execute('Any P WHERE X add_permission P, '
'X eid %(x)s',
@@ -334,7 +340,7 @@
super(CWRTypeSchemaView, self).render_entity_attributes(entity)
rschema = self.vreg.schema.rschema(entity.name)
viewer = SchemaViewer(self.req)
- layout = viewer.visit_relationschema(rschema)
+ layout = viewer.visit_relationschema(rschema, title=False)
self.w(uilib.ureport_as_html(layout))
if not rschema.final:
msg = self.req._('graphical schema for %s') % entity.name