prepare for hiding concepts from parents portlet for certain roles

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3836 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-05-02 13:08:40 +00:00
parent 99a4e1ab2d
commit 89ed44a13f
2 changed files with 10 additions and 8 deletions

View file

@ -203,8 +203,9 @@ class ConceptView(BaseView):
cont = self.controller cont = self.controller
if cont is None: if cont is None:
return return
if self.parents and (self.globalOptions('showParentsForAnonymous') or if self.parentsForPortlet and (
not IUnauthenticatedPrincipal.providedBy(self.request.principal)): self.globalOptions('showParentsForAnonymous') or
not IUnauthenticatedPrincipal.providedBy(self.request.principal)):
cont.macros.register('portlet_right', 'parents', title=_(u'Parents'), cont.macros.register('portlet_right', 'parents', title=_(u'Parents'),
subMacro=concept_macros.macros['parents'], subMacro=concept_macros.macros['parents'],
priority=20, info=self) priority=20, info=self)
@ -324,14 +325,14 @@ class ConceptView(BaseView):
return False return False
@Lazy @Lazy
def parentsForPortlet(self):
return [p for p in self.parents() if not self.isHidden(p.relation)]
def parents(self): def parents(self):
result = [] rels = sorted(self.context.getParentRelations(),
rels = sorted((pr for pr in self.context.getParentRelations()
if not self.isHidden(pr)),
key=(lambda x: x.first.title.lower())) key=(lambda x: x.first.title.lower()))
for r in rels: for r in rels:
result.append(self.childViewFactory(r, self.request)) yield self.childViewFactory(r, self.request)
return result
def resources(self): def resources(self):
rels = self.context.getResourceRelations() rels = self.context.getResourceRelations()

View file

@ -233,7 +233,8 @@
<!-- portlets --> <!-- portlets -->
<metal:actions define-macro="parents"> <metal:actions define-macro="parents">
<div tal:repeat="concept macro/info/view/parents|macro/info/parents"> <div tal:repeat="
concept macro/info/view/parents|macro/info/parentsForPortlet">
<a href="#" <a href="#"
tal:attributes="href python: view.getUrlForTarget(concept)"> tal:attributes="href python: view.getUrlForTarget(concept)">
<span i18n:translate="" <span i18n:translate=""