掲示板

how to add configured portlets via "add application"

15年前 に kuhajeyan gunaratnam によって更新されました。

how to add configured portlets via "add application"

New Member 投稿: 14 参加年月日: 08/09/24 最新の投稿
Hi,

I want to enable my users add the configured portlet via add application. for example i have configured a rss portlet for some urls. i want the users to be able to add this rss portlet instance via "add application". is there a way to implement this?

Thanks
thumbnail
15年前 に Jerry Niu によって更新されました。

RE: how to add configured portlets via "add application"

Expert 投稿: 451 参加年月日: 06/06/21 最新の投稿
If its just to change the default URLs that are in the RSS, modify the portlet.xml as those values come from portletpreference settings.

If its multiple RSS and you pick one. I would create multiple portlets with diferent default URLs and a different name and select it. Look at our portlet development wki pages for guidance.
15年前 に kuhajeyan gunaratnam によって更新されました。

RE: how to add configured portlets via "add application"

New Member 投稿: 14 参加年月日: 08/09/24 最新の投稿
Jerry Niu:
If its just to change the default URLs that are in the RSS, modify the portlet.xml as those values come from portletpreference settings.

If its multiple RSS and you pick one. I would create multiple portlets with diferent default URLs and a different name and select it. Look at our portlet development wki pages for guidance.


Thanks jerry, what is the easy way to replicate a portlet? how would create multiple rss portlets?

i have same problem with journal content portlet. i have configured journal content portlet for some default information item. Users should be able to add it from "add application". is that can also be easily done like via portlet preference settings.

Thanks
thumbnail
15年前 に Jerry Niu によって更新されました。

RE: how to add configured portlets via "add application"

Expert 投稿: 451 参加年月日: 06/06/21 最新の投稿
You cannot apply the same technique to Journal as I've suggested for RSS. Look into Page Templates for possible solutions.

For RSS, since it can have default values set via PortletPerferences, you're really duplicating the same portlet and just changing the default one. So, its mostly copy and paste and giving your RSS portlets a block of ID to use.
15年前 に kuhajeyan gunaratnam によって更新されました。

RE: how to add configured portlets via "add application"

New Member 投稿: 14 参加年月日: 08/09/24 最新の投稿
Jerry Niu:
You cannot apply the same technique to Journal as I've suggested for RSS. Look into Page Templates for possible solutions.

For RSS, since it can have default values set via PortletPerferences, you're really duplicating the same portlet and just changing the default one. So, its mostly copy and paste and giving your RSS portlets a block of ID to use.


Thanks jerry, i was able to replicate the rss portlet via just copying and pasting the configuration settings. But still no luck how i can able to get the same functionality for "Journal Content" portlet. Page template seems not a help. Any idea how i bring the configured portlets to "Add Application"

Thanks.

Regards,
Kuhajeyan G.
15年前 に Walter Hardy によって更新されました。

RE: how to add configured portlets via "add application"

New Member 投稿: 4 参加年月日: 08/02/19 最新の投稿
Jerry Niu:
If its just to change the default URLs that are in the RSS, modify the portlet.xml as those values come from portletpreference settings.

If its multiple RSS and you pick one. I would create multiple portlets with diferent default URLs and a different name and select it. Look at our portlet development wki pages for guidance.


I'm trying to create a custom portlet based on the RSS sample as well. I can't find where the portlet or portlet.xml reside?

Do I understand it right that the portlets are in the liferay war, and I need to use the EXT environment to make modified copies? Thanks.

Walter
15年前 に kuhajeyan gunaratnam によって更新されました。

RE: how to add configured portlets via "add application"

New Member 投稿: 14 参加年月日: 08/09/24 最新の投稿
Walter Hardy:
Jerry Niu:
If its just to change the default URLs that are in the RSS, modify the portlet.xml as those values come from portletpreference settings.

If its multiple RSS and you pick one. I would create multiple portlets with diferent default URLs and a different name and select it. Look at our portlet development wki pages for guidance.


I'm trying to create a custom portlet based on the RSS sample as well. I can't find where the portlet or portlet.xml reside?

Do I understand it right that the portlets are in the liferay war, and I need to use the EXT environment to make modified copies? Thanks.

Walter


walter you need to use the EXT environment for this. there portlet-ext.xml, liferay-portlet-ext.xml, liferay-display.xml available in following location \ext\ext-web\docroot\WEB-INF. These files are identical to what available in Source environtment.

for your new rssXXXX.

Add a entry in portlet-ext.xml like following,
<portlet>
		<portlet-name>777</portlet-name>
		<display-name>MyNewsRSS</display-name>
		<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
		<init-param>
			<name>view-action</name>
			<value>/rss/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>
		<portlet-preferences>
			<preference>
				<name>urls</name>
				<value>http://www.cnn.com/news/rss.xml</value>				
			</preference>
			<preference>
				<name>items-per-channel</name>
				<value>2</value>
			</preference>
			<preferences-validator>com.liferay.portlet.rss.RSSPreferencesValidator</preferences-validator>
		</portlet-preferences>
		<security-role-ref>
			<role-name>administrator</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>power-user</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>user</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>guest</role-name>
		</security-role-ref>
	</portlet>


and add entry in liferay-portet-ext.xml like following


<portlet>
		<portlet-name>777</portlet-name>
		<icon>/html/portlet/rss/icon.png</icon>
		<struts-path>rss</struts-path>
		<configuration-action-class>com.liferay.portlet.rss.action.ConfigurationActionImpl</configuration-action-class>
		<use-default-template>false</use-default-template>
		<restore-current-view>false</restore-current-view>
		<instanceable>true</instanceable>
		<private-request-attributes>false</private-request-attributes>
		<private-session-attributes>false</private-session-attributes>
		<render-weight>0</render-weight>
		<header-portlet-css>/html/portlet/rss/css.jsp</header-portlet-css>
		<css-class-wrapper>portlet-rss</css-class-wrapper>
	</portlet>


and you may have to add entry in liferay-display.xml as follows,

<category name="category.news">
		<portlet id="5" />
		<portlet id="39" />		
		<portlet id="83" />
		<portlet id="84" />
		<portlet id="777" />			
	</category>


at last add an entry in language.properties file for your new portlet which is under
\ext\ext-impl\src\content, like following

javax.portlet.title.777=MyOwnRSS

Hope with this you also able infer the logic behind adding this new entries as well.