Dashboard > blojsom 3.0 > ... > Plugins > Widgets Plugin
  blojsom 3.0 Log In   View a printable version of the current page.  
  Widgets Plugin
Added by David Czarnecki, last edited by David Czarnecki on May 17, 2007  (view change)
Labels: 

Availability

blojsom 3.2

Description

Allows you to develop small widgets for display in your templates.

Installation and Setup

In your /WEB-INF/classes/blojsom-plugins.xml file, add the following:

<bean id="widgets" class="org.blojsom.plugin.widget.WidgetPlugin" init-method="init" destroy-method="destroy">
        <property name="eventBroadcaster">
            <ref bean="eventBroadcaster"/>
        </property>
    </bean>
    <bean id="widgets-administration" class="org.blojsom.plugin.widget.admin.WidgetAdministrationPlugin" init-method="init"
        destroy-method="destroy">
        <property name="servletConfig">
            <ref bean="servletConfigFactoryBean"/>
        </property>
        <property name="authorizationProvider">
            <ref bean="authorizationProvider"/>
        </property>
        <property name="resourceManager">
            <ref bean="resourceManager"/>
        </property>
        <property name="fetcher">
            <ref bean="fetcher"/>
        </property>        
        <property name="eventBroadcaster">
            <ref bean="eventBroadcaster"/>
        </property>
    </bean>
    <bean id="ip-widget" class="org.blojsom.plugin.widget.ip.IPAddressWidget" init-method="init" destroy-method="destroy">
        <property name="eventBroadcaster">
            <ref bean="eventBroadcaster"/>
        </property>        
    </bean>

NOTE: You do not need to include the bean element for the ip-widget if you don't want to use this widget. It is only a demonstration of what you can do with widgets.

You may then add "widgets" to one of the flavor-based plugin chains. The administration plugin will be available in the blojsom administration console under Plugins | Configure.

A user must have the following permissions in order to use the widgets administration plugin.

widget_admin_permission

Usage and URL Parameters

Context Attributes and Types

The following table describes the context attributes that are available and their associated type.

Context key Input or Output Type Description
BLOJSOM_WIDGET_TEMPLATES Output java.util.List Ordered list of rendered widget templates in the order specified per the requested flavor.
BLOJSOM_WIDGET_TEMPLATES_BY_WIDGET Output java.util.Map Map where the keys are the widget names and the values are the rendered widget templates. This can be used in your template to output specific widget templates in certain areas of a larger template.

Usage

There are two Velocity macros available that output widget templates rendered by this plugin.

Macro Usage Description
DisplayWidgetTemplates() #DisplayWidgetTemplates() Displays each of the rendered widget templates from the BLOJSOM_WIDGET_TEMPLATES context variable, where each widget template is wrapped within <p></p> tags.
DisplayWidgetTemplate('widget') #DisplayWidgetTemplate('ip-widget') Displays a specific rendered widget template from the BLOJSOM_WIDGET_TEMPLATES_BY_WIDGET context variable.

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators