show authors on concept listing, include authors in text index of concepts; blog post: include text in text index

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2724 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-06-27 11:46:30 +00:00
parent 6bf8c4faf0
commit 082e4c9d17
3 changed files with 16 additions and 0 deletions

View file

@ -76,6 +76,7 @@
<th i18n:translate="">Title</th>
<th i18n:translate="">Type</th>
<th i18n:translate="">Modification Date</th>
<th i18n:translate="">Author(s)</th>
</tr>
<tal:items repeat="related children">
<tal:item define="class python: repeat['related'].odd() and 'even' or 'odd';
@ -91,6 +92,7 @@
<td><span tal:content="related/typeTitle"
i18n:translate="">Type</span></td>
<td><span tal:replace="related/modified">Type</span></td>
<td><span tal:replace="related/creators">Type</span></td>
</tr>
</tal:item>
</tal:items>

View file

@ -49,6 +49,7 @@ class BlogPost(Compound):
_adapterAttributes = Compound._adapterAttributes + ('text', 'private', 'creator',)
_contextAttributes = Compound._contextAttributes + ['date', 'privateComment']
_noexportAttributes = ('creator', 'text', 'private')
_textIndexAttributes = ('text',)
defaultTextContentType = 'text/restructured'
textContentType = defaultTextContentType

View file

@ -26,9 +26,11 @@ from zope import component, schema
from zope.app.container.btree import BTreeContainer
from zope.app.container.contained import Contained
from zope.app.container.interfaces import IAdding
from zope.app.security.interfaces import IAuthentication
from zope.cachedescriptors.property import Lazy
from zope.component import adapts
from zope.component.interfaces import ObjectEvent
from zope.dublincore.interfaces import IZopeDublinCore
from zope.event import notify
from zope.interface import implements
from zope.interface import alsoProvides, directlyProvides, directlyProvidedBy
@ -400,6 +402,7 @@ class IndexAttributes(object):
actx = adapted(ctx)
indexAttrs = getattr(actx, '_textIndexAttributes', ())
return ' '.join([getName(ctx), ctx.title, ctx.description] +
self.creators() +
[getattr(actx, attr, u'???') for attr in indexAttrs]).strip()
def title(self):
@ -407,6 +410,16 @@ class IndexAttributes(object):
return ' '.join((getName(context),
context.title, context.description)).strip()
def creators(self):
cr = IZopeDublinCore(self.context).creators or []
pau = component.getUtility(IAuthentication)
creators = []
for c in cr:
principal = pau.getPrincipal(c)
if principal is not None:
creators.append(principal.title)
return creators
# events