Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To keep pace with other major blogging systems and provide standard features for blog customization, Roller should support a system for providing blog widgets. This is a proposal for how a widgets system might work in Roller. Other major blog systems which already include widget functionality are MovableType/TypePad, WordPress, LiveJournal, and Blogger, and undoubtably there are others as well. It's a good idea to check out how these other systems use widgets as a comparative basis for this proposal.

...

  • All widgets must have an xml descriptor.
  • All widgets must define a control template which is the template used to render the widget content.
  • A widget will be bundled into some kind of archive file, such as a jar file, so that it can be imported into the application easily.
  • widgets would be configured via a new page in the administration section which would list what widgets are configured and allow for importing of new widgets, removal of existing widgets, and enabling/disabling of widgets. this would all be possible at runtime, so the application would not need to be restarted to change widget definitions.

Grouping widgets into panels.

Widgets are typically configured into groupings which can define some layout options typically to determine the ordering of the widgets. To organize these groupings we would create the concept of "panels" which may contain any number of widgets and define how the widgets are layed out. The typical example of a widget panel is the a blog sidebar.

A weblog would be allowed to define any number of panels to use in its templates, and panels would be defined either in a theme definition, or defined and customized on the weblog customization UI. This Roller UI. The reason to support the idea of having multiple panels is two fold ...

1. some themes/designs will want more than one sidebar and should be allowd to do so while still leveraging the widgets feature for each.
2. if you take the idea one step further then technically you could define an entire theme using just panels and widgets and therefore provide a way for the user to customize all kinds of elements of their design using widgets, not just a sidebar.

The exact semantics of how this would work on the UI will be discussed more in the section about "Controlling widgets via the UI" below.

How do widgets get into templates?

Widgets would could be added into templates using a macro call such as ...

No Format
// display a single widget
#showWidget($model.weblog, "fooWidget")

// display a configured panel
#showPanel($model.weblog, "sidebar")

// the code for the #showPanel macro would be roughly this ...
#set($panel = $weblog$model.weblog.getPanel($panelName))
#foreach($widget in $panel.widgets)
  #showWidget($model.weblog, $widget)
#end

...

One of the most important aspects of the widget system is to make it easy for users to choose widgets and have them inserted into their templates. This would require a new UI page which gives the user a view of what panels they have defined, what widgets are configured for a panel, and all widgets that are available in the system. The user would then be able to choose a panel to work on, then add/remove widgets from a panel while drawing from using the pool of all available widgets.

...

Also, before spending too much time drawing up a UI I'd like to get general approval from the community with regards to the functional aspects of the proposal. It would be wasted time to design a nice UI only to have it discarded because we decided to use a different approach to the problem. Once we are committed to this general approach then we would spend more time flushing out the UI design and discussing that specifically. The main point is that users would have a wysiwyg style UI for choosing widgets and organizing them in panels which would alleviate the need for direct template editing.

Issues

  • how to access widget resources? Roller takes the approach that all components used by a weblog should be accessed via that weblogs urls, but this creates some issues for resources that are meant to be shared across weblogs.
    • option 1, use the existing resource servlet the same way we do for theme resources.
    • option 2, pick a url location outside of the weblog url space (/roller-ui/) to use for accessing widget resources, such as /roller-ui/widgets/<widget>/