The structure of a post¶
The structure of a post in GroupServer may seem simple, but that is just good user-interface design. It is actually quite complex. In this document I will discuss the structure of the viewlets that are used to create the post.
The post itself provides two interfaces.
- To external code it looks like a content provider that
provides the interface
interfaces.IPostContentProvider
interface. - To the internal code that provide the content of the post it
is a viewlet manager that provides the
interfaces.IPost
interface.
Three viewlets provided by this product use the post viewlet manager, two of which contain viewlet managers themselves.
┌─Post viewlet manager─────────────────────────────────────┐
│ gs.group.messages.post.base.interfaces.IPost │
│ │
│ ┌─Metadata viewlet─────────────────────────────────────┐ │
│ │ gs-group-messages-post-base-metadata │ │
│ └──────────────────────────────────────────────────────┘ │
│ │
│ ┌─Actions viewlet──────────────────────────────────────┐ │
│ │ gs-group-messages-post-base-actions │ │
│ │ │ │
│ │ ┌─Actions viewlet manager──────────────────────────┐ │ │
│ │ │ gs.group.messages.post.base.interfaces.IActions │ │ │
│ │ └──────────────────────────────────────────────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────┘ │
│ │
│ ┌─Body viewlet─────────────────────────────────────────┐ │
│ │ gs-group-messages-post-base-body │ │
│ │ │ │
│ │ ┌─Post body viewlet manager────────────────────────┐ │ │
│ │ │ gs.group.messages.post.base.interfaces.IBody │ │ │
│ │ └──────────────────────────────────────────────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────┘
- Post:
- The overall container that holds the post is a viewlet
manager, which provides the
interfaces.IPost
interface. - Metadata:
- The metadata for the post is provided by a viewlet defined by this product The metadata includes the profile photo of the author, their name, and the date the post was made. (This metadata conforms to some microformats.)
- Actions:
- The controls the viewer can see (and thereby use) are shown by
the Actions. It is split in two: a viewlet for the post,
which then contains a viewlet manger for the content, which
provides the class
interfaces.IActions
. - Post body:
- The body is provided by a viewlet that slots into the post
viewlet manager. Views of the post provide state that they are
managed by the
interfaces.IBody
viewlet manager.
As a consequence of this design, the actual body of the post is provided by other products. Hidden posts are handled by the gs.group.messages.post.hide product, which also controls if the Hide button appears in the actions; plain-text posts (text/plain) are rendered by the gs.group.messages.post.text product.
Interfaces¶
Three interfaces are used within the post:
interfaces.IPost
for the overall layout,
interfaces.IActions
for the actions, and
interfaces.IBody
for the actual body.
-
class
gs.group.messages.post.base.interfaces.
IPost
¶ The viewlet manager for the post.
Viewlets that wish to provide content for the post should state that their manager is this interface:
1 2 3 4 5 6 7 8
<browser:viewlet name="gs-group-messages-post-base-metadata" manager="gs.group.messages.post.base.interfaces.IPost" class=".metadata.PostMetadataViewlet" template="browser/templates/metadata.pt" permission="zope2.View" weight="10" title="Metadata" />
-
class
gs.group.messages.post.base.interfaces.
IActions
¶ The viewlet manager for the post actions.
Viewlets that wish to provide actions for the post should state that their manager is this interface:
1 2 3 4 5 6 7 8
<browser:viewlet name="gs-group-messages-post-hide-button" manager="gs.group.messages.post.base.interfaces.IActions" class=".button.HideButton" template="browser/templates/button.pt" permission="zope2.View" weight="90" title="Hide" />
-
class
gs.group.messages.post.base.interfaces.
IBody
¶ The viewlet manager for the post body.
Viewlets that wish to provide views for the post body should state that their manager is this interface:
1 2 3 4 5 6 7 8
<browser:viewlet name="gs-group-messages-post-text" manager="gs.group.messages.post.base.interfaces.IBody" class=".body.PlainTextBody" template="browser/templates/body.pt" permission="zope2.View" weight="10" title="Text" />