web/views/schema.py
changeset 2234 1fbcf202882d
parent 2181 94ca417b9b07
parent 2231 d2052c3ccac7
child 2293 7ded2a1416e4
equal deleted inserted replaced
2209:2b91abd9f5a4 2234:1fbcf202882d
    47     def render_entity_title(self, entity):
    47     def render_entity_title(self, entity):
    48         self.w(u'<h1><span class="etype">%s</span> %s</h1>'
    48         self.w(u'<h1><span class="etype">%s</span> %s</h1>'
    49                % (entity.dc_type().capitalize(),
    49                % (entity.dc_type().capitalize(),
    50                   html_escape(entity.dc_long_title())))
    50                   html_escape(entity.dc_long_title())))
    51 
    51 
       
    52 
    52 # CWEType ######################################################################
    53 # CWEType ######################################################################
    53 
    54 
    54 class CWETypeOneLineView(baseviews.OneLineView):
    55 class CWETypeOneLineView(baseviews.OneLineView):
    55     __select__ = implements('CWEType')
    56     __select__ = implements('CWEType')
    56 
    57 
    83     __select__ = EntityView.__select__ & implements('CWEType')
    84     __select__ = EntityView.__select__ & implements('CWEType')
    84 
    85 
    85     def cell_call(self, row, col):
    86     def cell_call(self, row, col):
    86         entity = self.entity(row, col)
    87         entity = self.entity(row, col)
    87         self.w(u'<h2>%s</h2>' % _('Attributes'))
    88         self.w(u'<h2>%s</h2>' % _('Attributes'))
    88         rset = self.req.execute('Any N,F,D,GROUP_CONCAT(C),I,J,DE,A '
    89         rset = self.req.execute('Any N,F,D,I,J,DE,A '
    89                                 'GROUPBY N,F,D,AA,A,I,J,DE '
       
    90                                 'ORDERBY AA WHERE A is CWAttribute, '
    90                                 'ORDERBY AA WHERE A is CWAttribute, '
    91                                 'A ordernum AA, A defaultval D, '
    91                                 'A ordernum AA, A defaultval D, '
    92                                 'A constrained_by C?, A description DE, '
    92                                 'A description DE, '
    93                                 'A fulltextindexed I, A internationalizable J, '
    93                                 'A fulltextindexed I, A internationalizable J, '
    94                                 'A relation_type R, R name N, '
    94                                 'A relation_type R, R name N, '
    95                                 'A to_entity O, O name F, '
    95                                 'A to_entity O, O name F, '
    96                                 'A from_entity S, S eid %(x)s',
    96                                 'A from_entity S, S eid %(x)s',
    97                                 {'x': entity.eid})
    97                                 {'x': entity.eid})
    98         self.wview('editable-table', rset, 'null', displayfilter=True)
    98         self.wview('editable-table', rset, 'null', displayfilter=True)
    99         self.w(u'<h2>%s</h2>' % _('Relations'))
    99         self.w(u'<h2>%s</h2>' % _('Relations'))
   100         rset = self.req.execute('Any N,C,F,M,K,D,A ORDERBY N '
   100         rset = self.req.execute(
   101                                 'WITH N,C,F,M,D,K,A BEING ('
   101             'Any R,C,TT,K,D,A,RN,TTN ORDERBY RN '
   102                                 '(Any N,C,F,M,K,D,A '
   102             'WHERE A is CWRelation, A description D, A composite K?, '
   103                                 'ORDERBY N WHERE A is CWRelation, '
   103             'A relation_type R, R name RN, A to_entity TT, TT name TTN, '
   104                                 'A description D, A composite K?, '
   104             'A cardinality C, A from_entity S, S eid %(x)s',
   105                                 'A relation_type R, R name N, '
   105             {'x': entity.eid})
   106                                 'A to_entity O, O name F, '
   106         self.wview('editable-table', rset, 'null', displayfilter=True,
   107                                 'A cardinality C, O meta M, '
   107                    displaycols=range(6), mainindex=5)
   108                                 'A from_entity S, S eid %(x)s)'
   108         rset = self.req.execute(
   109                                 ' UNION '
   109             'Any R,C,TT,K,D,A,RN,TTN ORDERBY RN '
   110                                 '(Any N,C,F,M,K,D,A '
   110             'WHERE A is CWRelation, A description D, A composite K?, '
   111                                 'ORDERBY N WHERE A is CWRelation, '
   111             'A relation_type R, R name RN, A from_entity TT, TT name TTN, '
   112                                 'A description D, A composite K?, '
   112             'A cardinality C, A to_entity O, O eid %(x)s',
   113                                 'A relation_type R, R name N, '
   113             {'x': entity.eid})
   114                                 'A from_entity S, S name F, '
   114         self.wview('editable-table', rset, 'null', displayfilter=True,
   115                                 'A cardinality C, S meta M, '
   115                    displaycols=range(6), mainindex=5)
   116                                 'A to_entity O, O eid %(x)s))'
       
   117                                 ,{'x': entity.eid})
       
   118         self.wview('editable-table', rset, 'null', displayfilter=True)
       
   119 
   116 
   120 
   117 
   121 class CWETypeSImageView(EntityView):
   118 class CWETypeSImageView(EntityView):
   122     id = 'cwetype-schema-image'
   119     id = 'cwetype-schema-image'
   123     __select__ = EntityView.__select__ & implements('CWEType')
   120     __select__ = EntityView.__select__ & implements('CWEType')