-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello.
I have a few thoughts I wanted to share about this, too.
On 05/19/2013 06:44 PM, Lukas Zdych wrote:
> I'm curious what is the status of slots usage in Kotti right now ..
> when I tried Kotti for the firstime (a fews days ago) + was playing
> with some add-ons and I found out that:
>
> - if you register a widget to slot it show up on every page
>
> - you can hardcode which slot the widget will be for or you can
> use kotti settings to provide options to e.g. which slot it is for,
> which content type it is for .. and in code you might be able to
> limit based on path in site etc...
Yes. This should give you the tools to build something more
sophisticated on top of it. (Which is basically Kotti's gist.)
I should say I'm a bit reluctant towards a one-solution-for-all
approach with regard to portlets. It turned out that for the biggest
Plone project I worked on (
vienna.info), the stock Plone portlets
weren't a very good fit. So we ended up rolling our own portlet
implementation, which had features that were impossible to implement
with Plone's own portlets. For us, this worked quite well.
This is why I would suggest not aiming for putting your portlet
implementation into Kotti core, but rather to develop it as an add-on.
> - when enabled kotti's navigation widget it appears even if there
> is nothing to show resulting in displaying grey square on the righ
> page side
This is a bug that's easy to fix. A slot renderer can return None to
indicate that it doesn't want to be rendered. So there shouldn't be
any space, because the renderer will drop it. Please file a ticket,
or send a pull request if you feel up for it.
> - when checking how add-ons are using them found that e.g.
> kotti_grid seems quite interesting but didn't work at all for me
> yet (widgets started to jump around page breaking layout etc..
> currently useless for production)
>
> So I was looking around and found some tries to improve slots in
> the past by pyramid_snippets or so .. but that seemed to be changed
> a year ago last time (if I remember well)..
As Andreas said, this can be used today and it's working well for some
problems. We never got around to adding a menu for our rich text
editor to allow adding snippets in a more user-friendly way.
> To make it short what I'm missing in Kotti is context dependent
> widgets and guess why? .... I'm coming from Plone world .. ;-D ..
> here I would like to check if I missed something what might solve
> my need or if not then share my very raw idea how to implement
> something like kotti_snippets (which I'm more then happy to begin
> with).
It's interesting to note that before Plone 3, the portlet
implementation was based on persistent attributes: left_slots and
right_slots. As a developer, I liked this simple yet flexible
approach much more. I actually consider Plone's new portlets a
failure. It might work okay for some use cases, but it's definitely
horrible to develop for (just count the number of classes in
plone.portlets).
Of course users sometimes want to be able to assign the slots through
a web interface, and that's what the old Plone portlet implementation
didn't do, unless you considered the ZMI's property UI sufficient.
:-)
However, there were products based on top of left_slots and
right_slots that solved this problem quite nicely. One was
SimplePortlet, which I personally used with success.
> 1. define widget for every slot available in Kotti's UI which will
> take care about rendering snippets
>
> 2. add snippets management page (ideally accessible in context of
> any content type - not sure yet if that is possible to register it
> e.g. for Node)
Sure that's possible.
> - accessible by item in "actions" menu, content "views" menu or
> personal bar (doesn't really matter now) - render pure layout with
> wiget in every slot (defined in point 1) but in something like
> "edit" mode where it will render list of assigned snippets and
> provide basic actions like add new, remove and reorder
>
> 3. snippet would be represented by something like a
> SnippetAssignment holding information about a snippet's
> assignment: - slot it is assigned to - context / content type /
> users group it is limited for
I don't think that being able to filter by context or users is
something that you'll want to be able to define in the web UI. If you
have a portlet that wants to be rendered on the side of a specific
content type only, or only for a specific role, then most of the time
this logic is best implemented on the file system.
> - snippet data (not sure if store it in the same model or keep
> here relation to s SnippetType model holding data which can be
> different for different types of snippets) - I don't know SQL well
> so not sure if that is a good idea to have a table per snippet type
> or keep all snippet data in snippet assignment table e.g. as base64
> and serialize / unserialize as a dict of snippet attributes
You could use a JSON field for that. Kotti itself uses that to store
'Node.annotations'.
> 4. second part of the snippet would be a SnippetRenderer (just a
> view having a snippet assignment as context): - renders snippet
> based on its own snippet type specific attributes
>
> 5. widget rendering snippets would check if snippet suppose to be
> rendered based on slot, cotnext or group ..etc .. limits rather
> then going into a renderer of every snippet and decide there (but
> snippet renderer base class might define a property: def
> available(self): return True which might be second level of
> checking if it should be rendered or not (Then every snippet type
> implmentation can override this property / method).
>
> 6. provide simple base classes for SnippetAssignment,
> SnippetRenderer, SnippetAddView, SnippetEditView so it is as easy
> as possible to create new types of snippets...
Your approach seems quite reasonable to me. Except I'm a little
scared of too many classes. You'll maybe need to drink some more of
Kotti's 'simple is better than complex' kool-aid in the course of
doing this. :-)
> Some of you might see that this is highly inspired by Plone's
> portlets but I still see something like snippets / viewlets /
> portlets how ever you call it as Major features of modern CMS so
> would like to give it to Kotti it if we can keep it simple and not
> complicate or slow down the whole machine.
I agree that user-assignable portlets are nice, but it's not what I
consider a major feature of a CMS. I consider portlets themselves a
major feature, not the web UI to put them where you want.
But that's debatable and of course it's something that a lot of people
want, so I'd like to encourage you to build something openly that
solves this problem. With your work and feedback from the community,
I think we could get ourselves a very nice add-on, and one that a lot
of people would use.
Cheers
Daniel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iEYEARECAAYFAlGbWv8ACgkQi2kx5isbD8x4NgCfesFEiQYbWowYoId9/0vzDG/b
WgAAoIaXY+6UIoCICTRjlQxOxZT0HA/m
=km7Z
-----END PGP SIGNATURE-----