web/views/startup.py
changeset 2058 7ef12c03447c
parent 2017 4090a9546ea3
child 2126 a25859917ccc
equal deleted inserted replaced
2057:0a0cbccafcb5 2058:7ef12c03447c
    78                 label = self.req._('create an index page')
    78                 label = self.req._('create an index page')
    79             self.w(u'<br/><a href="%s">%s</a>\n' % (html_escape(href), label))
    79             self.w(u'<br/><a href="%s">%s</a>\n' % (html_escape(href), label))
    80 
    80 
    81     def folders(self):
    81     def folders(self):
    82         self.w(u'<h4>%s</h4>\n' % self.req._('Browse by category'))
    82         self.w(u'<h4>%s</h4>\n' % self.req._('Browse by category'))
    83         self.vreg.select_view('tree', self.req, None).render(w=self.w)
    83         self.vreg.select('views', 'tree', self.req).render(w=self.w)
    84 
    84 
    85     def startup_views(self):
    85     def startup_views(self):
    86         self.w(u'<h4>%s</h4>\n' % self.req._('Startup views'))
    86         self.w(u'<h4>%s</h4>\n' % self.req._('Startup views'))
    87         self.startupviews_table()
    87         self.startupviews_table()
    88 
    88 
   138                 continue
   138                 continue
   139             etype = eschema.type
   139             etype = eschema.type
   140             label = display_name(req, etype, 'plural')
   140             label = display_name(req, etype, 'plural')
   141             nb = req.execute('Any COUNT(X) WHERE X is %s' % etype)[0][0]
   141             nb = req.execute('Any COUNT(X) WHERE X is %s' % etype)[0][0]
   142             if nb > 1:
   142             if nb > 1:
   143                 view = self.vreg.select_view('list', req, req.etype_rset(etype))
   143                 view = self.vreg.select('views', 'list', req,
       
   144                                         rset=req.etype_rset(etype))
   144                 url = view.url()
   145                 url = view.url()
   145             else:
   146             else:
   146                 url = self.build_url('view', rql='%s X' % etype)
   147                 url = self.build_url('view', rql='%s X' % etype)
   147             etypelink = u'&nbsp;<a href="%s">%s</a> (%d)' % (
   148             etypelink = u'&nbsp;<a href="%s">%s</a> (%d)' % (
   148                 html_escape(url), label, nb)
   149                 html_escape(url), label, nb)