Foren

How to add a portlet in a Dockbar

sunil kumar biswal, geändert vor 11 Jahren.

How to add a portlet in a Dockbar

New Member Beiträge: 19 Beitrittsdatum: 25.03.12 Neueste Beiträge
Hello,
Good evening my liferay friends.I hav a doubt how to add a portlet in Dockbar.can i do this by making some changed in lifeferay-display.xml configuration file.It gives idea in which category a portlet is added.
<display >
<category name="category.sample">
<portlet id="portlet name"></portlet>
</category>
</display>
thumbnail
Jignesh Vachhani, geändert vor 11 Jahren.

RE: How to add a portlet in a Dockbar

Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
If you are talking about Add application section ? If yes then you are referring right xml(lifeferay-display.xml ) and settings.
thumbnail
Vitaliy Koshelenko, geändert vor 11 Jahren.

RE: How to add a portlet in a Dockbar

Expert Beiträge: 319 Beitrittsdatum: 25.03.11 Neueste Beiträge
Hi, Sunil.

Do you need to add portlet to the Control Panel category? You can do it with 'liferay-portlet.xml' file, like this:
<liferay-portlet-app>
	<portlet>
		<portlet-name>{YOUR_PORTLET_NAME}</portlet-name>
        <icon>/icon.png</icon>
        <control-panel-entry-category>portal</control-panel-entry-category>
        <control-panel-entry-weight>0</control-panel-entry-weight>
        <instanceable>false</instanceable>
        <render-weight>1</render-weight>
        <ajaxable>false</ajaxable>
        <header-portlet-css>/css/main.css</header-portlet-css>
        <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
    </portlet>
...
</liferay-portlet-app>

(the order of attributes is important here).

Vitaliy
biswajit sarkar, geändert vor 11 Jahren.

RE: How to add a portlet in a Dockbar

Regular Member Beiträge: 166 Beitrittsdatum: 17.10.11 Neueste Beiträge
yes you are talking about the right file(liferay-display.xml)....

if you and to change the category ,simply change the category name
thumbnail
Vitaliy Koshelenko, geändert vor 11 Jahren.

RE: How to add a portlet in a Dockbar

Expert Beiträge: 319 Beitrittsdatum: 25.03.11 Neueste Beiträge
Yes, simply change the <control-panel-entry-category> value. All available portlet categories are stored in PortletCategoryKeys class (""content", "my", "portal" and "server").
If you want to add custom category - add it to this class in this case.
thumbnail
Tonu Sri, geändert vor 11 Jahren.

RE: How to add a portlet in a Dockbar

Regular Member Beiträge: 197 Beitrittsdatum: 15.04.11 Neueste Beiträge
Hi Sunil,

See this section in portal.properties:

##
## Dockbar Portlet
##

#
# Set the portlet ids that will be shown directly in the "Add Application"
# menu.
#
dockbar.add.portlets=56,101,110,71


If you want to add your portlet, Add your portlet Id here.

Thanks:
thumbnail
Florence H, geändert vor 10 Jahren.

RE: How to add a portlet in a Dockbar

Junior Member Beiträge: 51 Beitrittsdatum: 03.11.09 Neueste Beiträge
Can we add a custom portlet from a hook in the "Add Application" menu with dockbar.add.portlets ?
I tried to do that, but my portlet doesn't appear and there's nothing in the log.
Sergei Sorokin, geändert vor 9 Jahren.

RE: How to add a portlet in a Dockbar

New Member Beitrag: 1 Beitrittsdatum: 08.09.10 Neueste Beiträge
As for Liferay 6.0.6 where is a restriction at the ROOT/html/js/liferay/dockbar.js

if ((/^\d+$/).test(portletId)) {
	Liferay.Portlet.add(
	{
		portletId: portletId
	}
	);
}


It means that only numerical portletIds are supported, but your custom portletIds are named portlertId_WAR_name
So try to fix dockbar.js with hook
thumbnail
Manikantha Rajamani, geändert vor 9 Jahren.

RE: How to add a portlet in a Dockbar

Expert Beiträge: 258 Beitrittsdatum: 25.03.14 Neueste Beiträge
Hi
Tonu Sri

Where i can found the portlet id
I searched in portlet tabel in that I found portletId but it is Like follow
Library_WAR_Libraryportlet
where i can found the numberic portlet id


thanks and regards
Manikantha R
thumbnail
Lokhande Vishnudas D., geändert vor 9 Jahren.

RE: How to add a portlet in a Dockbar

Regular Member Beiträge: 152 Beitrittsdatum: 27.05.13 Neueste Beiträge
You can find portlet id in portlet-custom.xml.
It is in webapps->root-->WEB-INF
thumbnail
Manikantha Rajamani, geändert vor 9 Jahren.

RE: How to add a portlet in a Dockbar

Expert Beiträge: 258 Beitrittsdatum: 25.03.14 Neueste Beiträge
Hi
Vishnu

I searched in portlet-custom.xml. file but it contains the id of out of box portlet
but i need the custom portlet id
event I seached in liferay-display.xml file inthat also it contains the out-of box portlet only
but not custom portlet



Regars and Thanks
Manikantha R
thumbnail
Manali Lalaji, geändert vor 9 Jahren.

RE: How to add a portlet in a Dockbar

Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Manikantha Rajamani:
Hi
Vishnu

I searched in portlet-custom.xml. file but it contains the id of out of box portlet
but i need the custom portlet id
event I seached in liferay-display.xml file inthat also it contains the out-of box portlet only
but not custom portlet



Regars and Thanks
Manikantha R


Hi,

You can use portletDisplay to get PortletId :

  ThemeDisplay themeDisplay= (ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
  PortletDisplay portletDisplay= themeDisplay.getPortletDisplay();
 String portletId= portletDisplay.getId();


HTH!