diff -r 554eb4dd533d -r 12040c090aa4 web/views/startup.py --- a/web/views/startup.py Thu May 28 22:56:38 2009 +0200 +++ b/web/views/startup.py Thu May 28 22:57:52 2009 +0200 @@ -13,12 +13,12 @@ from logilab.mtconverter import html_escape from cubicweb.view import StartupView -from cubicweb.selectors import match_user_groups +from cubicweb.selectors import match_user_groups, implements from cubicweb.common.uilib import ureport_as_html from cubicweb.web import ajax_replace_url, uicfg, httpcache +from cubicweb.web.views import tabs from cubicweb.web.views.management import SecurityViewMixIn - class ManageView(StartupView): id = 'manage' title = _('manage') @@ -164,42 +164,44 @@ def display_folders(self): return 'Folder' in self.schema and self.req.execute('Any COUNT(X) WHERE X is Folder')[0][0] - - -class SchemaView(StartupView): +class SchemaView(tabs.TabsMixin, StartupView): id = 'schema' title = _('application schema') + tabs = [_('schema-text'), _('schema-image')] + default_tab = 'schema-image' def call(self): """display schema information""" self.req.add_js('cubicweb.ajax.js') self.req.add_css(('cubicweb.schema.css','cubicweb.acl.css')) - withmeta = int(self.req.form.get('withmeta', 0)) - section = self.req.form.get('sec', '') + self.w(u'

%s

' % _('Schema of the data model')) + self.render_tabs(self.tabs, self.default_tab) + +class SchemaTabImageView(StartupView): + id = 'schema-image' + + def call(self): + self.w(_(u'
This schema of the data model excludes the ' + u'meta-data, but you can also display a complete ' + u'schema with meta-data.
') + % html_escape(self.build_url('view', vid='schemagraph', withmeta=1))) self.w(u'%s\n' % ( - html_escape(self.req.build_url('view', vid='schemagraph', withmeta=withmeta)), + html_escape(self.req.build_url('view', vid='schemagraph', withmeta=0)), self.req._("graphical representation of the application'schema"))) - if withmeta: - self.w(u'
%s
' % ( - html_escape(self.build_url('schema', withmeta=0, sec=section)), - self.req._('hide meta-data'))) - else: - self.w(u'
%s
' % ( - html_escape(self.build_url('schema', withmeta=1, sec=section)), - self.req._('show meta-data'))) - self.w(u'%s
' % - (html_escape(ajax_replace_url('detailed_schema', '', 'schematext', - skipmeta=int(not withmeta))), - self.req._('detailed schema view'))) - if self.req.user.matching_groups('managers'): - self.w(u'%s' % - (html_escape(ajax_replace_url('detailed_schema', '', 'schema_security', - skipmeta=int(not withmeta))), - self.req._('security'))) - self.w(u'
') - if section: - self.wview(section, None) - self.w(u'
') + +class SchemaTabTextView(StartupView): + id = 'schema-text' + + def call(self): + self.w(u'

%s

' % _('This is the list of types defined in the data ' + 'model ofin this application.')) + self.w(u'

%s

' % _('meta is True for types that are defined by the ' + 'framework itself (e.g. User and Group). ' + 'final is True for types that can not be the ' + 'subject of a relation (e.g. Int and String).')) + rset = self.req.execute('Any X,M,F ORDERBY N WHERE X is CWEType, X name N, ' + 'X meta M, X final F') + self.wview('editable-table', rset, displayfilter=True) class ManagerSchemaPermissionsView(StartupView, SecurityViewMixIn): @@ -315,3 +317,4 @@ skipmeta=skipmeta) self.w(ureport_as_html(layout)) +