diff --git a/src/pfwbged/folder/folder.py b/src/pfwbged/folder/folder.py index 835c4d5..f844667 100644 --- a/src/pfwbged/folder/folder.py +++ b/src/pfwbged/folder/folder.py @@ -11,6 +11,13 @@ from plone.dexterity.content import Container from Acquisition import aq_parent from plone.supermodel import model +from plone import api +from plone.uuid.interfaces import IUUID +from plone.app.layout.viewlets.interfaces import IBelowContentBody +import plone.app.contenttypes.interfaces +from plone.dexterity.interfaces import IDexterityContainer + +from pfwbged.collection.searchview import ResultsTable from . import _ @@ -22,12 +29,9 @@ class Folder(Container): """ """ implements(IFolder) -from plone.dexterity.interfaces import IDexterityContainer grok.templatedir('templates') grok.context(IDexterityContainer) -from plone.app.layout.viewlets.interfaces import IBelowContentBody -import plone.app.contenttypes.interfaces class FolderViewlet(grok.Viewlet): grok.context(plone.app.contenttypes.interfaces.IFolder) @@ -35,16 +39,28 @@ class FolderViewlet(grok.Viewlet): grok.viewletmanager(IBelowContentBody) grok.order(15) + @property + def table(self): + table = ResultsTable(self.context, self.request) + table.values = self.documents() + table.update() + return table + def documents(self): intids = component.getUtility(IIntIds) - catalog = component.getUtility(ICatalog) + intid_catalog = component.getUtility(ICatalog) + portal_catalog = api.portal.get_tool('portal_catalog') try: intid = intids.getId(self.context) except KeyError: return [] documents = [] - for item in catalog.findRelations({'to_id': intid}): + for item in intid_catalog.findRelations({'to_id': intid}): if item.isBroken(): continue - documents.append(aq_parent(item.from_object)) + document = aq_parent(item.from_object) + # this is stupid, getting back to the brain, but the rest of the + # stuff expects a brain, not an actual object. + uuid = IUUID(document, None) + documents.extend(portal_catalog({'UID': uuid})) return documents diff --git a/src/pfwbged/folder/templates/foldersviewlet.pt b/src/pfwbged/folder/templates/foldersviewlet.pt index 6170e91..15fe5bd 100644 --- a/src/pfwbged/folder/templates/foldersviewlet.pt +++ b/src/pfwbged/folder/templates/foldersviewlet.pt @@ -4,48 +4,9 @@
- - - - - - - - - - - - - - - - - - - - - - - -
IntituléAuteurDernière modification
S - - Bob Dobalina - - - - - August 16, 2001 at 23:35:59 - - -
+ + +