equal
deleted
inserted
replaced
40 return False |
40 return False |
41 |
41 |
42 def call(self, **kwargs): |
42 def call(self, **kwargs): |
43 """The default view representing the instance's management""" |
43 """The default view representing the instance's management""" |
44 self._cw.add_css('cubicweb.manageview.css') |
44 self._cw.add_css('cubicweb.manageview.css') |
45 self.w(u'<div>\n') |
45 self.w(u'<h1>%s</h1>' % self._cw.property_value('ui.site-title')) |
46 if not self.display_folders(): |
46 if not self.display_folders(): |
47 self._main_index() |
47 self._main_index() |
48 else: |
48 else: |
49 self.w(u'<table><tr>\n') |
49 self.w(u'<table><tr>\n') |
50 self.w(u'<td style="width:40%">') |
50 self.w(u'<td style="width:40%">') |
51 self._main_index() |
51 self._main_index() |
52 self.w(u'</td><td style="width:60%">') |
52 self.w(u'</td><td style="width:60%">') |
53 self.folders() |
53 self.folders() |
54 self.w(u'</td>') |
54 self.w(u'</td>') |
55 self.w(u'</tr></table>\n') |
55 self.w(u'</tr></table>\n') |
56 self.w(u'</div>\n') |
|
57 |
56 |
58 def _main_index(self): |
57 def _main_index(self): |
59 req = self._cw |
58 req = self._cw |
60 manager = req.user.matching_groups('managers') |
59 manager = req.user.matching_groups('managers') |
61 if not manager and 'Card' in self._cw.vreg.schema: |
60 if not manager and 'Card' in self._cw.vreg.schema: |
77 href = req.build_url('view', vid='creation', etype='Card', wikiid='index') |
76 href = req.build_url('view', vid='creation', etype='Card', wikiid='index') |
78 label = self._cw._('create an index page') |
77 label = self._cw._('create an index page') |
79 self.w(u'<br/><a href="%s">%s</a>\n' % (xml_escape(href), label)) |
78 self.w(u'<br/><a href="%s">%s</a>\n' % (xml_escape(href), label)) |
80 |
79 |
81 def folders(self): |
80 def folders(self): |
82 self.w(u'<h4>%s</h4>\n' % self._cw._('Browse by category')) |
81 self.w(u'<h2>%s</h2>\n' % self._cw._('Browse by category')) |
83 self._cw.vreg['views'].select('tree', self._cw).render(w=self.w) |
82 self._cw.vreg['views'].select('tree', self._cw).render(w=self.w) |
84 |
83 |
85 def create_links(self): |
84 def create_links(self): |
86 self.w(u'<ul class="createLink">') |
85 self.w(u'<ul class="createLink">') |
87 for etype in self.add_etype_links: |
86 for etype in self.add_etype_links: |
91 self._cw.build_url('add/%s' % eschema), |
90 self._cw.build_url('add/%s' % eschema), |
92 self._cw.__('add a %s' % eschema).capitalize())) |
91 self._cw.__('add a %s' % eschema).capitalize())) |
93 self.w(u'</ul>') |
92 self.w(u'</ul>') |
94 |
93 |
95 def startup_views(self): |
94 def startup_views(self): |
96 self.w(u'<h4>%s</h4>\n' % self._cw._('Startup views')) |
95 self.w(u'<h2>%s</h2>\n' % self._cw._('Startup views')) |
97 self.startupviews_table() |
96 self.startupviews_table() |
98 |
97 |
99 def startupviews_table(self): |
98 def startupviews_table(self): |
100 for v in self._cw.vreg['views'].possible_views(self._cw, None): |
99 for v in self._cw.vreg['views'].possible_views(self._cw, None): |
101 if v.category != 'startupview' or v.__regid__ in ('index', 'tree', 'manage'): |
100 if v.category != 'startupview' or v.__regid__ in ('index', 'tree', 'manage'): |
103 self.w('<p><a href="%s">%s</a></p>' % ( |
102 self.w('<p><a href="%s">%s</a></p>' % ( |
104 xml_escape(v.url()), xml_escape(self._cw._(v.title).capitalize()))) |
103 xml_escape(v.url()), xml_escape(self._cw._(v.title).capitalize()))) |
105 |
104 |
106 def entities(self): |
105 def entities(self): |
107 schema = self._cw.vreg.schema |
106 schema = self._cw.vreg.schema |
108 self.w(u'<h4>%s</h4>\n' % self._cw._('The repository holds the following entities')) |
107 self.w(u'<h2>%s</h2>\n' % self._cw._('Browse by entity type')) |
109 manager = self._cw.user.matching_groups('managers') |
108 manager = self._cw.user.matching_groups('managers') |
110 self.w(u'<table class="startup">') |
109 self.w(u'<table class="startup">') |
111 if manager: |
110 if manager: |
112 self.w(u'<tr><th colspan="4">%s</th></tr>\n' % self._cw._('application entities')) |
111 self.w(u'<tr><th colspan="4">%s</th></tr>\n' % self._cw._('application entities')) |
113 self.entity_types_table(eschema for eschema in schema.entities() |
112 self.entity_types_table(eschema for eschema in schema.entities() |