# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1238094680 -3600 # Node ID b20677336ee6bb3b53448fe13ccc2ecb2b78cf5c # Parent 2d1b721fded94c6981243e5776f6a67a2644c0e6 turn old __rtags__ the new way diff -r 2d1b721fded9 -r b20677336ee6 web/views/bookmark.py --- a/web/views/bookmark.py Thu Mar 26 19:15:57 2009 +0100 +++ b/web/views/bookmark.py Thu Mar 26 20:11:20 2009 +0100 @@ -1,7 +1,7 @@ """Primary view for bookmarks + user's bookmarks box :organization: Logilab -:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr """ __docformat__ = "restructuredtext en" @@ -14,6 +14,10 @@ from cubicweb.web.action import Action from cubicweb.web.box import UserRQLBoxTemplate from cubicweb.web.views.baseviews import PrimaryView +from cubicweb.web.views.editform import AutomaticEntityForm + +AutomaticEntityForm.rcategories.set_rtag('primary', 'path', 'subject', 'Bookmark') +AutomaticEntityForm.rwidgets.set_rtag('StringWidget', 'path', 'subject', 'Bookmark') class FollowAction(Action): diff -r 2d1b721fded9 -r b20677336ee6 web/views/boxes.py --- a/web/views/boxes.py Thu Mar 26 19:15:57 2009 +0100 +++ b/web/views/boxes.py Thu Mar 26 20:11:20 2009 +0100 @@ -37,6 +37,17 @@ order = 2 # 'link' / 'create' relation tags, used to control the "add entity" submenu rmode = RelationTags() + rmode.set_rtag('link', 'is', 'subject') + rmode.set_rtag('link', 'is', 'object') + rmode.set_rtag('link', 'is_instance_of', 'subject') + rmode.set_rtag('link', 'is_instance_of', 'object') + rmode.set_rtag('link', 'identity', 'subject') + rmode.set_rtag('link', 'identity', 'object') + rmode.set_rtag('link', 'owned_by', 'subject') + rmode.set_rtag('link', 'created_by', 'subject') + rmode.set_rtag('link', 'require_permission', 'subject') + rmode.set_rtag('link', 'wf_info_for', 'subject') + rmode.set_rtag('link', 'wf_info_for', 'subject') @classmethod def registered(cls, registry): diff -r 2d1b721fded9 -r b20677336ee6 web/views/editforms.py --- a/web/views/editforms.py Thu Mar 26 19:15:57 2009 +0100 +++ b/web/views/editforms.py Thu Mar 26 20:11:20 2009 +0100 @@ -154,12 +154,25 @@ rcategories.set_rtag('primary', 'subject', 'eid') rcategories.set_rtag('metadata', 'subject', 'creation_date') rcategories.set_rtag('metadata', 'subject', 'modification_date') - rcategories.set_rtag('generated', 'subject', 'has_text') + rcategories.set_rtag('generated', 'subject', 'has_text') + rcategories.set_rtag('metadata', 'owned_by', 'subject') + rcategories.set_rtag('metadata', 'created_by', 'subject') + rcategories.set_rtag('generated', 'is', 'subject') + rcategories.set_rtag('generated', 'is', 'object') + rcategories.set_rtag('generated', 'is_instance_of', 'subject') + rcategories.set_rtag('generated', 'is_instance_of', 'object') + rcategories.set_rtag('generated', 'identity', 'subject') + rcategories.set_rtag('generated', 'identity', 'object') + rcategories.set_rtag('generated', 'require_permission', 'subject') + rcategories.set_rtag('primary', 'in_state', 'subject') + rcategories.set_rtag('generated', 'wf_info_for', 'subject') + rcategories.set_rtag('generated', 'wf_info_for', 'subject') + rcategories.set_rtag('secondary', 'description', 'subject') # relations'widget (eg one of available class name in cubicweb.web.formwidgets) rwidgets = RelationTags() # inlined view flag for non final relations - inlined = RelationTags() + rinlined = RelationTags() # set of tags of the form _on_new on relations. is a # schema action (add/update/delete/read), and when such a tag is found # permissions checking is by-passed and supposed to be ok @@ -325,8 +338,7 @@ """ entity = self.edited_entity pending_deletes = self.req.get_pending_deletes(entity.eid) - # XXX add metadata category quick fix to get Folder relations - for label, rschema, role in self.srelations_by_category(('generic', 'metadata'), 'add'): + for label, rschema, role in self.srelations_by_category('generic'), 'add'): relatedrset = entity.related(rschema, role, limit=self.limit) if rschema.has_perm(self.req, 'delete'): toggable_rel_link_func = toggable_relation_link @@ -377,7 +389,7 @@ """return true if the given relation with entity has role and a targettype target should be inlined """ - return self.inlined.etype_rtag(self.edited_entity.id, role, rschema, targettype) + return self.rinlined.etype_rtag(self.edited_entity.id, role, rschema, targettype) def should_display_inline_creation_form(self, rschema, existant, card): """return true if a creation form should be inlined diff -r 2d1b721fded9 -r b20677336ee6 web/views/emailaddress.py --- a/web/views/emailaddress.py Thu Mar 26 19:15:57 2009 +0100 +++ b/web/views/emailaddress.py Thu Mar 26 20:11:20 2009 +0100 @@ -1,7 +1,7 @@ """Specific views for email addresses entities :organization: Logilab -:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr """ __docformat__ = "restructuredtext en" @@ -11,6 +11,8 @@ from cubicweb.selectors import implements from cubicweb.common import Unauthorized from cubicweb.web.views import baseviews +from cubicweb.web.views.editform import AutomaticEntityForm + class EmailAddressPrimaryView(baseviews.PrimaryView): __select__ = implements('EmailAddress') diff -r 2d1b721fded9 -r b20677336ee6 web/views/eproperties.py --- a/web/views/eproperties.py Thu Mar 26 19:15:57 2009 +0100 +++ b/web/views/eproperties.py Thu Mar 26 20:11:20 2009 +0100 @@ -17,6 +17,10 @@ from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param from cubicweb.web.views import baseviews from cubicweb.web.form import FormMixIn +from cubicweb.web.views.editform import AutomaticEntityForm + +AutomaticEntityForm.rwidgets.set_rtag('PropertyKeyWidget', 'pkey', 'subject', 'EProperty') +AutomaticEntityForm.rwidgets.set_rtag('PropertyValueWidget', 'value', 'subject', 'EProperty') _ = unicode diff -r 2d1b721fded9 -r b20677336ee6 web/views/euser.py --- a/web/views/euser.py Thu Mar 26 19:15:57 2009 +0100 +++ b/web/views/euser.py Thu Mar 26 20:11:20 2009 +0100 @@ -16,8 +16,25 @@ from cubicweb.web.form import FormMixIn from cubicweb.web.action import Action from cubicweb.web.views.baseviews import PrimaryView, EntityView +from cubicweb.web.views.editform import AutomaticEntityForm +from cubicweb.web.views.boxes import EditBox +AutomaticEntityForm.rcategories.set_rtag('secondary', 'firstname', 'subject', 'EUser') +AutomaticEntityForm.rcategories.set_rtag('secondary', 'surname', 'subject', 'EUser') +AutomaticEntityForm.rcategories.set_rtag('metadata', 'last_login_time', 'subject', 'EUser') +AutomaticEntityForm.rcategories.set_rtag('primary', 'in_group', 'subject', 'EUser') +AutomaticEntityForm.rcategories.set_rtag('generated', 'owned_by', 'object', 'EUser') +AutomaticEntityForm.rcategories.set_rtag('metadata', 'created_by', 'object', 'EUser') +AutomaticEntityForm.rcategories.set_rtag('metadata', 'bookmarked_by', 'object', 'EUser') +AutomaticEntityForm.rinlined.set_rtag(True, 'use_email', 'subject', 'EUser') + +EditBox.rmode.set_rtag('create', 'in_group', 'subject', 'EGroup') +EditBox.rmode.set_rtag('link', 'owned_by', 'object', 'EUser') +EditBox.rmode.set_rtag('link', 'created_by', 'object', 'EUser') +EditBox.rmode.set_rtag('create', 'bookmarked_by', 'object', 'EUser') + + class UserPreferencesEntityAction(Action): id = 'prefs' __select__ = (one_line_rset() & implements('EUser') & diff -r 2d1b721fded9 -r b20677336ee6 web/views/schema.py --- a/web/views/schema.py Thu Mar 26 19:15:57 2009 +0100 +++ b/web/views/schema.py Thu Mar 26 20:11:20 2009 +0100 @@ -18,6 +18,23 @@ from cubicweb.web.action import Action from cubicweb.web.views import baseviews from cubicweb.web.views import TmpFileViewMixin +from cubicweb.web.views.editform import AutomaticEntityForm +from cubicweb.web.views.boxes import EditBox + + +AutomaticEntityForm.rcategories.set_rtag('primary', 'require_group', 'subject', 'EPermission') +AutomaticEntityForm.rcategories.set_rtag('generated', 'final', 'subject', 'EEtype') +AutomaticEntityForm.rcategories.set_rtag('generated', 'final', 'subject', 'ERtype') +AutomaticEntityForm.rinlined.set_rtag(True, 'relation_type', 'subject', 'ENFRDef') +AutomaticEntityForm.rinlined.set_rtag(True, 'from_entity', 'subject', 'ENFRDef') +AutomaticEntityForm.rinlined.set_rtag(True, 'to_entity', 'subject', 'ENFRDef') +AutomaticEntityForm.rwidgets.set_rtag('StringWidget', 'expression', 'subject', 'RQLExpression') + +EditBox.rmode.set_rtag('create', 'state_of', 'object', 'EEType') +EditBox.rmode.set_rtag('create', 'transition_of', 'object', 'EEType') +EditBox.rmode.set_rtag('create', 'relation_type', 'object', 'ERType') +EditBox.rmode.set_rtag('link', 'from_entity', 'object', 'EEType') +EditBox.rmode.set_rtag('link', 'to_entity', 'object', 'EEType') class ViewSchemaAction(Action): diff -r 2d1b721fded9 -r b20677336ee6 web/views/workflow.py --- a/web/views/workflow.py Thu Mar 26 19:15:57 2009 +0100 +++ b/web/views/workflow.py Thu Mar 26 20:11:20 2009 +0100 @@ -20,6 +20,13 @@ from cubicweb.web.formfields import StringField, RichTextField from cubicweb.web.formwidgets import HiddenInput from cubicweb.web.views import TmpFileViewMixin +from cubicweb.web.views.boxes import EditBox + + +EditBox.rmode.set_rtag('create', 'destination_state', 'subject', 'Transition') +EditBox.rmode.set_rtag('create', 'allowed_transition', 'object', 'Transition') +EditBox.rmode.set_rtag('create', 'destination_state', 'object', 'State') +EditBox.rmode.set_rtag('create', 'allowed_transition', 'subject', 'State') # IWorkflowable views #########################################################