Close this search box.

A view on Views

Views in Plone have been introduced in Plone 2.1 and they basically allow you to define the way e.g. a folder
listing is rendered (photoalbum, table, listing etc.) by defining which skin is to be used for it (don’t
confuse these Plone views with Zope3 views. They are completely different right now).

While this was a great enhancement back then new use cases have been discovered in the meanwhile which
would need additions to the mechanism we have in place right now. Let’s look at a photo album as an example.
We might have the need for some more tools or settings. For the settings you might wish to define the
numbers of photos on a page, define the sizes of them and so on. Regarding tools you might want to
have some batch view which allows you to see a batch of photos each listed with input fields for title,
description and tags for easy batch editing (as well as maybe a function for deletion).

So this is apparently not possible with the actual implementation but it could be by using some funky
new Zope 3 technology like interfaces. So how could this look like for the photo album?

First of all we would need to mark a folder as implementing some IPhotoalbum interface. This should be
added dynamically by the user on the actual folder instance (I’ve been told that this is possible and I
remember that I’ve seen something similar in one of the earliest Zope3 demos by Jim back in 1880). So when
we have that interface attached then all sorts of things become possible. We could e.g. attach some Zope3
view to it which allows the batch editing. Or we could use the new browser menu stuff, Martin Aspeli was
working on at the archipelago sprint and attach some menus to it (for accessing these views).
Or we could even attach some special photo viewlets to a ViewletManager in the page for adding some
photo related stuff on the page (like displaying EXIF data).

All in all not that much seems to be missing right now except maybe the functionality for adding
the interfaces dynamically. And this must be designed with care on the UI front as you wouldn’t
like the end user to choose from interfaces which say nothing to him. Instead this needs to be
mapped somehow to functionality and one might also need to think about certain restrictions for
what interfaces might make sense together and which might not (of course this can also be applied
to any object not just folders). Here some use cases might be interesting for planning.

So as soon as I know how to add interfaces dynamically, I might give it a try (I also remember that
somebody on IRC was pointing to some product which already does make it but unfortunately I cannot
remember anymore who or what it was. I really should blog everything directly ;-)

Teile diesen Beitrag