# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1240910551 -7200 # Node ID 2c6eec0b46b9cf71e3896f19f000205525dfafea # Parent 8270580b65a01431465f5a3d059f0c5f1fd49a81 fix imports, cleanup, repair some ajax calls diff -r 8270580b65a0 -r 2c6eec0b46b9 __init__.py --- a/__init__.py Tue Apr 28 10:11:08 2009 +0200 +++ b/__init__.py Tue Apr 28 11:22:31 2009 +0200 @@ -74,7 +74,7 @@ encoding = 'utf-8' self.encoding = encoding # cache result of execution for (rql expr / eids), - # should be emptied on commit/rollback of the server session / web + # should be emptied on commit/rollback of the server session / web # connection self.local_perm_cache = {} @@ -82,7 +82,7 @@ if self.user: return self.user.property_value(key) return self.vreg.property_value(key) - + def etype_rset(self, etype, size=1): """return a fake result set for a particular entity type""" from cubicweb.rset import ResultSet @@ -114,7 +114,7 @@ return None # url generation methods ################################################## - + def build_url(self, method, base_url=None, **kwargs): """return an absolute URL using params dictionary key/values as URL parameters. Values are automatically URL quoted, and the @@ -130,7 +130,7 @@ if not kwargs: return u'%s%s' % (base_url, path) return u'%s%s?%s' % (base_url, path, self.build_url_params(**kwargs)) - + def build_url_params(self, **kwargs): """return encoded params to incorporate them in an URL""" @@ -154,7 +154,7 @@ def url_unquote(self, quoted): """returns a unicode unquoted string - + decoding is based on `self.encoding` which is the encoding used in `url_quote` """ @@ -164,10 +164,10 @@ return unicode(urlunquote(quoted), self.encoding) except UnicodeDecodeError: # might occurs on manually typed URLs return unicode(urlunquote(quoted), 'iso-8859-1') - + # session's user related methods ##################################### - + @cached def user_data(self): """returns a dictionnary with this user's information""" @@ -197,21 +197,21 @@ return False # abstract methods to override according to the web front-end ############# - + def base_url(self): """return the root url of the application""" raise NotImplementedError - + def decorate_rset(self, rset): """add vreg/req (at least) attributes to the given result set """ raise NotImplementedError - + def describe(self, eid): """return a tuple (type, sourceuri, extid) for the entity with id """ raise NotImplementedError - + -# XXX 2.45 is allowing nicer entity type names, use this map for bw compat +# XXX 2.45 is allowing nicer entity type names, use this map for bw compat ETYPE_NAME_MAP = {# 3.2 migration 'ECache': 'CWCache', 'EUser': 'CWUser', @@ -268,7 +268,7 @@ 'ezone': 'zone', 'i18ncontent': 'i18ncontent', 'svnfile': 'vcsfile', - + 'eclassschemes': 'keyword', 'eclassfolders': 'folder', 'eclasstags': 'tag', @@ -300,4 +300,4 @@ return obj.target except AttributeError: return neg_role(obj.role) - + diff -r 8270580b65a0 -r 2c6eec0b46b9 entities/__init__.py --- a/entities/__init__.py Tue Apr 28 10:11:08 2009 +0200 +++ b/entities/__init__.py Tue Apr 28 11:22:31 2009 +0200 @@ -261,12 +261,12 @@ @obsolete('use AutomaticEntityForm.[e]relations_by_category') def relations_by_category(self, categories=None, permission=None): - from cubicweb.web.views.editforms import AutomaticEntityForm + from cubicweb.web.views.autoform import AutomaticEntityForm return AutomaticEntityForm.erelations_by_category(self, categories, permission) @obsolete('use AutomaticEntityForm.[e]srelations_by_category') def srelations_by_category(self, categories=None, permission=None): - from cubicweb.web.views.editforms import AutomaticEntityForm + from cubicweb.web.views.autoform import AutomaticEntityForm return AutomaticEntityForm.esrelations_by_category(self, categories, permission) def _default_format(self): diff -r 8270580b65a0 -r 2c6eec0b46b9 entity.py --- a/entity.py Tue Apr 28 10:11:08 2009 +0200 +++ b/entity.py Tue Apr 28 11:22:31 2009 +0200 @@ -41,30 +41,26 @@ return '1' -MODE_TAGS = set(('link', 'create')) -CATEGORY_TAGS = set(('primary', 'secondary', 'generic', 'generated')) # , 'metadata')) +_MODE_TAGS = set(('link', 'create')) +_CATEGORY_TAGS = set(('primary', 'secondary', 'generic', 'generated')) # , 'metadata')) try: - from cubicweb.web import formwidgets + from cubicweb.web import formwidgets, uicfg from cubicweb.web.views.editforms import AutomaticEntityForm - from cubicweb.web.views.boxes import EditBox - def dispatch_rtags(tags, rtype, role, stype, otype): + def _dispatch_rtags(tags, rtype, role, stype, otype): for tag in tags: - if tag in MODE_TAGS: - EditBox.rmode.set_rtag(tag, rtype, role, stype, otype) - elif tag in CATEGORY_TAGS: - AutomaticEntityForm.rcategories.set_rtag(tag, rtype, role, stype, otype) + if tag in _MODE_TAGS: + uicfg.rmode.set_rtag(tag, rtype, role, stype, otype) + elif tag in _CATEGORY_TAGS: + uicfg.rcategories.set_rtag(tag, rtype, role, stype, otype) elif tag == 'inlineview': - AutomaticEntityForm.rinlined.set_rtag(True, rtype, role, stype, otype) + uicfg.rinlined.set_rtag(True, rtype, role, stype, otype) else: raise ValueError(tag) except ImportError: - AutomaticEntityForm = None - - def dispatch_rtags(*args): - pass + _dispatch_rtags = None def _get_etype(bases, classdict): try: @@ -87,14 +83,14 @@ except AttributeError: continue -class metaentity(type): +class _metaentity(type): """this metaclass sets the relation tags on the entity class and deals with the `widgets` attribute """ def __new__(mcs, name, bases, classdict): # collect baseclass' rtags etype = _get_etype(bases, classdict) - if etype and AutomaticEntityForm is not None: + if etype and _dispatch_rtags is not None: for name, rtags in _get_defs('__rtags__', name, bases, classdict): warn('%s: __rtags__ is deprecated' % name, DeprecationWarning) for relation, tags in rtags.iteritems(): @@ -103,23 +99,23 @@ tags = (tags,) # relation must become a 3-uple (rtype, targettype, role) if isinstance(relation, basestring): - dispatch_rtags(tags, relation, 'subject', etype, '*') - dispatch_rtags(tags, relation, 'object', '*', etype) + _dispatch_rtags(tags, relation, 'subject', etype, '*') + _dispatch_rtags(tags, relation, 'object', '*', etype) elif len(relation) == 1: # useful ? - dispatch_rtags(tags, relation[0], 'subject', etype, '*') - dispatch_rtags(tags, relation[0], 'object', '*', etype) + _dispatch_rtags(tags, relation[0], 'subject', etype, '*') + _dispatch_rtags(tags, relation[0], 'object', '*', etype) elif len(relation) == 2: rtype, ttype = relation ttype = bw_normalize_etype(ttype) # XXX bw compat - dispatch_rtags(tags, rtype, 'subject', etype, ttype) - dispatch_rtags(tags, rtype, 'object', ttype, etype) + _dispatch_rtags(tags, rtype, 'subject', etype, ttype) + _dispatch_rtags(tags, rtype, 'object', ttype, etype) elif len(relation) == 3: rtype, ttype, role = relation ttype = bw_normalize_etype(ttype) if role == 'subject': - dispatch_rtags(tags, rtype, 'subject', etype, ttype) + _dispatch_rtags(tags, rtype, 'subject', etype, ttype) else: - dispatch_rtags(tags, rtype, 'object', ttype, etype) + _dispatch_rtags(tags, rtype, 'object', ttype, etype) else: raise ValueError('bad rtag definition (%r)' % (relation,)) for name, widgets in _get_defs('widgets', name, bases, classdict): @@ -132,7 +128,7 @@ wdgname = 'TextInput' widget = getattr(formwidgets, wdgname) AutomaticEntityForm.rwidgets.set_rtag(wdgname, rtype, 'subject', etype) - return super(metaentity, mcs).__new__(mcs, name, bases, classdict) + return super(_metaentity, mcs).__new__(mcs, name, bases, classdict) class Entity(AppRsetObject, dict): @@ -158,7 +154,7 @@ as composite relations or relations that have '?1' as object cardinality """ - __metaclass__ = metaentity + __metaclass__ = _metaentity __registry__ = 'etypes' __select__ = yes() diff -r 8270580b65a0 -r 2c6eec0b46b9 schema.py --- a/schema.py Tue Apr 28 10:11:08 2009 +0200 +++ b/schema.py Tue Apr 28 11:22:31 2009 +0200 @@ -77,7 +77,7 @@ ## cubicweb provides a RichString class for convenience class RichString(ybo.String): """Convenience RichString attribute type - The follwing declaration:: + The following declaration:: class Card(EntityType): content = RichString(fulltextindexed=True, default_format='text/rest') diff -r 8270580b65a0 -r 2c6eec0b46b9 view.py --- a/view.py Tue Apr 28 10:11:08 2009 +0200 +++ b/view.py Tue Apr 28 11:22:31 2009 +0200 @@ -51,6 +51,7 @@ cubicweb:variables CDATA #IMPLIED cubicweb:displayactions CDATA #IMPLIED cubicweb:fallbackvid CDATA #IMPLIED + cubicweb:fname CDATA #IMPLIED cubicweb:vid CDATA #IMPLIED cubicweb:rql CDATA #IMPLIED cubicweb:actualrql CDATA #IMPLIED diff -r 8270580b65a0 -r 2c6eec0b46b9 web/data/cubicweb.ajax.js --- a/web/data/cubicweb.ajax.js Tue Apr 28 10:11:08 2009 +0200 +++ b/web/data/cubicweb.ajax.js Tue Apr 28 11:22:31 2009 +0200 @@ -282,6 +282,7 @@ var props = {}; if (node) { props['rql'] = rql; + props['fname'] = 'view'; props['pageid'] = pageid; if (vid) { props['vid'] = vid; } if (extraparams) { jQuery.extend(props, extraparams); } diff -r 8270580b65a0 -r 2c6eec0b46b9 web/uicfg.py --- a/web/uicfg.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/uicfg.py Tue Apr 28 11:22:31 2009 +0200 @@ -11,7 +11,7 @@ __docformat__ = "restructuredtext en" from cubicweb.rtags import RelationTags -# editforms.AutomaticEntityForm configuration ################################# +# autoform.AutomaticEntityForm configuration ################################## # relations'category (eg primary/secondary/generic/metadata/generated) rcategories = RelationTags() diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/actions.py --- a/web/views/actions.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/actions.py Tue Apr 28 11:22:31 2009 +0200 @@ -15,7 +15,7 @@ ) from cubicweb.web.action import Action from cubicweb.web.views import linksearch_select_url, vid_from_rset -from cubicweb.web.views.editforms import AutomaticEntityForm +from cubicweb.web.views.autoform import AutomaticEntityForm _ = unicode diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/autoform.py --- a/web/views/autoform.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/autoform.py Tue Apr 28 11:22:31 2009 +0200 @@ -11,6 +11,7 @@ from cubicweb import typed_eid from cubicweb.web import stdmsgs, uicfg from cubicweb.web.form import FieldNotFound, EntityFieldsForm +from cubicweb.web.formfields import guess_field from cubicweb.web.formwidgets import Button, SubmitButton _ = unicode diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/baseforms.py --- a/web/views/baseforms.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/baseforms.py Tue Apr 28 11:22:31 2009 +0200 @@ -21,7 +21,7 @@ from cubicweb.web.controller import NAV_FORM_PARAMETERS from cubicweb.web.widgets import checkbox, InputWidget, ComboBoxWidget from cubicweb.web.form import FormMixIn -from cubicweb.web.views.editforms import AutomaticEntityForm +from cubicweb.web.views.autoform import AutomaticEntityForm _ = unicode diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/baseviews.py --- a/web/views/baseviews.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/baseviews.py Tue Apr 28 11:22:31 2009 +0200 @@ -373,6 +373,7 @@ from cubicweb.web.views import boxes, xmlrss, primary PrimaryView = class_moved(primary.PrimaryView) +PRIMARY_SKIP_RELS = primary.PRIMARY_SKIP_RELS SideBoxView = class_moved(boxes.SideBoxView) XmlView = class_moved(xmlrss.XmlView) XmlItemView = class_moved(xmlrss.XmlItemView) diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/bookmark.py --- a/web/views/bookmark.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/bookmark.py Tue Apr 28 11:22:31 2009 +0200 @@ -11,13 +11,11 @@ from cubicweb import Unauthorized from cubicweb.selectors import implements from cubicweb.web.htmlwidgets import BoxWidget, BoxMenu, RawBoxItem -from cubicweb.web import action, formwidgets -from cubicweb.web.box import UserRQLBoxTemplate +from cubicweb.web import uicfg, action, box, formwidgets from cubicweb.web.views.baseviews import PrimaryView -from cubicweb.web.views.editforms import AutomaticEntityForm -AutomaticEntityForm.rcategories.set_rtag('primary', 'path', 'subject', 'Bookmark') -AutomaticEntityForm.rwidgets.set_rtag(formwidgets.TextInput, 'path', 'subject', 'Bookmark') +uicfg.rcategories.set_rtag('primary', 'path', 'subject', 'Bookmark') +uicfg.rwidgets.set_rtag(formwidgets.TextInput, 'path', 'subject', 'Bookmark') class FollowAction(action.Action): @@ -26,14 +24,14 @@ title = _('follow') category = 'mainactions' - + def url(self): return self.rset.get_entity(self.row or 0, self.col or 0).actual_url() class BookmarkPrimaryView(PrimaryView): __select__ = implements('Bookmark') - + def cell_call(self, row, col): """the primary view for bookmark entity""" entity = self.complete_entity(row, col) @@ -49,7 +47,7 @@ self.w(u'') -class BookmarksBox(UserRQLBoxTemplate): +class BookmarksBox(box.UserRQLBoxTemplate): """display a box containing all user's bookmarks""" id = 'bookmarks_box' order = 40 @@ -59,8 +57,8 @@ 'U eid %(x)s') etype = 'Bookmark' rtype = 'bookmarked_by' - - + + def call(self, **kwargs): req = self.req ueid = req.user.eid diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/editforms.py --- a/web/views/editforms.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/editforms.py Tue Apr 28 11:22:31 2009 +0200 @@ -20,7 +20,6 @@ from cubicweb.common import tags from cubicweb.web import stdmsgs from cubicweb.web.form import CompositeForm, EntityFieldsForm, FormViewMixIn -from cubicweb.web.formfields import guess_field from cubicweb.web.formwidgets import Button, SubmitButton, ResetButton from cubicweb.web.formrenderers import (FormRenderer, EntityFormRenderer, EntityCompositeFormRenderer, diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/emailaddress.py --- a/web/views/emailaddress.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/emailaddress.py Tue Apr 28 11:22:31 2009 +0200 @@ -11,16 +11,15 @@ from cubicweb.selectors import implements from cubicweb.common import Unauthorized from cubicweb.web.views import baseviews -from cubicweb.web.views.editforms import AutomaticEntityForm class EmailAddressPrimaryView(baseviews.PrimaryView): __select__ = implements('EmailAddress') - + def cell_call(self, row, col, skipeids=None): self.skipeids = skipeids super(EmailAddressPrimaryView, self).cell_call(row, col) - + def render_entity_attributes(self, entity, siderelations): self.w(u'

') entity.view('oneline', w=self.w) @@ -70,10 +69,10 @@ entity.view('oneline', w=self.w) self.w(u'

') - + class EmailAddressOneLineView(baseviews.OneLineView): __select__ = implements('EmailAddress') - + def cell_call(self, row, col, **kwargs): entity = self.entity(row, col) if entity.reverse_primary_email: @@ -93,7 +92,7 @@ id = 'mailto' __select__ = implements('EmailAddress') - + def cell_call(self, row, col, **kwargs): entity = self.entity(row, col) if entity.reverse_primary_email: @@ -108,15 +107,15 @@ mailto = "mailto:%s" % entity.display_address() self.w(u'%s' % (html_escape(mailto), html_escape(entity.display_address()))) - + if entity.alias: self.w(u'>\n') if entity.reverse_primary_email: self.w(u'') - + class EmailAddressTextView(baseviews.TextView): __select__ = implements('EmailAddress') - + def cell_call(self, row, col, **kwargs): self.w(self.entity(row, col).display_address()) diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/eproperties.py --- a/web/views/eproperties.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/eproperties.py Tue Apr 28 11:22:31 2009 +0200 @@ -21,7 +21,6 @@ from cubicweb.web.form import CompositeForm, EntityFieldsForm, FormViewMixIn from cubicweb.web.formfields import FIELDS, StringField from cubicweb.web.formwidgets import Select, Button, SubmitButton -from cubicweb.web.views.editforms import AutomaticEntityForm _ = unicode diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/idownloadable.py --- a/web/views/idownloadable.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/idownloadable.py Tue Apr 28 11:22:31 2009 +0200 @@ -43,9 +43,10 @@ id = 'download_box' # no download box for images # XXX primary_view selector ? - __select__ = (one_line_rset() & implements(IDownloadable) & match_context_prop() & ~score_entity(is_image)) + __select__ = (one_line_rset() & implements(IDownloadable) & + match_context_prop() & ~score_entity(is_image)) order = 10 - + def cell_call(self, row, col, title=None, label=None, **kwargs): entity = self.entity(row, col) download_box(self.w, entity, title, label) @@ -86,14 +87,14 @@ __select__ = implements(IDownloadable) title = None # should not be listed in possible views - + def cell_call(self, row, col, title=None, **kwargs): entity = self.entity(row, col) url = html_escape(entity.download_url()) self.w(u'%s' % (url, html_escape(title or entity.dc_title()))) - + class IDownloadablePrimaryView(baseviews.PrimaryView): __select__ = implements(IDownloadable) # XXX File/Image attributes but this is not specified in the IDownloadable interface @@ -103,7 +104,7 @@ self.w(u'

%s %s

' % (entity.dc_type().capitalize(), html_escape(entity.dc_title()))) - + def render_entity_attributes(self, entity, siderelations): super(IDownloadablePrimaryView, self).render_entity_attributes(entity, siderelations) self.w(u'
') @@ -121,7 +122,7 @@ msg = self.req._("can't display data, unexpected error: %s") % ex self.w('
%s
' % msg) self.w(u'
') - + def is_side_related(self, rschema, eschema): """display all relations as side related""" return True @@ -143,16 +144,16 @@ class ImageView(baseviews.EntityView): id = 'image' __select__ = implements(IDownloadable) & score_entity(is_image) - + title = _('image') - + def call(self): rset = self.rset for i in xrange(len(rset)): self.w(u'
') self.wview(self.id, rset, row=i, col=0) self.w(u'
') - + def cell_call(self, row, col): entity = self.entity(row, col) #if entity.data_format.startswith('image/'): diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/schema.py --- a/web/views/schema.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/schema.py Tue Apr 28 11:22:31 2009 +0200 @@ -15,49 +15,46 @@ from cubicweb.schemaviewer import SchemaViewer from cubicweb.view import EntityView, StartupView from cubicweb.common.uilib import ureport_as_html -from cubicweb.web.action import Action -from cubicweb.web.views import baseviews -from cubicweb.web.views import TmpFileViewMixin -from cubicweb.web.views.editforms import AutomaticEntityForm -from cubicweb.web.views.boxes import EditBox +from cubicweb.web import uicfg, action +from cubicweb.web.views import TmpFileViewMixin, baseviews -AutomaticEntityForm.rcategories.set_rtag('primary', 'require_group', 'subject', 'CWPermission') -AutomaticEntityForm.rcategories.set_rtag('generated', 'final', 'subject', 'EEtype') -AutomaticEntityForm.rcategories.set_rtag('generated', 'final', 'subject', 'ERtype') -AutomaticEntityForm.rinlined.set_rtag(True, 'relation_type', 'subject', 'CWRelation') -AutomaticEntityForm.rinlined.set_rtag(True, 'from_entity', 'subject', 'CWRelation') -AutomaticEntityForm.rinlined.set_rtag(True, 'to_entity', 'subject', 'CWRelation') -AutomaticEntityForm.rwidgets.set_rtag('StringWidget', 'expression', 'subject', 'RQLExpression') +uicfg.rcategories.set_rtag('primary', 'require_group', 'subject', 'CWPermission') +uicfg.rcategories.set_rtag('generated', 'final', 'subject', 'EEtype') +uicfg.rcategories.set_rtag('generated', 'final', 'subject', 'ERtype') +uicfg.rinlined.set_rtag(True, 'relation_type', 'subject', 'CWRelation') +uicfg.rinlined.set_rtag(True, 'from_entity', 'subject', 'CWRelation') +uicfg.rinlined.set_rtag(True, 'to_entity', 'subject', 'CWRelation') +uicfg.rwidgets.set_rtag('StringWidget', 'expression', 'subject', 'RQLExpression') -EditBox.rmode.set_rtag('create', 'state_of', 'object', 'CWEType') -EditBox.rmode.set_rtag('create', 'transition_of', 'object', 'CWEType') -EditBox.rmode.set_rtag('create', 'relation_type', 'object', 'CWRType') -EditBox.rmode.set_rtag('link', 'from_entity', 'object', 'CWEType') -EditBox.rmode.set_rtag('link', 'to_entity', 'object', 'CWEType') +uicfg.rmode.set_rtag('create', 'state_of', 'object', 'CWEType') +uicfg.rmode.set_rtag('create', 'transition_of', 'object', 'CWEType') +uicfg.rmode.set_rtag('create', 'relation_type', 'object', 'CWRType') +uicfg.rmode.set_rtag('link', 'from_entity', 'object', 'CWEType') +uicfg.rmode.set_rtag('link', 'to_entity', 'object', 'CWEType') -class ViewSchemaAction(Action): +class ViewSchemaAction(action.Action): id = 'schema' __select__ = yes() - + title = _("site schema") category = 'siteactions' order = 30 - + def url(self): return self.build_url(self.id) - - + + # schema entity types views ################################################### class _SchemaEntityPrimaryView(baseviews.PrimaryView): show_attr_label = False - cache_max_age = 60*60*2 # stay in http cache for 2 hours by default - + cache_max_age = 60*60*2 # stay in http cache for 2 hours by default + def content_title(self, entity): return html_escape(entity.dc_long_title()) - + class CWETypePrimaryView(_SchemaEntityPrimaryView): __select__ = implements('CWEType') skip_attrs = _SchemaEntityPrimaryView.skip_attrs + ('name', 'meta', 'final') @@ -73,7 +70,7 @@ class CWETypeOneLineView(baseviews.OneLineView): __select__ = implements('CWEType') - + def cell_call(self, row, col, **kwargs): entity = self.entity(row, col) final = entity.final @@ -92,7 +89,7 @@ main_related_section = False skip_rels = ('is', 'is_instance_of', 'identity', 'created_by', 'owned_by', 'has_text',) - + def render_entity_attributes(self, entity, siderelations): super(CWETypeSchemaView, self).render_entity_attributes(entity, siderelations) eschema = self.vreg.schema.eschema(entity.name) @@ -120,7 +117,7 @@ self.w(u'%s' % ( html_escape(entity.absolute_url(vid='eschemagraph')), html_escape(self.req._('graphical schema for %s') % entity.name))) - + # schema images ############################################################### @@ -143,11 +140,11 @@ self.nextcolor = cycle( ('#aa0000', '#00aa00', '#0000aa', '#000000', '#888888') ).next self.req = req - + def display_attr(self, rschema): return not rschema.meta and (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')) - + # XXX remove this method once yams > 0.20 is out def node_properties(self, eschema): """return default DOT drawing options for an entity schema""" @@ -168,7 +165,7 @@ # + 1 line going to the closest edge spline point) kwargs['decorate'] = 'false' return kwargs - + class RestrictedSchemaVisitorMiIn: def __init__(self, req, *args, **kwargs): @@ -177,12 +174,12 @@ self.__parent = self.__class__.__bases__[1] self.__parent.__init__(self, *args, **kwargs) self.req = req - + def nodes(self): for etype, eschema in self.__parent.nodes(self): if eschema.has_local_role('read') or eschema.has_perm(self.req, 'read'): yield eschema.type, eschema - + def edges(self): for setype, oetype, rschema in self.__parent.edges(self): if rschema.has_local_role('read') or rschema.has_perm(self.req, 'read'): @@ -215,7 +212,7 @@ content_type = 'image/png' __select__ = implements('CWEType') skip_rels = ('owned_by', 'created_by', 'identity', 'is', 'is_instance_of') - + def _generate(self, tmpfile): """display schema information for an entity""" entity = self.entity(self.row, self.col) @@ -226,7 +223,7 @@ class CWRTypeSchemaImageView(CWETypeSchemaImageView): __select__ = implements('CWRType') - + def _generate(self, tmpfile): """display schema information for an entity""" entity = self.entity(self.row, self.col) diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/startup.py --- a/web/views/startup.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/startup.py Tue Apr 28 11:22:31 2009 +0200 @@ -19,12 +19,12 @@ class ManageView(StartupView): id = 'manage' - title = _('manage') + title = _('manage') http_cache_manager = EtagHTTPCacheManager def display_folders(self): return False - + def call(self, **kwargs): """The default view representing the application's management""" self.req.add_css('cubicweb.manageview.css') @@ -35,7 +35,7 @@ self.w(u'\n') self.w(u'') self.w(u'
') self._main_index() - self.w(u'') + self.w(u'') self.folders() self.w(u'
\n') @@ -63,22 +63,22 @@ href = req.build_url('view', vid='creation', etype='Card', wikiid='index') label = self.req._('create an index page') self.w(u'
%s\n' % (html_escape(href), label)) - + def folders(self): self.w(u'

%s

\n' % self.req._('Browse by category')) self.vreg.select_view('tree', self.req, None).dispatch(w=self.w) - + def startup_views(self): self.w(u'

%s

\n' % self.req._('Startup views')) self.startupviews_table() - + def startupviews_table(self): for v in self.vreg.possible_views(self.req, None): if v.category != 'startupview' or v.id in ('index', 'tree', 'manage'): continue self.w('

%s

' % ( html_escape(v.url()), html_escape(self.req._(v.title).capitalize()))) - + def entities(self): schema = self.schema self.w(u'

%s

\n' % self.req._('The repository holds the following entities')) @@ -88,7 +88,7 @@ self.w(u'%s\n' % self.req._('application entities')) self.entity_types_table(eschema for eschema in schema.entities() if not eschema.meta and not eschema.is_subobject(strict=True)) - if manager: + if manager: self.w(u'%s\n' % self.req._('system entities')) self.entity_types_table(eschema for eschema in schema.entities() if eschema.meta and not eschema.schema_entity()) @@ -97,7 +97,7 @@ self.entity_types_table(schema.eschema(etype) for etype in schema.schema_entity_types()) self.w(u'') - + def entity_types_table(self, eschemas): newline = 0 infos = sorted(self.entity_types(eschemas), @@ -111,8 +111,8 @@ self.w(u'%s%s\n' % (addlink, etypelink)) self.w(u'%s%s\n' % (addlink2, etypelink2)) self.w(u'\n') - - + + def entity_types(self, eschemas): """return a list of formatted links to get a list of entities of a each entity's types @@ -133,7 +133,7 @@ etypelink = u' %s (%d)' % ( html_escape(url), label, nb) yield (label, etypelink, self.add_entity_link(eschema, req)) - + def add_entity_link(self, eschema, req): """creates a [+] link for adding an entity if user has permission to do so""" if not eschema.has_perm(req, 'add'): @@ -142,14 +142,14 @@ html_escape(self.create_url(eschema.type)), self.req.__('add a %s' % eschema)) - + class IndexView(ManageView): id = 'index' title = _('index') - + 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): diff -r 8270580b65a0 -r 2c6eec0b46b9 web/views/tabs.py --- a/web/views/tabs.py Tue Apr 28 10:11:08 2009 +0200 +++ b/web/views/tabs.py Tue Apr 28 11:22:31 2009 +0200 @@ -38,7 +38,7 @@ 'lazyview wants at least : rql, or an eid, or an rset -- or call it with static=True' w = w or self.w self.req.add_js('cubicweb.lazy.js') - urlparams = {'vid' : vid, 'mode' : 'html'} + urlparams = {'vid' : vid, 'fname' : 'view'} if rql: urlparams['rql'] = rql elif eid: