Lets say we have a folder with many items, 30 Documents, 10 Images, 23 News Items, etc. etc.
If I want to make a folder view that shows the first 10 items of each, but also with a 'batch' version (so an (next button) below Documents.
How can this 'best' be done (fastest).
PS: Should work withouth knowing what portal types are in the folder (is there a way to know which content types a folder contains without 'getting everything )? )
I think that returns 'all content types', I need to have just those for the current folder, probably I could just 'find all' and use only unique values
Maybe:
def get_types(self):
folder = self.context # Assuming the script is created inside the folder
portal_types = [item.portal_type for item in folder.objectValues()]
return set(portal_types)
I wonder if there is a way to get 'for free' the 'batching buttons etc'. Since there will be a 'next page' for some content types and not one for others it would be super if there was a fill slot or something similar I could use (for each 'batch')
For multiple batches on the same site you might look at the b_start_str parameter from plone.base.batch.Batch ... with that parameter you can trigger for which batch you want to create the paging links:
Yepp. That is why I commented out, it might be that one content type should show something that I can not get (directly) from the catalog, most likely 'what other item it is related to (I think I will need 'obj' to use 'to_obj' (?), will check if I need it (customer meeting later today).
Yes but for plone.api.relation you also need the object again. On a really large system we made our own KeywordIndex with the related uuids as catalog metadata. would ne interesting to have some benchmarks how this "related item lookup" behaves with cataloged metadata or plone.api lookup
It would be nice to also show the icons for each content types in the title of each 'batch'.
If the content type is 'Folder', how do I get/render the icon that is defined for Folder. Should I read the registry ( <record name="plone.icon.Folder (or .folder) ) or is there another way to do this.
Note: This is just once for each 'tab/title', I dont have 'item' here
@@contentlisting is for Collection context ... @@folderListing for Folder wrong -> @@contentlisting is registered for folders and collections and should be used.
Introduce @@contentlisting view, which is also supports Collections from plone.app.contenttypes including filtering of results. This gives us a unified interface for listing content from Folders or Collections. Deprecate @@folderListing, which is kept for BBB compatibility. [thet]
Ah, you're right ... I've overseen the second registration for @@contentlisting for folderish types ... sorry for the noise. (I've edited my comment above)