Foren

Showing web content from one community in another community

Rob Salowitz, geändert vor 15 Jahren.

Showing web content from one community in another community

New Member Beiträge: 2 Beitrittsdatum: 20.02.09 Neueste Beiträge
Sorry if this has been answered already but I've searched the forums & wiki and couldn't find it...

We are using 5.2.

I have two communities A & B. Each community has some web content articles. I am trying to show one of the articles from community B on a page in community A. But I cannot get the search in A to show me the articles from B.

- I go to a page in community A and add a web content display portlet.
- Then I click Select Web Content for that portlet
- Using the Advanced Search, I change the My Places dropdown and pick community B.
- I click Search.
- The My Places dropdown changes back to show community A and the only articles I see are all from community A. I can't get it to show me the articles from community B.

Are there certain permissions that have not been set correctly? This is a new Liferay install and I am an Administrator.

What am I missing (or doing wrong)? Maybe this feature doesn't exist? But this post leads me to think it does:
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/709357

Thanks for any help!
Margaret Fronczak, geändert vor 15 Jahren.

RE: Showing web content from one community in another community

New Member Beiträge: 16 Beitrittsdatum: 25.07.08 Neueste Beiträge
Your not missing anything Rob. The advanced search fro the Journal portlet has a drop down for status. The advanced search for the JournalContent portlet has a drop down that shows MyPlaces. They are the same jsp with conditional logic based on the portlet. The action bean that processes the request only references the status field.

My team mates, Ram Yellapragada & Srinivas Madala came up with a very clever fix for this problem. In the article_search.jsp under \webapps\ROOT\html\portlet\journal place the following code between lines 122 and 141.



						
<%
for (Group myPlace : myPlaces) {
	int searchGID = 0 ;
	if (request.getParameter("groupId")  != null )
			searchGID =  Integer.parseInt( request.getParameter("groupId") );
	else
			searchGID =  Integer.parseInt( displayTerms.GROUP_ID);
%>

	<option <%="searchGID" =="myPlace.getGroupId()" ? "selected" : "" %> value="&lt;%= myPlace.getGroupId() %&gt;"&gt;
		<c:choose>
			<c:when test="<%= myPlace.isUser() %>">
				<liferay-ui:message key="my-community" />
			</c:when>
			<c:otherwise>
				&lt;%= myPlace.getDescriptiveName() %&gt;
			</c:otherwise>
		</c:choose>
	</option>

&lt;%
}
%&gt;


Then in the journal_content/configuration.jsp paste the following code after line 249:

if (request.getParameter("groupId")  != null )
{
	int searchGID = Integer.parseInt( request.getParameter("groupId") );
	searchTerms.setGroupId(searchGID) ;
}


We'll be happy to share the code with you Rob :-)
Jeff Williams, geändert vor 15 Jahren.

RE: Showing web content from one community in another community

Regular Member Beiträge: 107 Beitrittsdatum: 15.07.08 Neueste Beiträge
Are you sure on that second bit of code? I don't see how that would work on line 249 of that jsp.
Jason Toris, geändert vor 15 Jahren.

RE: Showing web content from one community in another community

New Member Beiträge: 21 Beitrittsdatum: 22.01.09 Neueste Beiträge
I successfully implemented the code above on Liferay 5.2. You insert it right after line 257 or right after the variable searchTerms is defined and set. Here's what I have:

&lt;%
OrderByComparator orderByComparator = JournalUtil.getArticleOrderByComparator(searchContainer.getOrderByCol(), searchContainer.getOrderByType());

ArticleSearchTerms searchTerms = (ArticleSearchTerms)searchContainer.getSearchTerms();

if (request.getParameter("groupId")  != null )
{
    int searchGID = Integer.parseInt( request.getParameter("groupId") );
    searchTerms.setGroupId(searchGID) ;
}
%&gt;


Hope that helps.
Rob Salowitz, geändert vor 15 Jahren.

RE: Showing web content from one community in another community

New Member Beiträge: 2 Beitrittsdatum: 20.02.09 Neueste Beiträge
Many thanks to all. We will try it out and post an update as soon as possible.

Rob
Margaret Fronczak, geändert vor 11 Jahren.

RE: Showing web content from one community in another community

New Member Beiträge: 16 Beitrittsdatum: 25.07.08 Neueste Beiträge
Yes thank you!emoticon