equal
deleted
inserted
replaced
9 |
9 |
10 from logilab.common.textutils import unormalize |
10 from logilab.common.textutils import unormalize |
11 from logilab.mtconverter import html_escape |
11 from logilab.mtconverter import html_escape |
12 |
12 |
13 from cubicweb.common.uilib import ureport_as_html, ajax_replace_url |
13 from cubicweb.common.uilib import ureport_as_html, ajax_replace_url |
14 from cubicweb.common.view import StartupView |
14 from cubicweb.view import StartupView |
15 from cubicweb.common.selectors import match_user_group |
15 from cubicweb.selectors import match_user_group |
16 from cubicweb.web.httpcache import EtagHTTPCacheManager |
16 from cubicweb.web.httpcache import EtagHTTPCacheManager |
17 from cubicweb.web.views.management import SecurityViewMixIn |
17 from cubicweb.web.views.management import SecurityViewMixIn |
18 from copy import deepcopy |
18 from copy import deepcopy |
19 _ = unicode |
19 _ = unicode |
20 |
20 |
187 self.w(u'<div id="detailed_schema">') |
187 self.w(u'<div id="detailed_schema">') |
188 if section: |
188 if section: |
189 self.wview(section, None) |
189 self.wview(section, None) |
190 self.w(u'</div>') |
190 self.w(u'</div>') |
191 |
191 |
192 |
192 |
193 class ManagerSchemaPermissionsView(StartupView, SecurityViewMixIn): |
193 class ManagerSchemaPermissionsView(StartupView, SecurityViewMixIn): |
194 id = 'schema_security' |
194 id = 'schema_security' |
195 require_groups = ('managers',) |
195 __select__ = StartupView.__select__ & (match_user_group('managers') |
196 __selectors__ = StartupView.__selectors__ + (match_user_group,) |
|
197 |
196 |
198 def call(self, display_relations=True, |
197 def call(self, display_relations=True, |
199 skiprels=('is', 'is_instance_of', 'identity', 'owned_by', 'created_by')): |
198 skiprels=('is', 'is_instance_of', 'identity', 'owned_by', 'created_by')): |
200 _ = self.req._ |
199 _ = self.req._ |
201 formparams = {} |
200 formparams = {} |
207 if not eschema.is_final()] |
206 if not eschema.is_final()] |
208 if not formparams['withmeta']: |
207 if not formparams['withmeta']: |
209 entities = [eschema for eschema in entities |
208 entities = [eschema for eschema in entities |
210 if not eschema.meta] |
209 if not eschema.meta] |
211 # compute relations |
210 # compute relations |
212 relations = [] |
211 relations = [] |
213 if display_relations: |
212 if display_relations: |
214 relations = [rschema for rschema in schema.relations() |
213 relations = [rschema for rschema in schema.relations() |
215 if not (rschema.is_final() or rschema.type in skiprels)] |
214 if not (rschema.is_final() or rschema.type in skiprels)] |
216 if not formparams['withmeta']: |
215 if not formparams['withmeta']: |
217 relations = [rschema for rschema in relations |
216 relations = [rschema for rschema in relations |
287 ', '.join( [str(obj) for obj in rschema.objects()]), |
286 ', '.join( [str(obj) for obj in rschema.objects()]), |
288 ', '.join( [_(str(obj)) for obj in rschema.objects()]))) |
287 ', '.join( [_(str(obj)) for obj in rschema.objects()]))) |
289 self.schema_definition(rschema, link=False) |
288 self.schema_definition(rschema, link=False) |
290 self.w(u'</div>') |
289 self.w(u'</div>') |
291 |
290 |
292 |
291 |
293 class SchemaUreportsView(StartupView): |
292 class SchemaUreportsView(StartupView): |
294 id = 'schematext' |
293 id = 'schematext' |
295 |
294 |
296 def call(self): |
295 def call(self): |
297 from cubicweb.schemaviewer import SchemaViewer |
296 from cubicweb.schemaviewer import SchemaViewer |