Programmer's Cookbook

Recipes for the practical programmer

Friday, September 10, 2010

 

Liferay 6: Editing the dockbar

The dockbar is a Struts portlet, so it isn't something that you can control in a theme. Instead, you can modify the JSP that the portlet view uses.

View Files
/webapps/ROOT/html/portlet/dockbar/init.jsp
/webapps/ROOT/html/portlet/dockbar/view.jsp

Whether or not to display the dockbar is controlled in the theme. So in theory you could create your own portlet or vm file to display a completely custom dockbar. The theme file portal_normal.vm, and in the default portal_normal.vm you will see this.


#if($is_signed_in)
#dockbar()
#end


The dockbar portlet is referenced in the ROOT application (/webapps/ROOT/WEB-INF/) as portlet name/number 145. Snippets of these references are below.

liberay-portlet.xml

<portlet>
<portlet-name>145</portlet-name>
<icon>/html/icons/default.png</icon>
<struts-path>dockbar</struts-path>
<use-default-template>false</use-default-template>
<show-portlet-access-denied>false</show-portlet-access-denied>
<show-portlet-inactive>false</show-portlet-inactive>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<render-weight>50</render-weight>
<add-default-resource>true</add-default-resource>
<system>true</system>
</portlet>


portlet-custom.xml

<portlet>
<portlet-name>145</portlet-name>
<display-name>Dockbar</display-name>
<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
<init-param>
<name>view-action</name>
<value>/dockbar/view</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>

Labels:


This page is powered by Blogger. Isn't yours?