Hi all!
In a recent project I had to add these portlets ("My Workflow Tasks" and "My Submissions") to a normal user page. By default they are shown in the control panel, but depending on your project needs you may want to use them elsewhere. Here are the steps you need to achieve this easily.
Basically you need three things:
- Remove them from the control panel
- Add them to the "Add Applications" menu
- Add "ADD_TO_PAGE" permissions
To do this you need an ext plugin (which you can create in the liferay plugins sdk via <<create my-ext "my ext">> command)
Once you have your ext plugin ready in your plugins sdk, go to your-ext/docroot/WEB-INF/ext-web/docroot/WEB-INF
in your-ext/docroot/WEB-INF/ext-web/docroot/WEB-INF/liferay-portlet-ext.xml add this (this is the original content minus the control panel classes configuration)
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.0.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_0_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>153</portlet-name>
<icon>/html/icons/my_workflow_tasks.png</icon>
<struts-path>my_workflow_tasks</struts-path>
<portlet-url-class>com.liferay.portal.struts.StrutsActionPortletURL</portlet-url-class>
<use-default-template>false</use-default-template>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<render-weight>50</render-weight>
<header-portlet-css>/html/portlet/asset_publisher/css/main.jsp</header-portlet-css>
<header-portlet-css>/html/portlet/enterprise_admin/css/main.jsp</header-portlet-css>
<header-portlet-css>/html/portlet/workflow_definitions/css/main.jsp</header-portlet-css>
<css-class-wrapper>portlet-workflow-tasks</css-class-wrapper>
</portlet>
<portlet>
<portlet-name>158</portlet-name>
<icon>/html/icons/my_workflow_instances.png</icon>
<struts-path>my_workflow_instances</struts-path>
<portlet-url-class>com.liferay.portal.struts.StrutsActionPortletURL</portlet-url-class>
<use-default-template>false</use-default-template>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<render-weight>50</render-weight>
<header-portlet-css>/html/portlet/asset_publisher/css/main.jsp</header-portlet-css>
<header-portlet-css>/html/portlet/enterprise_admin/css/main.jsp</header-portlet-css>
<header-portlet-css>/html/portlet/workflow_definitions/css/main.jsp</header-portlet-css>
<css-class-wrapper>portlet-workflow-instances</css-class-wrapper>
</portlet>
</liferay-portlet-app>
in your-ext/docroot/WEB-INF/ext-web/docroot/WEB-INF/liferay-display.xml remove
<portlet id="153" />
<portlet id="158" />
from hidden category and add them to another one (the one which you prefer!)
In your-ext/docroot/WEB-INF/ext-impl/src/resource-actions/workflow.xml, add this (which is the original workflow.xml after deleting ACCESS_IN_CONTROL_PANEL permission and adding ADD_TO_PAGE):
...
<portlet-name>153</portlet-name>
<permissions>
<supports>
<action-key>ADD_TO_PAGE</action-key>
<action-key>CONFIGURATION</action-key>
<action-key>VIEW</action-key>
</supports>
...
<portlet-name>158</portlet-name>
<permissions>
<supports>
<action-key>ADD_TO_PAGE</action-key>
<action-key>CONFIGURATION</action-key>
<action-key>VIEW</action-key>
</supports>
...
When you're done, run ant deploy and restart your application server.
And that's it! I hope I helped you
Regards,
Juan Fernández